unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 13276@debbugs.gnu.org, rms@gnu.org
Subject: bug#13276: 24.2.50; apropos-variable
Date: Sat, 05 Jan 2013 11:25:51 +0100	[thread overview]
Message-ID: <87pq1kc4eo.fsf@bzg.ath.cx> (raw)
In-Reply-To: <jwv7gnshm3p.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 04 Jan 2013 12:52:42 -0500")

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: apropos.el.patch --]
[-- Type: text/x-patch, Size: 3373 bytes --]

=== 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)


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  parent reply	other threads:[~2013-01-05 10:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-25  5:35 bug#13276: 24.2.50; apropos-variable Richard Stallman
2012-12-26 11:10 ` Bastien
2012-12-26 16:56   ` Drew Adams
2013-01-04  1:40 ` Glenn Morris
2013-01-04  7:54   ` Bastien
2013-01-04 17:52     ` Stefan Monnier
2013-01-04 19:03       ` Drew Adams
2013-01-05 10:25       ` Bastien [this message]
2013-01-05 17:52         ` Drew Adams
2013-01-05 19:11         ` Glenn Morris
2013-01-07 22:04           ` Bastien
2013-01-08  4:31             ` Glenn Morris
2013-01-08  7:15               ` Bastien
2013-01-05 23:40         ` Stefan Monnier
2013-01-07 22:04           ` Bastien
2013-01-08 14:11           ` Drew Adams
2013-01-08 14:33             ` Bastien
2013-01-08 14:38               ` Drew Adams
2013-01-08 15:48                 ` Drew Adams
2013-01-08 16:05                   ` Bastien
2013-01-08 16:56                     ` Drew Adams
2013-01-08 17:53                       ` Bastien
     [not found]                       ` <<87fw2bh881.fsf@bzg.ath.cx>
2014-04-21 18:35                         ` Drew Adams
2014-04-22  9:31                           ` Bastien
2013-01-04 20:00     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pq1kc4eo.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=13276@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).