]> git.eshelyaron.com Git - emacs.git/commitdiff
Small fixes for the new feature 'second-tab' of 'completion-auto-select'
authorJuri Linkov <juri@linkov.net>
Thu, 24 Mar 2022 17:54:14 +0000 (19:54 +0200)
committerJuri Linkov <juri@linkov.net>
Thu, 24 Mar 2022 17:54:14 +0000 (19:54 +0200)
* lisp/simple.el (completion-auto-select): Extend the docstring.

doc/emacs/mini.texi
etc/NEWS
lisp/minibuffer.el
lisp/simple.el

index 181cade80b31ae3b43c9d1752e98d875d6215a76..dd78262aeb88d04bdbf73d0d3db158226be6dab7 100644 (file)
@@ -643,12 +643,12 @@ completion list buffer, and like @code{always} when it decides whether
 to pop it down.
 
 @vindex completion-auto-select
-The completions window can be automatically selected.  To enable this
-behavior, customize the user option @code{completion-auto-select} to
-@code{t} and pressing @key{TAB} will switch to the completion list
+  The completions window can be automatically selected.  To enable
+this behavior, customize the user option @code{completion-auto-select}
+to @code{t} and pressing @key{TAB} will switch to the completion list
 buffer when it pops up that buffer.  If the value is
-@code{second-tab}, then the first @key{TAB} will pops up the
-completions list buffer and the second one will switch to it.
+@code{second-tab}, then the first @key{TAB} will pop up the
+completions list buffer, and the second one will switch to it.
 
 @vindex completion-cycle-threshold
   If @code{completion-cycle-threshold} is non-@code{nil}, completion
index 9633a1ff6f696835ab0affd4606221d14de79095..d26c6568b9b7b65870a8aa4e6481306a45b0c9a4 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -585,11 +585,12 @@ value.
 
 ** Minibuffer and Completions
 
++++
 *** The "*Completions*" buffer can now be automatically selected.
 To enable this behavior, customize the user option
-'completion-auto-select' to t and pressing 'TAB' will switch to the
-"*Completions*" buffer when it pops up that buffer. If the value is
-'second-tab', then the first tab will display "*Completions*" and the
+'completion-auto-select' to t, then pressing 'TAB' will switch to the
+"*Completions*" buffer when it pops up that buffer.  If the value is
+'second-tab', then the first tab will display "*Completions*", and the
 second one will switch to the "*Completions*" buffer.
 
 *** New user option 'completion-wrap-movement'.
index 742d39f2d29af88eca37a02e2c8a62ed9da135e7..d8df1799c938050b5dc04ba65662074f0acda54f 100644 (file)
@@ -1413,20 +1413,20 @@ scroll the window of possible completions."
     (let ((window minibuffer-scroll-window))
       (with-current-buffer (window-buffer window)
         (cond
-         ;; here this is possible only when second-tab, so jump now.
+         ;; Here this is possible only when second-tab, so jump now.
          (completion-auto-select
           (switch-to-completions))
-         ;; reverse tab
+         ;; Reverse tab
          ((equal (this-command-keys) [backtab])
           (if (pos-visible-in-window-p (point-min) window)
-              ;; If beginning is in view, scroll up to the end
+              ;; If beginning is in view, scroll up to the end.
               (set-window-point window (point-max))
             ;; Else scroll down one screen.
             (with-selected-window window (scroll-down))))
-         ;; normal tab
+         ;; Normal tab
          (t
           (if (pos-visible-in-window-p (point-max) window)
-              ;; If end is in view, scroll up to the end
+              ;; If end is in view, scroll up to the end.
               (set-window-start window (point-min) nil)
             ;; Else scroll down one screen.
             (with-selected-window window (scroll-up)))))
index f22960869082c6ac08cb52eeae31c70989c357d9..6dd8d141ae128f539c2533abb8cd169f5265336c 100644 (file)
@@ -9145,9 +9145,13 @@ This affects the commands `next-completion' and
   :group 'completion)
 
 (defcustom completion-auto-select nil
-  "Non-nil means to automatically select the *Completions* buffer."
-  :type '(choice (const :tag "Select window" t)
-                 (const :tag "Disabled" nil)
+  "Non-nil means to automatically select the *Completions* buffer.
+When the value is t, then pressing TAB will switch to the completion list
+buffer when it pops up that buffer.  If the value is `second-tab', then the
+first TAB will pop up the completions list buffer, and the second one will
+switch to it."
+  :type '(choice (const :tag "Disabled" nil)
+                 (const :tag "Select window on first tab" t)
                  (const :tag "Select window on second-tab" second-tab))
   :version "29.1"
   :group 'completion)
@@ -9413,8 +9417,8 @@ Called from `temp-buffer-show-hook'."
        (insert (substitute-command-keys
                 "In this buffer, type \\[choose-completion] to \
 select the completion near point.\n\n")))))
-  (if (eq completion-auto-select t)
-      (switch-to-completions)))
+  (when (eq completion-auto-select t)
+    (switch-to-completions)))
 
 (add-hook 'completion-setup-hook #'completion-setup-function)