From 93f21530ad0a17310f97f1a25dfbc67b249bf2e7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 1 Feb 2016 20:59:32 -0500 Subject: [PATCH] Improve the custom type of some user options. * lisp/autoinsert.el (auto-insert-alist): * lisp/replace.el (query-replace-from-to-separator): * lisp/gnus/gnus-art.el (gnus-hidden-properties): * lisp/gnus/gnus-gravatar.el (gnus-gravatar-properties): * lisp/gnus/gnus-picon.el (gnus-picon-properties): * lisp/progmodes/prolog.el (prolog-keywords, prolog-types) (prolog-mode-specificators, prolog-determinism-specificators) (prolog-directives, prolog-program-name, prolog-program-switches) (prolog-consult-string, prolog-compile-string, prolog-eof-string) (prolog-prompt-regexp): Improve custom type. --- lisp/autoinsert.el | 12 +++++++++++- lisp/gnus/gnus-art.el | 2 +- lisp/gnus/gnus-gravatar.el | 2 +- lisp/gnus/gnus-picon.el | 2 +- lisp/progmodes/prolog.el | 44 +++++++++++++++++++++++++++----------------- lisp/replace.el | 2 +- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index e5dd62ff4d8..43fa31288e6 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -305,7 +305,17 @@ ACTION may be a skeleton to insert (see `skeleton-insert'), an absolute file-name or one relative to `auto-insert-directory' or a function to call. ACTION may also be a vector containing several successive single actions as described above, e.g. [\"header.insert\" date-and-author-update]." - :type 'sexp + :type '(alist :key-type + (choice (regexp :tag "Regexp matching file name") + (symbol :tag "Major mode") + (cons :tag "Condition and description" + (choice :tag "Condition" + (regexp :tag "Regexp matching file name") + (symbol :tag "Major mode")) + (string :tag "Description"))) + ;; There's no custom equivalent of "repeat" for vectors. + :value-type (choice file function + (sexp :tag "Skeleton or vector"))) :version "25.1" :group 'auto-insert) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 54bbfd857f1..366d14aca1d 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -260,7 +260,7 @@ This can also be a list of the above values." ;; needed there. And XEmacs doesn't handle `intangible' anyway. '(invisible t) "Property list to use for hiding text." - :type 'sexp + :type 'plist :group 'gnus-article-hiding) ;; Fixme: This isn't the right thing for mixed graphical and non-graphical diff --git a/lisp/gnus/gnus-gravatar.el b/lisp/gnus/gnus-gravatar.el index deb6e4bc4c9..de7203d9d10 100644 --- a/lisp/gnus/gnus-gravatar.el +++ b/lisp/gnus/gnus-gravatar.el @@ -41,7 +41,7 @@ If nil, default to `gravatar-size'." (defcustom gnus-gravatar-properties '(:ascent center :relief 1) "List of image properties applied to Gravatar images." - :type 'sexp + :type 'plist :version "24.1" :group 'gnus-gravatar) diff --git a/lisp/gnus/gnus-picon.el b/lisp/gnus/gnus-picon.el index 6365e8e2ff7..bbbe0eded4e 100644 --- a/lisp/gnus/gnus-picon.el +++ b/lisp/gnus/gnus-picon.el @@ -73,7 +73,7 @@ Some people may want to add \"unknown\" to this list." (defcustom gnus-picon-properties '(:color-symbols (("None" . "white"))) "List of image properties applied to picons." - :type 'sexp + :type 'plist :version "24.3" :group 'gnus-picon) diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 4f23f87dd59..9c15f3b6a0e 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -272,9 +272,6 @@ ;; Version 0.1.35: ;; o Minor font-lock bug fixes. -;;; TODO: - -;; Replace ":type 'sexp" with more precise Custom types. ;;; Code: @@ -441,7 +438,12 @@ Legal values: "Alist of Prolog keywords which is used for font locking of directives." :version "24.1" :group 'prolog-font-lock - :type 'sexp + ;; Note that "(repeat string)" also allows "nil" (repeat-count 0). + ;; This gets processed by prolog-find-value-by-system, which + ;; allows both the car and the cdr to be a list to eval. + ;; Though the latter must have the form '(eval ...)'. + ;; Of course, none of this is documented... + :type '(repeat (list (choice symbol sexp) (choice (repeat string) sexp))) :risky t) (defcustom prolog-types @@ -451,7 +453,7 @@ Legal values: "Alist of Prolog types used by font locking." :version "24.1" :group 'prolog-font-lock - :type 'sexp + :type '(repeat (list (choice symbol sexp) (choice (repeat string) sexp))) :risky t) (defcustom prolog-mode-specificators @@ -461,7 +463,7 @@ Legal values: "Alist of Prolog mode specificators used by font locking." :version "24.1" :group 'prolog-font-lock - :type 'sexp + :type '(repeat (list (choice symbol sexp) (choice (repeat string) sexp))) :risky t) (defcustom prolog-determinism-specificators @@ -472,7 +474,7 @@ Legal values: "Alist of Prolog determinism specificators used by font locking." :version "24.1" :group 'prolog-font-lock - :type 'sexp + :type '(repeat (list (choice symbol sexp) (choice (repeat string) sexp))) :risky t) (defcustom prolog-directives @@ -482,7 +484,7 @@ Legal values: "Alist of Prolog source code directives used by font locking." :version "24.1" :group 'prolog-font-lock - :type 'sexp + :type '(repeat (list (choice symbol sexp) (choice (repeat string) sexp))) :risky t) @@ -569,7 +571,8 @@ the first column (i.e., DCG heads) inserts ` -->' and newline." (or (car names) "prolog")))) "Alist of program names for invoking an inferior Prolog with `run-prolog'." :group 'prolog-inferior - :type 'sexp + :type '(alist :key-type (choice symbol sexp) + :value-type (group (choice string (const nil) sexp))) :risky t) (defun prolog-program-name () (prolog-find-value-by-system prolog-program-name)) @@ -580,7 +583,7 @@ the first column (i.e., DCG heads) inserts ` -->' and newline." "Alist of switches given to inferior Prolog run with `run-prolog'." :version "24.1" :group 'prolog-inferior - :type 'sexp + :type '(repeat (list (choice symbol sexp) (choice (repeat string) sexp))) :risky t) (defun prolog-program-switches () (prolog-find-value-by-system prolog-program-switches)) @@ -604,7 +607,8 @@ Some parts of the string are replaced: region of a buffer, in which case it is the number of lines before the region." :group 'prolog-inferior - :type 'sexp + :type '(alist :key-type (choice symbol sexp) + :value-type (group (choice string (const nil) sexp))) :risky t) (defun prolog-consult-string () @@ -631,17 +635,21 @@ Some parts of the string are replaced: If `prolog-program-name' is non-nil, it is a string sent to a Prolog process. If `prolog-program-name' is nil, it is an argument to the `compile' function." :group 'prolog-inferior - :type 'sexp + :type '(alist :key-type (choice symbol sexp) + :value-type (group (choice string (const nil) sexp))) :risky t) (defun prolog-compile-string () (prolog-find-value-by-system prolog-compile-string)) (defcustom prolog-eof-string "end_of_file.\n" - "Alist of strings that represent end of file for prolog. -nil means send actual operating system end of file." + "String or alist of strings that represent end of file for prolog. +If nil, send actual operating system end of file." :group 'prolog-inferior - :type 'sexp + :type '(choice string + (const nil) + (alist :key-type (choice symbol sexp) + :value-type (group (choice string (const nil) sexp)))) :risky t) (defcustom prolog-prompt-regexp @@ -653,7 +661,8 @@ nil means send actual operating system end of file." "Alist of prompts of the prolog system command line." :version "24.1" :group 'prolog-inferior - :type 'sexp + :type '(alist :key-type (choice symbol sexp) + :value-type (group (choice string (const nil) sexp))) :risky t) (defun prolog-prompt-regexp () @@ -664,7 +673,8 @@ nil means send actual operating system end of file." ;; (t "^|: +")) ;; "Alist of regexps matching the prompt when consulting `user'." ;; :group 'prolog-inferior -;; :type 'sexp +;; :type '(alist :key-type (choice symbol sexp) +;; :value-type (group (choice string (const nil) sexp))) ;; :risky t) (defcustom prolog-debug-on-string "debug.\n" diff --git a/lisp/replace.el b/lisp/replace.el index f5c8d33b5f5..dfe8cd739a2 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -85,7 +85,7 @@ from Isearch by using a key sequence like `C-s C-s M-%'." "24.3") ;; while preparing to dump, also stops customize-rogue listing this. :initialize 'custom-initialize-delay :group 'matching - :type 'sexp + :type '(choice string (sexp :tag "Display specification")) :version "25.1") (defcustom query-replace-from-history-variable 'query-replace-history -- 2.11.4.GIT