diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-04-19 20:43:41 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-04-19 20:43:41 -0400 |
commit | cd56490fef9cf585708b9d11de2f3f2ec1e2d5b2 (patch) | |
tree | 037cf92e29bb68b3b4669eb0a43a06e101adb846 /lisp/info.el | |
parent | 992e2019d3c535a61df064de25f664c01b8c309f (diff) | |
download | emacs-cd56490fef9cf585708b9d11de2f3f2ec1e2d5b2.tar.gz |
Use substring completion for Info menus and index
* lisp/info.el (Info-complete-menu-item): Add `category' metadata.
(Info-menu): Simplify now that we use the `default' arg of completing-read.
* lisp/minibuffer.el (completion-category-defaults): Use substring
completion for `info-menu`.
Diffstat (limited to 'lisp/info.el')
-rw-r--r-- | lisp/info.el | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lisp/info.el b/lisp/info.el index 92e7c24ab1d..a2071533d8f 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1869,7 +1869,7 @@ a node in FILENAME. \"(FILENAME)\" is a short format to go to the Top node in FILENAME." (let* ((completion-ignore-case t) (Info-read-node-completion-table (Info-build-node-completions)) - (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) + (nodename (completing-read prompt #'Info-read-node-name-1 nil t))) (if (equal nodename "") (Info-read-node-name prompt) nodename))) @@ -2583,7 +2583,8 @@ new buffer." "Follow reference named: ") completions nil t))) (list (if (equal input "") - default input) current-prefix-arg)) + default input) + current-prefix-arg)) (user-error "No cross-references in this node")))) (unless footnotename @@ -2703,6 +2704,7 @@ Because of ambiguities, this should be concatenated with something like (user-error "No menu in this node")) (cond ((eq (car-safe action) 'boundaries) nil) + ((eq action 'metadata) `(metadata (category . info-menu))) ((eq action 'lambda) (re-search-forward (concat "\n\\* +" (regexp-quote string) ":") nil t)) @@ -2783,15 +2785,7 @@ new buffer." default) "Menu item: ") #'Info-complete-menu-item nil t nil nil - default))) - ;; we rely on the fact that completing-read accepts an input - ;; of "" even when the require-match argument is true and "" - ;; is not a valid possibility - (if (string= item "") - (if default - (setq item default) - ;; ask again - (setq item nil)))) + default)))) (list item current-prefix-arg)))) ;; there is a problem here in that if several menu items have the same ;; name you can only go to the node of the first with this command. @@ -3308,7 +3302,7 @@ Give an empty topic name to go to the Index node itself." (unwind-protect (with-current-buffer Info-complete-menu-buffer (Info-goto-index) - (completing-read "Index topic: " 'Info-complete-menu-item)) + (completing-read "Index topic: " #'Info-complete-menu-item)) (kill-buffer Info-complete-menu-buffer))))) (if (equal Info-current-file "dir") (error "The Info directory node has no index; use m to select a manual")) @@ -3482,7 +3476,7 @@ search results." (unwind-protect (with-current-buffer Info-complete-menu-buffer (Info-goto-index) - (completing-read "Index topic: " 'Info-complete-menu-item)) + (completing-read "Index topic: " #'Info-complete-menu-item)) (kill-buffer Info-complete-menu-buffer))))) (if (equal topic "") (Info-find-node Info-current-file "*Index*") |