summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2021-12-09 17:34:54 +0100
committerPhilip Kaludercic <philipk@posteo.net>2021-12-21 22:31:18 +0100
commitf6967d2f6666d2e8b40f502e5a948c81c3236249 (patch)
treebeb659832e6d62d34f97c6ddd2d27fb5f70d9a6f
parent678b29711b5c0a545f38d414c1ce2ddc92525f63 (diff)
downloademacs-f6967d2f6666d2e8b40f502e5a948c81c3236249.tar.gz
Allow for the completion buffer to be automatically selected
* lisp/simple.el (completion-auto-select): Add new option. (completion-setup-function): Respect completion-auto-select.
-rw-r--r--lisp/simple.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 6d46fc19aaa..62a9f264d67 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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)