From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#31094: 25.2: Feature Reuqest: apropos-value: limit scope [CODE INCLUDED] Date: Sun, 8 Apr 2018 03:39:16 -0400 Message-ID: <20180408073916.d5lsceul3gpj34l3@E15-2016.optimum.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lyagqavzr2krievf" X-Trace: blaine.gmane.org 1523173097 3225 195.159.176.226 (8 Apr 2018 07:38:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Apr 2018 07:38:17 +0000 (UTC) User-Agent: NeoMutt/20180223 To: 31094@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 08 09:38:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f54ts-0000ev-Dv for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Apr 2018 09:38:09 +0200 Original-Received: from localhost ([::1]:32996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f54vw-0007I6-1n for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Apr 2018 03:40:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f54vm-0007Fx-0l for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:40:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f54vi-0005CJ-2E for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:40:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f54vh-0005CA-V9 for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f54vh-0000Ks-NP for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Apr 2018 07:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 31094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Emacs Bug Reporting Original-Received: via spool by submit@debbugs.gnu.org id=B.15231731781255 (code B ref -1); Sun, 08 Apr 2018 07:40:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Apr 2018 07:39:38 +0000 Original-Received: from localhost ([127.0.0.1]:41853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f54vH-0000K8-QZ for submit@debbugs.gnu.org; Sun, 08 Apr 2018 03:39:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f54vG-0000Jt-0F for submit@debbugs.gnu.org; Sun, 08 Apr 2018 03:39:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f54v8-0004z1-Jn for submit@debbugs.gnu.org; Sun, 08 Apr 2018 03:39:27 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:50818) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f54v8-0004yu-Gy for submit@debbugs.gnu.org; Sun, 08 Apr 2018 03:39:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f54v7-0006uT-5w for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:39:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f54v3-0004xf-6V for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:39:25 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:44843) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f54v2-0004xC-RN for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 03:39:21 -0400 Original-Received: from E15-2016.optimum.net ([108.6.168.221]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0Lcj9b-1efwdE0BlP-00kCAk for ; Sun, 08 Apr 2018 09:39:19 +0200 Content-Disposition: inline X-Provags-ID: V03:K1:4e1nrLnH0gPmfQrY8Ycn6F4YREUsWqVxRqT8yR5u4EE9zGTivZ+ jv704AKa3KngdcDWNbvB9UnN2VV8EWUd/xKsDxLQdzztoDc3UW7IUS4KMAGxj2fp/mJSex8 wABEpW1zF1YF2ztng+69DSIpzyWtphqOQ1vQGy9NBkigXot0WXHU4PTM0J4YTerMqjfQmP1 +Mf7WNJU+hRjOt1q/9iXg== X-UI-Out-Filterresults: notjunk:1;V01:K0:QUrfzgnGZM8=:reM2cAQLfEJ/OAswBf78W4 fx7XpBRiHfNLLn5i2eJx5RMh/0F4MOETaBD6tAwXC7OfVS1AvNNk+/VRYH8l8BmvpFySv2OJ+ 3tmQWIfpYbJ2VL1hv/rov0x+Y0euFb9ZAPEr2BEfrMdSVdhlwcR2UPuLyZSXcqx6YXzFaufvm Ir1fpQWKLja39hqmWliPq95hwxxGe8uiE0P62k/J11LYH+nuInDRORVMk2h4DRumEEU7MljIa Bh3ZP7fYgfeLedM/kyUacTfsqZ1Ak2pFJKYSEnwqcohWbDW23+lQYyymCThifGBsgw8JuNqSv CJbUXQM9xB8LQ2VXM/8Oy5Q/sC9aODdUT9pkw4HvDpF5pjmL8+QUCz7JwGhaWR8DGQUR7AS7y uqkE7lKtKTJo4SgqL7RZ0xgat/ZIbIDwk9tImOCdggyIHWIgj/p7kwyA9eXsivR0fZsIF8Uew o9BurCKNR5qEc1ku7k/yCfNHPk9PvPExjkUuasYPCNGDy39/wb5AYaj1fjXlh0Xke1C/9tR4h 9rN/LtxOov9rqbrnPdTtMWInzHWDVaAWaoROoNZf1A3RuJZXliiUYfjmms14Tj7K8QTF6tzU0 6RliyU/cD614SnSVbUMOi/+oLvkqvMM7h3lBblV0oZd3bpBqGTZ6HZvhnzjXorc36O49E/7H5 VAoQEZFDQK9kCNpdj8WuMpYJx49JsfJAdG9yueXS7dvImbpwidLitPexw6e1VmDRLc8MQeAk2 cqULtKFfFfsKlsI+jOvVIQHG7RFgVBF6+Uv1M/fkAFB66JHhhoR88IgmFM5z3tbn2MZBrOOt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:144981 Archived-At: --lyagqavzr2krievf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I've begun using function apropos-value, and find that its ouput is undesirably huge, because the feature prints out the entire value of each variable that contains a match. Some of this can be reduced when considegring that in most cases, I know in advance that a value will be present in some very commonly used huge variables, that won't be of use to me (eg. kill-ring, minibuffer-history).f A better solution would be an option to initially print only the names of symbol that contain a match. The user can then easily view any value of interest, because the output buffer already includes a feature that pressing return on any symbol in the output list will display the documentation for the symbol, which will include the variable's value. Attached was my first thought at a solution, using an exclude list to exclude certain variables from a search. As I said, upon further consideration, I decided it would be better to abbreviate the output buffer to just a list of symbol names, but I came to that conclusion after writing the snippet. -- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 --lyagqavzr2krievf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="apropos-value.el" (defcustom apropos-value-exclude-list '(kill-ring values minibuffer-history buffer-name-history command-history ivy--all-candidates) "List of variable names to be excluded from `apropos-value' searches." :type '(repeat variable)) (defun my-apropos-value (pattern &optional do-all) "Allow `apropos-value' to limit scope of its searches. With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also looks at function definitions (arguments, documentation and body) and at the names and values of properties. With two \\[universal-argument] prefixes, excludes the variables listed in `apropos-value-exclude-list' from its search. With three \\[universal-argument] prefixes, performs a search only on the variables listed in `apropos-value-exclude-list'. See also variable `apropos-value-limited-print'." (interactive (list (apropos-read-pattern "value") current-prefix-arg)) (apropos-parse-pattern pattern) (or do-all (when apropos-do-all (setq do-all '(4)))) (setq apropos-accumulator ()) (let (f v p) (if (equal do-all '(64)) ; C-u C-u C-u (dolist (symbol apropos-value-exclude-list) (when (setq v (apropos-value-internal 'boundp symbol 'symbol-value)) (setq apropos-accumulator (cons (list symbol (apropos-score-str v) nil v nil) apropos-accumulator)))) (mapatoms (lambda (symbol) (setq f nil v nil p nil) (or (memq symbol '(apropos-regexp apropos-pattern apropos-all-words-regexp apropos-words apropos-all-words do-all apropos-accumulator apropos-value-exclude-list symbol f v p)) (and (equal do-all '(16)) ; C-u C-u (memq symbol apropos-value-exclude-list)) (setq v (apropos-value-internal 'boundp symbol 'symbol-value))) (when (equal do-all '(4)) ; C-u (setq f (apropos-value-internal 'fboundp symbol 'symbol-function) p (apropos-format-plist symbol "\n " t))) (if (apropos-false-hit-str v) (setq v nil)) (if (apropos-false-hit-str f) (setq f nil)) (if (apropos-false-hit-str p) (setq p nil)) (if (or f v p) (setq apropos-accumulator (cons (list symbol (+ (apropos-score-str f) (apropos-score-str v) (apropos-score-str p)) f v p) apropos-accumulator))))))) (let ((apropos-multi-type (if (equal do-all '(4)) t nil))) (apropos-print nil "\n----------------\n"))) --lyagqavzr2krievf--