summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2021-10-06 11:30:29 +0100
committerJoão Távora <joaotavora@gmail.com>2021-10-06 11:42:48 +0100
commitf9f64c4b3287d7276c8edeacdecfa9c78194447b (patch)
tree1f4a4e75012288e48f2bb54fb274d3faff99c838 /lisp/help-fns.el
parentd3a832a61ab5766b6ec879cee9ab75bbbc62034a (diff)
downloademacs-scratch/bug-50959-fix.tar.gz
Complete shorthands to longhands for symbol-completing tablesscratch/bug-50959-fix
Shorthands aren't symbols, they're text forms that 'read' into symbols. As such, shorthands aren't candidates in these tables of symbols. But in some situations, if no other candidates match the pattern, we can e.g. complete "x-foo" to "xavier-foo" if the shorthand (("x-" . "xavier-")) is set up in the buffer of origin. bug#50959 * lisp/help-fns.el (help--symbol-completion-table): Report `symbol-help' category. * lisp/minibuffer.el (completion-styles-alist): New 'shorthand' style. (completion-category-defaults): Link 'symbol-help' category with 'shorthand' style. (minibuffer--original-buffer): New variable. (completing-read-default): Setup minibuffer--original-buffer. (completion-shorthand-try-completion) (completion-shorthand-all-completions): New helpers.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 6be5cd4a501..03bbc979a9c 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -176,8 +176,11 @@ with the current prefix. The files are chosen according to
completions))
(defun help--symbol-completion-table (string pred action)
- (if (and completions-detailed (eq action 'metadata))
- '(metadata (affixation-function . help--symbol-completion-table-affixation))
+ (if (eq action 'metadata)
+ `(metadata
+ ,@(when completions-detailed
+ '((affixation-function . help--symbol-completion-table-affixation)))
+ (category . symbol-help))
(when help-enable-completion-autoload
(let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
(help--load-prefixes prefixes)))