]> git.eshelyaron.com Git - emacs.git/commitdiff
Use substring completion for Info menus and index
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 20 Apr 2017 00:43:41 +0000 (20:43 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 20 Apr 2017 00:43:41 +0000 (20:43 -0400)
* 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`.

etc/NEWS
lisp/info.el
lisp/minibuffer.el

index 76c9dbc33155989445a7778d6b08b6cc1914510e..72818278781637b7bf2db1f67454751acd5909cf 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -386,6 +386,10 @@ end of the word).
 \f
 * Changes in Specialized Modes and Packages in Emacs 26.1
 
+*** Info menu and index completion uses substring completion by default.
+This can be customized via the `info-menu` category in
+completion-category-override.
+
 +++
 *** The ancestor buffer is shown by default in 3way merges.
 A new option ediff-show-ancestor and a new toggle
index 92e7c24ab1d353ea6b593f973f40e9d5f9ca94d0..a2071533d8f0b21dd9e5d2a92633c8d1d25c226d 100644 (file)
@@ -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*")
index 00722ec4b15a078d3d99f1e1dc4cc848b84fd5f4..0377cd549a2864dcf04d13573abb09fe956c6b48 100644 (file)
@@ -834,7 +834,8 @@ styles for specific categories, such as files, buffers, etc."
 (defvar completion-category-defaults
   '((buffer (styles . (basic substring)))
     (unicode-name (styles . (basic substring)))
-    (project-file (styles . (basic substring))))
+    (project-file (styles . (basic substring)))
+    (info-menu (styles . (basic substring))))
   "Default settings for specific completion categories.
 Each entry has the shape (CATEGORY . ALIST) where ALIST is
 an association list that can specify properties such as: