summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2003-07-12 21:57:50 +0000
committerRichard M. Stallman <rms@gnu.org>2003-07-12 21:57:50 +0000
commit30aab7419ba8a9a51a3a20d51cf1a2f314f650c7 (patch)
tree8e9d19491eb34d39ca89272d7197b2a0101331c8 /lisp
parent20853e2fea62d9e71bcb4a32a8218a54d934f5e0 (diff)
downloademacs-30aab7419ba8a9a51a3a20d51cf1a2f314f650c7.tar.gz
emacs-30aab7419ba8a9a51a3a20d51cf1a2f314f650c7.tar.bz2
emacs-30aab7419ba8a9a51a3a20d51cf1a2f314f650c7.zip
(apropos-show-scores): Make it customizable. Document new meaning.
(apropos): Compute scores from symbols. (apropos-print): Don't sort by scores if apropos-show-scores is nil.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/apropos.el22
1 files changed, 14 insertions, 8 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index f5305f3b290..3bcaeafdcaa 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -102,6 +102,10 @@ for the regexp; the part that matches gets displayed in this font."
:group 'apropos
:type 'face)
+(defcustom apropos-show-scores nil
+ "*Non-nil means show score for each match, and sort matches by scores."
+ :group 'apropos
+ :type 'boolean)
(defvar apropos-mode-map
(let ((map (make-sparse-keymap)))
@@ -119,9 +123,6 @@ for the regexp; the part that matches gets displayed in this font."
(defvar apropos-mode-hook nil
"*Hook run when mode is turned on.")
-(defvar apropos-show-scores nil
- "*Show apropos scores if non-nil.")
-
(defvar apropos-regexp nil
"Regexp used in current apropos run.")
@@ -468,7 +469,7 @@ time-consuming. Returns list of symbols and documentation found."
(while p
(setcar p (list
(setq symbol (car p))
- 0
+ (apropos-score-symbol symbol)
(when (fboundp symbol)
(if (setq doc (condition-case nil
(documentation symbol t)
@@ -766,10 +767,15 @@ separate items with that string."
(if (null apropos-accumulator)
(message "No apropos matches for `%s'" apropos-orig-regexp)
(setq apropos-accumulator
- (sort apropos-accumulator (lambda (a b)
- (or (> (cadr a) (cadr b))
- (and (= (cadr a) (cadr b))
- (string-lessp (car a) (car b)))))))
+ (sort apropos-accumulator
+ (lambda (a b)
+ ;; Don't sort by score if user can't see the score.
+ ;; It would be confusing. -- rms.
+ (if apropos-show-scores
+ (or (> (cadr a) (cadr b))
+ (and (= (cadr a) (cadr b))
+ (string-lessp (car a) (car b))))
+ (string-lessp (car a) (car b))))))
(with-output-to-temp-buffer "*Apropos*"
(let ((p apropos-accumulator)
(old-buffer (current-buffer))