summaryrefslogtreecommitdiff
path: root/lisp/apropos.el
diff options
context:
space:
mode:
authorBoruch Baum <boruch_baum@gmx.com>2021-05-02 10:22:21 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-05-02 10:22:21 +0200
commiteda4888e54a278226c51a2491594e8703c105d21 (patch)
treed6f5041693c7b7880f1621dcd00c066ea8e57880 /lisp/apropos.el
parentf1adb6b77a948e4f2f3223940edb15e56c30466d (diff)
downloademacs-eda4888e54a278226c51a2491594e8703c105d21.tar.gz
emacs-eda4888e54a278226c51a2491594e8703c105d21.tar.bz2
emacs-eda4888e54a278226c51a2491594e8703c105d21.zip
Suppress false positives in apropos-value
* lisp/apropos.el (apropos-value): Skip more apropos-internal variables (bug#48063). (apropos-value-internal): Skip the first value in the history values, which always contains the match.
Diffstat (limited to 'lisp/apropos.el')
-rw-r--r--lisp/apropos.el65
1 files changed, 36 insertions, 29 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 86cdf233be6..823d6ec7f9d 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -809,34 +809,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-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)
@@ -928,7 +929,13 @@ Returns list of symbols and documentation found."
(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))
+ ;; The value we're looking for will always be in
+ ;; the first element of these two lists, so skip
+ ;; that value.
+ (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)