Commit 775c916b authored by Chong Yidong's avatar Chong Yidong
Browse files

Remove non-option variable handling from customize-apropos

and enable use of word lists for customize-apropos-options etc.

* lisp/apropos.el (apropos-read-pattern): Make prompt less cryptic.

* lisp/cus-edit.el (customize-apropos, customize-apropos-options):
Disable matching of non-option variables.
(customize-option, customize-option-other-window)
(customize-changed-options): Doc fix.
(customize-apropos-options, customize-apropos-faces)
(customize-apropos-groups): Use apropos-read-pattern.

Fixes: debbugs:11176
parent 2df41f9c
......@@ -78,6 +78,10 @@ character when doing minibuffer filename prompts.
*** `custom-reset-button-menu' now defaults to t.
*** Non-option variables are never matched in `customize-apropos' and
`customize-apropos-options' (i.e. the prefix argument does nothing for
these commands now).
** erc will look up server/channel names via auth-source and use the
channel keys found, if any.
......
2012-04-23 Chong Yidong <cyd@gnu.org>
* cus-edit.el (customize-apropos, customize-apropos-options):
Disable matching of non-option variables (Bug#11176).
(customize-option, customize-option-other-window)
(customize-changed-options): Doc fix.
(customize-apropos-options, customize-apropos-faces)
(customize-apropos-groups): Use apropos-read-pattern (Bug#11124).
* apropos.el (apropos-read-pattern): Make prompt less cryptic.
2012-04-23 Michael Albinus <michael.albinus@gmx.de>
* net/xesam.el (xesam-mode-map): Use let-bound map in
......
......@@ -333,7 +333,7 @@ literally, or a string which is used as a regexp to search for.
SUBJECT is a string that is included in the prompt to identify what
kind of objects to search."
(let ((pattern
(read-string (concat "Apropos " subject " (word list or regexp): "))))
(read-string (concat "Search for " subject " (word list or regexp): "))))
(if (string-equal (regexp-quote pattern) pattern)
;; Split into words
(split-string pattern "[ \t]+")
......
......@@ -1131,7 +1131,7 @@ If OTHER-WINDOW is non-nil, display in another window."
;;;###autoload
(defun customize-option (symbol)
"Customize SYMBOL, which must be a user option variable."
"Customize SYMBOL, which must be a user option."
(interactive (custom-variable-prompt))
(unless symbol
(error "No variable specified"))
......@@ -1147,7 +1147,7 @@ If OTHER-WINDOW is non-nil, display in another window."
;;;###autoload
(defun customize-option-other-window (symbol)
"Customize SYMBOL, which must be a user option variable.
"Customize SYMBOL, which must be a user option.
Show the buffer in another window, but don't select it."
(interactive (custom-variable-prompt))
(unless symbol
......@@ -1201,9 +1201,10 @@ the official name of the package, such as MH-E or Gnus.")
;;;###autoload
(defun customize-changed-options (&optional since-version)
"Customize all settings whose meanings have changed in Emacs itself.
This includes new user option variables and faces, and new
customization groups, as well as older options and faces whose meanings
or default values have changed since the previous major Emacs release.
This includes new user options and faces, and new customization
groups, as well as older options and faces whose meanings or
default values have changed since the previous major Emacs
release.
With argument SINCE-VERSION (a string), customize all settings
that were added or redefined since that version."
......@@ -1411,7 +1412,7 @@ suggest to customize that face, if it's customizable."
;;;###autoload
(defun customize-apropos (pattern &optional type)
"Customize all loaded options, faces and groups matching PATTERN.
"Customize loaded options, faces and groups matching PATTERN.
PATTERN can be a word, a list of words (separated by spaces),
or a regexp (using some regexp special characters). If it is a word,
search for matches for that word as a substring. If it is a list of words,
......@@ -1419,62 +1420,50 @@ search for matches for any two (or more) of those words.
If TYPE is `options', include only options.
If TYPE is `faces', include only faces.
If TYPE is `groups', include only groups.
If TYPE is t (interactively, with prefix arg), include variables
that are not customizable options, as well as faces and groups
\(but we recommend using `apropos-variable' instead)."
(interactive (list (apropos-read-pattern "symbol") current-prefix-arg))
If TYPE is `groups', include only groups."
(interactive (list (apropos-read-pattern "symbol") nil))
(require 'apropos)
(unless (memq type '(nil options faces groups))
(error "Invalid setting type %s" (symbol-name type)))
(apropos-parse-pattern pattern)
(let (found)
(mapatoms
`(lambda (symbol)
(when (string-match apropos-regexp (symbol-name symbol))
,(if (not (memq type '(faces options)))
,(if (memq type '(nil groups))
'(if (get symbol 'custom-group)
(push (list symbol 'custom-group) found)))
,(if (not (memq type '(options groups)))
,(if (memq type '(nil faces))
'(if (custom-facep symbol)
(push (list symbol 'custom-face) found)))
,(if (not (memq type '(groups faces)))
,(if (memq type '(nil options))
`(if (and (boundp symbol)
(eq (indirect-variable symbol) symbol)
(or (get symbol 'saved-value)
(custom-variable-p symbol)
,(if (not (memq type '(nil options)))
'(get symbol 'variable-documentation))))
(custom-variable-p symbol)))
(push (list symbol 'custom-variable) found))))))
(if (not found)
(error "No %s matching %s"
(if (eq type t)
"items"
(format "customizable %s"
(if (memq type '(options faces groups))
(symbol-name type)
"items")))
pattern)
(custom-buffer-create
(custom-sort-items found t custom-buffer-order-groups)
"*Customize Apropos*"))))
(unless found
(error "No customizable %s matching %s" (symbol-name type) pattern))
(custom-buffer-create
(custom-sort-items found t custom-buffer-order-groups)
"*Customize Apropos*")))
;;;###autoload
(defun customize-apropos-options (regexp &optional arg)
"Customize all loaded customizable options matching REGEXP.
With prefix ARG, include variables that are not customizable options
\(but it is better to use `apropos-variable' if you want to find those)."
(interactive "sCustomize options (regexp): \nP")
(customize-apropos regexp (or arg 'options)))
(defun customize-apropos-options (regexp &optional ignored)
"Customize all loaded customizable options matching REGEXP."
(interactive (list (apropos-read-pattern "options")))
(customize-apropos regexp 'options))
;;;###autoload
(defun customize-apropos-faces (regexp)
"Customize all loaded faces matching REGEXP."
(interactive "sCustomize faces (regexp): \n")
(interactive (list (apropos-read-pattern "faces")))
(customize-apropos regexp 'faces))
;;;###autoload
(defun customize-apropos-groups (regexp)
"Customize all loaded groups matching REGEXP."
(interactive "sCustomize groups (regexp): \n")
(interactive (list (apropos-read-pattern "groups")))
(customize-apropos regexp 'groups))
;;; Buffer.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment