From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Newsgroups: gmane.emacs.bugs Subject: bug#13276: 24.2.50; apropos-variable Date: Sat, 05 Jan 2013 11:25:51 +0100 Message-ID: <87pq1kc4eo.fsf@bzg.ath.cx> References: <87ehi1wfhj.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1357381619 1488 80.91.229.3 (5 Jan 2013 10:26:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Jan 2013 10:26:59 +0000 (UTC) Cc: 13276@debbugs.gnu.org, rms@gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 05 11:27:14 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TrQy8-000660-4C for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Jan 2013 11:27:12 +0100 Original-Received: from localhost ([::1]:42117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrQxs-0005Ow-QF for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Jan 2013 05:26:56 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrQxo-0005OY-2d for bug-gnu-emacs@gnu.org; Sat, 05 Jan 2013 05:26:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrQxm-0000k8-Tb for bug-gnu-emacs@gnu.org; Sat, 05 Jan 2013 05:26:52 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrQxm-0000k2-QF for bug-gnu-emacs@gnu.org; Sat, 05 Jan 2013 05:26:50 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TrQxy-0001xK-7b for bug-gnu-emacs@gnu.org; Sat, 05 Jan 2013 05:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bastien Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jan 2013 10:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13276 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 13276-submit@debbugs.gnu.org id=B13276.13573815707502 (code B ref 13276); Sat, 05 Jan 2013 10:27:02 +0000 Original-Received: (at 13276) by debbugs.gnu.org; 5 Jan 2013 10:26:10 +0000 Original-Received: from localhost ([127.0.0.1]:44326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrQx7-0001wx-GQ for submit@debbugs.gnu.org; Sat, 05 Jan 2013 05:26:09 -0500 Original-Received: from mail-wg0-f42.google.com ([74.125.82.42]:45410) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrQx4-0001ws-NJ for 13276@debbugs.gnu.org; Sat, 05 Jan 2013 05:26:08 -0500 Original-Received: by mail-wg0-f42.google.com with SMTP id dr1so741266wgb.3 for <13276@debbugs.gnu.org>; Sat, 05 Jan 2013 02:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=3XD3NNbCA6Qq0ajvNj9c7MOKR3gb63s4nT0Y0kwKOhk=; b=nn8USg7Qkjd/eNl87pBFWFcR3MNN8e5MVp0sQcTdiH06Lvi2/05o57z1tqSHIub2IK w+EGkLAbAERYhstICtHBHl/Ch+rHXzDOCblpkYs70+FIb6BRzwfO6F1xVvcyf8Zc1ERk WBxmTMH1BhgHST4rHfFiAylvc3R5D6ZpoYYt2mxOemPexuS+o0VMrGZZiAFOT2pdiK1f e1DorIY4+rMCL03ikGKoS2o0EsK9LFDDMm5Iq/om1sYQ7ouWC1fr0v3+E0AWnhplwC2W sq+gJEJFvo9BETQrz8cmvYWjNaWQeXk26D4wtoUEL3BjfRJ7/C409iRA+NRM7t11XMGW l1/Q== X-Received: by 10.180.95.228 with SMTP id dn4mr1589954wib.16.1357381552815; Sat, 05 Jan 2013 02:25:52 -0800 (PST) Original-Received: from bzg.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPS id df2sm2636420wib.0.2013.01.05.02.25.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 05 Jan 2013 02:25:51 -0800 (PST) Original-Received: by bzg.localdomain (Postfix, from userid 1000) id A17AB1C205CE; Sat, 5 Jan 2013 11:25:51 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Fri, 04 Jan 2013 12:52:42 -0500") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69407 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=apropos.el.patch === 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) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--