102 |
:group 'apropos |
:group 'apropos |
103 |
:type 'face) |
:type 'face) |
104 |
|
|
105 |
|
(defcustom apropos-show-scores nil |
106 |
|
"*Non-nil means show score for each match, and sort matches by scores." |
107 |
|
:group 'apropos |
108 |
|
:type 'boolean) |
109 |
|
|
110 |
(defvar apropos-mode-map |
(defvar apropos-mode-map |
111 |
(let ((map (make-sparse-keymap))) |
(let ((map (make-sparse-keymap))) |
123 |
(defvar apropos-mode-hook nil |
(defvar apropos-mode-hook nil |
124 |
"*Hook run when mode is turned on.") |
"*Hook run when mode is turned on.") |
125 |
|
|
|
(defvar apropos-show-scores nil |
|
|
"*Show apropos scores if non-nil.") |
|
|
|
|
126 |
(defvar apropos-regexp nil |
(defvar apropos-regexp nil |
127 |
"Regexp used in current apropos run.") |
"Regexp used in current apropos run.") |
128 |
|
|
469 |
(while p |
(while p |
470 |
(setcar p (list |
(setcar p (list |
471 |
(setq symbol (car p)) |
(setq symbol (car p)) |
472 |
0 |
(apropos-score-symbol symbol) |
473 |
(when (fboundp symbol) |
(when (fboundp symbol) |
474 |
(if (setq doc (condition-case nil |
(if (setq doc (condition-case nil |
475 |
(documentation symbol t) |
(documentation symbol t) |
767 |
(if (null apropos-accumulator) |
(if (null apropos-accumulator) |
768 |
(message "No apropos matches for `%s'" apropos-orig-regexp) |
(message "No apropos matches for `%s'" apropos-orig-regexp) |
769 |
(setq apropos-accumulator |
(setq apropos-accumulator |
770 |
(sort apropos-accumulator (lambda (a b) |
(sort apropos-accumulator |
771 |
(or (> (cadr a) (cadr b)) |
(lambda (a b) |
772 |
(and (= (cadr a) (cadr b)) |
;; Don't sort by score if user can't see the score. |
773 |
(string-lessp (car a) (car b))))))) |
;; It would be confusing. -- rms. |
774 |
|
(if apropos-show-scores |
775 |
|
(or (> (cadr a) (cadr b)) |
776 |
|
(and (= (cadr a) (cadr b)) |
777 |
|
(string-lessp (car a) (car b)))) |
778 |
|
(string-lessp (car a) (car b)))))) |
779 |
(with-output-to-temp-buffer "*Apropos*" |
(with-output-to-temp-buffer "*Apropos*" |
780 |
(let ((p apropos-accumulator) |
(let ((p apropos-accumulator) |
781 |
(old-buffer (current-buffer)) |
(old-buffer (current-buffer)) |