[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13276: 24.2.50; apropos-variable
From: |
Bastien |
Subject: |
bug#13276: 24.2.50; apropos-variable |
Date: |
Sat, 05 Jan 2013 11:25:51 +0100 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I suggest renaming `apropos-variable' to `apropos-option' and to
>> use `apropos-variable' for
>
> That sounds right.
The attached patch does this.
It renames `apropos-variable' to `apropos-option' and define a new
`apropos-variable' command. C-u M-x apropos-variable RET shows only
user options, and C-u M-x apropos-option RET shows all variables.
The patch also introduces a new button for user options so that
users can immediately see which variables are options in the apropos
buffer.
Let me know if I can apply this to the trunk.
=== modified file 'lisp/apropos.el'
--- lisp/apropos.el 2013-01-01 09:11:05 +0000
+++ lisp/apropos.el 2013-01-05 10:22:10 +0000
@@ -69,7 +69,7 @@
"Non nil means apropos commands will search more extensively.
This may be slower. This option affects the following commands:
-`apropos-variable' will search all variables, not just user variables.
+`apropos-option' will search all variables, not just user options.
`apropos-command' will also search non-interactive functions.
`apropos' will search all symbols, not just functions, variables, faces,
and those with property lists.
@@ -115,6 +115,12 @@
:group 'apropos
:version "24.3")
+(defface apropos-option-button
+ '((t (:inherit (font-lock-variable-name-face button))))
+ "Button face indicating a user option in Apropos."
+ :group 'apropos
+ :version "24.3")
+
(defface apropos-misc-button
'((t (:inherit (font-lock-constant-face button))))
"Button face indicating a miscellaneous object type in Apropos."
@@ -261,6 +267,15 @@
'action (lambda (button)
(describe-variable (button-get button 'apropos-symbol))))
+(define-button-type 'apropos-option
+ 'apropos-label "User option"
+ 'apropos-short-label "o"
+ 'face 'apropos-option-button
+ 'help-echo "mouse-2, RET: Display more help on this user option"
+ 'follow-link t
+ 'action (lambda (button)
+ (describe-variable (button-get button 'apropos-symbol))))
+
(define-button-type 'apropos-face
'apropos-label "Face"
'apropos-short-label "F"
@@ -461,15 +476,15 @@
This is used to decide whether to print the result's type or not.")
;;;###autoload
-(defun apropos-variable (pattern &optional do-all)
- "Show user variables that match PATTERN.
+(defun apropos-option (pattern &optional do-all)
+ "Show user options that match 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,
search for matches for any two (or more) of those words.
With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also
show
-normal variables."
+variables, not just user options."
(interactive (list (apropos-read-pattern
(if (or current-prefix-arg apropos-do-all)
"variable" "user option"))
@@ -481,6 +496,17 @@
(get symbol 'variable-documentation)))
'custom-variable-p)))
+;;;###autoload
+(defun apropos-variable (pattern &optional do-not-all)
+ "Show variables that match PATTERN.
+When DO-NOT-ALL is not-nil, show user options only, i.e. behave
+like `apropos-option'."
+ (interactive (list (apropos-read-pattern
+ (if current-prefix-arg "user option" "variable"))
+ current-prefix-arg))
+ (let ((apropos-do-all (if do-not-all nil t)))
+ (apropos-option pattern)))
+
;; For auld lang syne:
;;;###autoload
(defalias 'command-apropos 'apropos-command)
@@ -1099,7 +1125,11 @@
'apropos-macro
'apropos-function))
(not nosubst))
- (apropos-print-doc 3 'apropos-variable (not nosubst))
+ (apropos-print-doc 3
+ (if (custom-variable-p symbol)
+ 'apropos-option
+ 'apropos-variable)
+ (not nosubst))
(apropos-print-doc 7 'apropos-group t)
(apropos-print-doc 6 'apropos-face t)
(apropos-print-doc 5 'apropos-widget t)
--
Bastien
- bug#13276: 24.2.50; apropos-variable, Glenn Morris, 2013/01/03
- bug#13276: 24.2.50; apropos-variable, Bastien, 2013/01/04
- bug#13276: 24.2.50; apropos-variable, Stefan Monnier, 2013/01/04
- bug#13276: 24.2.50; apropos-variable, Drew Adams, 2013/01/04
- bug#13276: 24.2.50; apropos-variable,
Bastien <=
- bug#13276: 24.2.50; apropos-variable, Drew Adams, 2013/01/05
- bug#13276: 24.2.50; apropos-variable, Glenn Morris, 2013/01/05
- bug#13276: 24.2.50; apropos-variable, Bastien, 2013/01/07
- bug#13276: 24.2.50; apropos-variable, Glenn Morris, 2013/01/07
- bug#13276: 24.2.50; apropos-variable, Bastien, 2013/01/08
- bug#13276: 24.2.50; apropos-variable, Stefan Monnier, 2013/01/05
- bug#13276: 24.2.50; apropos-variable, Bastien, 2013/01/07
- bug#13276: 24.2.50; apropos-variable, Drew Adams, 2013/01/08
- bug#13276: 24.2.50; apropos-variable, Bastien, 2013/01/08
- bug#13276: 24.2.50; apropos-variable, Drew Adams, 2013/01/08