# HG changeset patch # User Richard M. Stallman # Date 1058047070 0 # Node ID 58bf3c3670d8a5e1982e725b3c9285fd2fef7c1a # Parent 0eb7f2196a0c270be26d39202b08b4b0620f131b (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. diff -r 0eb7f2196a0c -r 58bf3c3670d8 lisp/apropos.el --- a/lisp/apropos.el Sat Jul 12 21:55:24 2003 +0000 +++ b/lisp/apropos.el Sat Jul 12 21:57:50 2003 +0000 @@ -102,6 +102,10 @@ :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 @@ (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 @@ (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 @@ (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))