From 0fac75fed1c7d61858bef15e951bf9a0835d5bac Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 30 Jan 2016 11:48:18 -0800 Subject: [PATCH] Improve the custom type of some user options. * lisp/desktop.el (desktop-minor-mode-table): * lisp/man.el (Man-frame-parameters): * lisp/midnight.el (midnight-delay): * lisp/speedbar.el (speedbar-select-frame-method): * lisp/tooltip.el (tooltip-frame-parameters): * lisp/tree-widget.el (tree-widget-space-width): * lisp/type-break.el (type-break-keystroke-threshold): * lisp/woman.el (woman-imenu-generic-expression): * lisp/cedet/ede.el (ede-debug-program-function): * lisp/cedet/ede/project-am.el (project-am-debug-target-function): * lisp/emulation/viper-keym.el (viper-toggle-key): * lisp/erc/erc-networks.el (erc-server-alist): * lisp/gnus/message.el (message-deletable-headers, message-signature): * lisp/mail/mailalias.el (mail-directory-stream): * lisp/play/tetris.el (tetris-x-colors): * lisp/progmodes/gud.el (gud-tooltip-modes): Improve custom type. --- lisp/cedet/ede.el | 2 +- lisp/cedet/ede/project-am.el | 2 +- lisp/desktop.el | 4 +++- lisp/emulation/viper-keym.el | 6 ++---- lisp/erc/erc-networks.el | 10 +++++++++- lisp/gnus/message.el | 8 +++++--- lisp/mail/mailalias.el | 7 ++++++- lisp/man.el | 4 +++- lisp/midnight.el | 2 +- lisp/play/tetris.el | 10 ++++++++-- lisp/progmodes/gud.el | 2 +- lisp/speedbar.el | 8 ++++---- lisp/tooltip.el | 4 +++- lisp/tree-widget.el | 6 ++++-- lisp/type-break.el | 2 +- lisp/woman.el | 5 ++++- 16 files changed, 56 insertions(+), 26 deletions(-) diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el index 41d6c8903b0..f013d4302b7 100644 --- a/lisp/cedet/ede.el +++ b/lisp/cedet/ede.el @@ -96,7 +96,7 @@ target willing to take the file. `never' means never perform the check." (defcustom ede-debug-program-function 'gdb "Default Emacs command used to debug a target." :group 'ede - :type 'sexp) ; make this be a list of options some day + :type 'function) ; make this be a list of options some day (defcustom ede-project-directories nil "Directories in which EDE may search for project files. diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el index e1b0c3d74fe..715f3cf46d5 100644 --- a/lisp/cedet/ede/project-am.el +++ b/lisp/cedet/ede/project-am.el @@ -65,7 +65,7 @@ (defcustom project-am-debug-target-function 'gdb "*Default Emacs command used to debug a target." :group 'project-am - :type 'sexp) ; make this be a list some day + :type 'function) ; make this be a list some day (defconst project-am-type-alist '(("bin" project-am-program "bin_PROGRAMS" t) diff --git a/lisp/desktop.el b/lisp/desktop.el index e795d9c2300..822db050e1f 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -554,7 +554,9 @@ RESTORE-FUNCTION nil means don't try to restore the minor mode. Only minor modes for which the name of the buffer-local variable and the name of the minor mode function are different have to be added to this table. See also `desktop-minor-mode-handlers'." - :type 'sexp + :type '(alist :key-type (symbol :tag "Minor mode") + :value-type (list :tag "Restore function" + (choice (const nil) function))) :group 'desktop) ;;;###autoload diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index 998f850f8c5..f5bb32fcb2d 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -154,10 +154,8 @@ viper-insert-basic-map. Not recommended, except for novice users.") ;; Some important keys used in viper (defcustom viper-toggle-key [(control ?z)] ; "\C-z" "The key used to change states from Emacs to Vi and back. -In insert mode, this key also functions as Meta. - -Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]." - :type 'sexp +In insert mode, this key also functions as Meta." + :type 'key-sequence :group 'viper :set (lambda (symbol value) (let ((old-value (if (boundp 'viper-toggle-key) diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index c859a48a79a..f911d6438be 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -443,7 +443,15 @@ NET is a symbol indicating to which network from `erc-networks-alist' this HOST is the servers hostname and PORTS is either a number, a list of numbers, or a list of port ranges." :group 'erc-networks - :type 'sexp) + :type '(alist :key-type (string :tag "Name") + :value-type + (group symbol (string :tag "Hostname") + (choice :tag "Ports" + (integer :tag "Port number") + (repeat :tag "List of ports or ranges" + (choice (integer :tag "Port number") + (list :tag "Port range" + integer integer))))))) (defcustom erc-networks-alist '((4-irc "4-irc.com") diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index f175036e96f..27cae74c755 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -256,10 +256,10 @@ This is a list of regexps and regexp matches." :type '(repeat regexp)) (defcustom message-deletable-headers '(Message-ID Date Lines) - "Headers to be deleted if they already exist and were generated by message previously." + "Headers to delete if present and previously generated by message." :group 'message-headers :link '(custom-manual "(message)Message Headers") - :type 'sexp) + :type '(repeat (symbol :tag "Header"))) (defcustom message-ignored-news-headers "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:\\|^X-Message-SMTP-Method:\\|^X-Gnus-Delayed:" @@ -1072,7 +1072,9 @@ If t, the `message-signature-file' file will be inserted instead. If a function, the result from the function will be used instead. If a form, the result from the form will be used instead." :version "23.2" - :type 'sexp + :type '(choice string (const :tag "Contents of signature file" t) + function + sexp) :risky t :link '(custom-manual "(message)Insertion Variables") :group 'message-insertion) diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el index 35528af2c49..59670a7dcbd 100644 --- a/lisp/mail/mailalias.el +++ b/lisp/mail/mailalias.el @@ -130,7 +130,12 @@ or like this: (defcustom mail-directory-stream nil "List of (HOST SERVICE) for stream connection to mail directory." - :type 'sexp + :type '(choice (const nil) + (list (string :tag "Host name or ip address") + (choice (integer :tag "Service port number") + (string :tag "Service name")) + (plist :inline t + :tag "Additional open-network-stream parameters"))) :group 'mailalias) (put 'mail-directory-stream 'risky-local-variable t) diff --git a/lisp/man.el b/lisp/man.el index 04a7fc3fe7a..b483dd12e8a 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -184,7 +184,9 @@ The value also can be a positive integer for a fixed width." (defcustom Man-frame-parameters nil "Frame parameter list for creating a new frame for a manual page." - :type 'sexp + :type '(repeat (cons :format "%v" + (symbol :tag "Parameter") + (sexp :tag "Value"))) :group 'man) (defcustom Man-downcase-section-letters-flag t diff --git a/lisp/midnight.el b/lisp/midnight.el index a9eedd74624..0e68eb923cd 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el @@ -217,7 +217,7 @@ You should set this variable before loading midnight.el, or set it by calling `midnight-delay-set', or use `custom'. If you wish, you can use a string instead, it will be passed as the first argument to `run-at-time'." - :type 'sexp + :type '(choice integer string) :set #'midnight-delay-set) (provide 'midnight) diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el index b68b5417479..d4ab668a4e9 100644 --- a/lisp/play/tetris.el +++ b/lisp/play/tetris.el @@ -87,9 +87,15 @@ If the return value is a number, it is used as the timer period." (defcustom tetris-x-colors [[0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]] - "Vector of colors of the various shapes." + "Vector of RGB colors of the various shapes." :group 'tetris - :type 'sexp) + :type '(vector (vector :tag "Shape 1" number number number) + (vector :tag "Shape 2" number number number) + (vector :tag "Shape 3" number number number) + (vector :tag "Shape 4" number number number) + (vector :tag "Shape 5" number number number) + (vector :tag "Shape 6" number number number) + (vector :tag "Shape 7" number number number))) (defcustom tetris-buffer-name "*Tetris*" "Name used for Tetris buffer." diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 7843efdf158..356cd3e0532 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -3406,7 +3406,7 @@ it if ARG is omitted or nil." (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode python-mode) "List of modes for which to enable GUD tooltips." - :type 'sexp + :type '(repeat (symbol :tag "Major mode")) :group 'gud :group 'tooltip) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index f4698732077..4ed00ae439d 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -3469,11 +3469,11 @@ TOKEN will be the list, and INDENT is the current indentation level." ;; (defcustom speedbar-select-frame-method 'attached "Specify how to select a frame for displaying a file. -A value of `attached' means to use the attached frame (the frame -that speedbar was started from.) A number such as 1 or -1 means to -pass that number to `other-frame' while selecting a frame from speedbar." +A number such as 1 or -1 means to pass that number to `other-frame' +while selecting a frame from speedbar. Any other value means to use +the attached frame (the frame that speedbar was started from)." :group 'speedbar - :type 'sexp) + :type '(choice integer (other :tag "attached" attached))) (defun speedbar-find-file-in-frame (file) "This will load FILE into the speedbar attached frame. diff --git a/lisp/tooltip.el b/lisp/tooltip.el index ce190e95829..60eabec8b43 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -127,7 +127,9 @@ position to pop up the tooltip. Note that font and color parameters are ignored, and the attributes of the `tooltip' face are used instead." - :type 'sexp + :type '(repeat (cons :format "%v" + (symbol :tag "Parameter") + (sexp :tag "Value"))) :group 'tooltip) (defface tooltip diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el index fd502dd1847..0ffb8dc96dc 100644 --- a/lisp/tree-widget.el +++ b/lisp/tree-widget.el @@ -208,9 +208,11 @@ icon widgets used to draw the tree. By default these images are used: (defcustom tree-widget-space-width 0.5 "Amount of space between an icon image and a node widget. -Must be a valid space :width display property." +Must be a valid space :width display property. +See Info node `(elisp)Specified Space'." :group 'tree-widget - :type 'sexp) + :type '(choice (number :tag "Multiple of normal character width") + sexp)) ;;; Image support ;; diff --git a/lisp/type-break.el b/lisp/type-break.el index ba708b2956c..0b3ee756619 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -133,7 +133,7 @@ keystroke even though they really require multiple keys to generate them. The command `type-break-guesstimate-keystroke-threshold' can be used to guess a reasonably good pair of values for this variable." :set-after '(type-break-interval) - :type 'sexp + :type '(cons (choice integer (const nil)) (choice integer (const nil))) :group 'type-break) (defcustom type-break-query-function 'yes-or-no-p diff --git a/lisp/woman.el b/lisp/woman.el index 4ca7dbee5de..28a47986c2f 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -752,7 +752,10 @@ Default is t." "Imenu support for Sections and Subsections. An alist with elements of the form (MENU-TITLE REGEXP INDEX) -- see the documentation for `imenu-generic-expression'." - :type 'sexp + :type '(alist :key-type (choice :tag "Title" (const nil) string) + :value-type (group (choice (string :tag "Regexp") + function) + integer)) :group 'woman-interface) (defcustom woman-imenu nil -- 2.39.2