diff options
Diffstat (limited to 'lisp/help-fns.el')
| -rw-r--r-- | lisp/help-fns.el | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 0b0ae4364c8..4d625879de8 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -126,38 +126,40 @@ with the current prefix. The files are chosen according to | |||
| 126 | :group 'help | 126 | :group 'help |
| 127 | :version "26.3") | 127 | :version "26.3") |
| 128 | 128 | ||
| 129 | (defun help--symbol-completion-table-affixation (completions) | 129 | (defun help--symbol-completion-table-annotation (completion) |
| 130 | (mapcar (lambda (c) | 130 | (let* ((s (intern completion)) |
| 131 | (let* ((s (intern c)) | 131 | (doc (ignore-errors (documentation s))) |
| 132 | (doc (condition-case nil (documentation s) (error nil))) | 132 | (doc (and doc (substring doc 0 (string-match "\n" doc)))) |
| 133 | (doc (and doc (substring doc 0 (string-match "\n" doc))))) | 133 | (annotation (and doc |
| 134 | (list c (propertize | 134 | (propertize (format " -- %s" doc) |
| 135 | (concat (cond ((commandp s) | 135 | 'face 'completions-annotations)))) |
| 136 | "c") ; command | 136 | (when annotation |
| 137 | ((eq (car-safe (symbol-function s)) 'macro) | 137 | (propertize |
| 138 | "m") ; macro | 138 | annotation |
| 139 | ((fboundp s) | 139 | 'prefix (propertize |
| 140 | "f") ; function | 140 | (concat (cond ((commandp s) |
| 141 | ((custom-variable-p s) | 141 | "c") ; command |
| 142 | "u") ; user option | 142 | ((eq (car-safe (symbol-function s)) 'macro) |
| 143 | ((boundp s) | 143 | "m") ; macro |
| 144 | "v") ; variable | 144 | ((fboundp s) |
| 145 | ((facep s) | 145 | "f") ; function |
| 146 | "a") ; fAce | 146 | ((custom-variable-p s) |
| 147 | ((and (fboundp 'cl-find-class) | 147 | "u") ; user option |
| 148 | (cl-find-class s)) | 148 | ((boundp s) |
| 149 | "t") ; CL type | 149 | "v") ; variable |
| 150 | (" ")) ; something else | 150 | ((facep s) |
| 151 | " ") ; prefix separator | 151 | "a") ; fAce |
| 152 | 'face 'completions-annotations) | 152 | ((and (fboundp 'cl-find-class) |
| 153 | (if doc (propertize (format " -- %s" doc) | 153 | (cl-find-class s)) |
| 154 | 'face 'completions-annotations) | 154 | "t") ; CL type |
| 155 | "")))) | 155 | (" ")) ; something else |
| 156 | completions)) | 156 | " ") ; prefix separator |
| 157 | 'face 'completions-annotations) | ||
| 158 | 'suffix annotation)))) | ||
| 157 | 159 | ||
| 158 | (defun help--symbol-completion-table (string pred action) | 160 | (defun help--symbol-completion-table (string pred action) |
| 159 | (if (and completions-detailed (eq action 'metadata)) | 161 | (if (and completions-detailed (eq action 'metadata)) |
| 160 | '(metadata (affixation-function . help--symbol-completion-table-affixation)) | 162 | '(metadata (annotation-function . help--symbol-completion-table-annotation)) |
| 161 | (when help-enable-completion-autoload | 163 | (when help-enable-completion-autoload |
| 162 | (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) | 164 | (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) |
| 163 | (help--load-prefixes prefixes))) | 165 | (help--load-prefixes prefixes))) |