]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow for the completion buffer to be automatically selected
authorPhilip Kaludercic <philipk@posteo.net>
Thu, 9 Dec 2021 16:34:54 +0000 (17:34 +0100)
committerPhilip Kaludercic <philipk@posteo.net>
Tue, 21 Dec 2021 21:31:18 +0000 (22:31 +0100)
* lisp/simple.el (completion-auto-select): Add new option.
(completion-setup-function): Respect completion-auto-select.

lisp/simple.el

index 6d46fc19aaa897697d6658678864b3efab523e44..62a9f264d67f29463fb9df82f3e2fbb7bc49a388 100644 (file)
@@ -9228,6 +9228,12 @@ Called from `temp-buffer-show-hook'."
   :version "22.1"
   :group 'completion)
 
+(defcustom completion-auto-select t
+  "Non-nil means to automatically select the completions buffer."
+  :type 'boolean
+  :version "29.1"
+  :group 'completion)
+
 ;; This function goes in completion-setup-hook, so that it is called
 ;; after the text of the completion list buffer is written.
 (defun completion-setup-function ()
@@ -9264,7 +9270,9 @@ Called from `temp-buffer-show-hook'."
            (insert "Click on a completion to select it.\n"))
        (insert (substitute-command-keys
                 "In this buffer, type \\[choose-completion] to \
-select the completion near point.\n\n"))))))
+select the completion near point.\n\n")))))
+  (when completion-auto-select
+    (switch-to-completions)))
 
 (add-hook 'completion-setup-hook #'completion-setup-function)