From: Boruch Baum <boruch_baum@gmx.com>
To: 48063@debbugs.gnu.org
Subject: bug#48063: 28.0.50: apropos-value{, -internal}: suppress false positives
Date: Tue, 27 Apr 2021 11:17:27 -0400 [thread overview]
Message-ID: <20210427151727.5x4vzmveyh6ogfv4@E15-2016.optimum.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
Function apropos-value will always return false positive, some of which
entail printing out very long variable value strings. The attached patch
apropos-value.patch fixes those cases. The second patch just changes
what seems to be an indentation bug in the function.
The cases of false positives are:
+ variables reflecting the apropos request itself
+ (car minibuffer-history)
+ (car command-history)
+ variables internal to apropos:
+ apropos--current
+ apropos-pattern-quoted
+ pattern
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
[-- Attachment #2: apropos-value.patch --]
[-- Type: text/x-diff, Size: 1022 bytes --]
diff --git a/apropos.el b/apropos.el
index 6d8c784..44c87ee 100644
--- a/apropos.el
+++ b/apropos.el
@@ -817,6 +817,7 @@ Returns list of symbols and values found."
(lambda (symbol)
(setq f nil v nil p nil)
(or (memq symbol '(apropos-regexp
+ apropos--current apropos-pattern-quoted pattern
apropos-pattern apropos-all-words-regexp
apropos-words apropos-all-words
do-all apropos-accumulator
@@ -933,7 +934,10 @@ Returns list of symbols and documentation found."
\f
(defun apropos-value-internal (predicate symbol function)
(when (funcall predicate symbol)
- (setq symbol (prin1-to-string (funcall function symbol)))
+ (setq symbol (prin1-to-string
+ (if (memq symbol '(command-history minibuffer-history))
+ (cdr (funcall function symbol))
+ (funcall function symbol))))
(when (string-match apropos-regexp symbol)
(if apropos-match-face
(put-text-property (match-beginning 0) (match-end 0)
[-- Attachment #3: apropos-value-indent-change.patch --]
[-- Type: text/x-diff, Size: 2579 bytes --]
diff --git a/apropos.el b/apropos.el
index 44c87ee..9529271 100644
--- a/apropos.el
+++ b/apropos.el
@@ -812,35 +812,35 @@ Returns list of symbols and values found."
(apropos-parse-pattern pattern t)
(or do-all (setq do-all apropos-do-all))
(setq apropos-accumulator ())
- (let (f v p)
- (mapatoms
- (lambda (symbol)
- (setq f nil v nil p nil)
- (or (memq symbol '(apropos-regexp
- apropos--current apropos-pattern-quoted pattern
- apropos-pattern apropos-all-words-regexp
- apropos-words apropos-all-words
- do-all apropos-accumulator
- symbol f v p))
- (setq v (apropos-value-internal 'boundp symbol 'symbol-value)))
- (if do-all
- (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 do-all))
- (apropos-print nil "\n----------------\n")))
+ (let (f v p)
+ (mapatoms
+ (lambda (symbol)
+ (setq f nil v nil p nil)
+ (or (memq symbol '(apropos-regexp
+ apropos--current apropos-pattern-quoted pattern
+ apropos-pattern apropos-all-words-regexp
+ apropos-words apropos-all-words
+ do-all apropos-accumulator
+ symbol f v p))
+ (setq v (apropos-value-internal 'boundp symbol 'symbol-value)))
+ (if do-all
+ (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 do-all))
+ (apropos-print nil "\n----------------\n")))
;;;###autoload
(defun apropos-local-value (pattern &optional buffer)
next reply other threads:[~2021-04-27 15:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 15:17 Boruch Baum [this message]
2021-05-02 8:23 ` bug#48063: 28.0.50: apropos-value{, -internal}: suppress false positives Lars Ingebrigtsen
2021-05-02 12:22 ` Boruch Baum
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210427151727.5x4vzmveyh6ogfv4@E15-2016.optimum.net \
--to=boruch_baum@gmx.com \
--cc=48063@debbugs.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.