>From 4bc0d69c00cc650ec2be437ac7d45ccad7926ea1 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 9 Dec 2021 17:34:54 +0100 Subject: [PATCH 2/4] 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. --- lisp/simple.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 5183a7e053..b5f5122153 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9227,6 +9227,12 @@ completion-show-help :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 () @@ -9263,7 +9269,9 @@ completion-setup-function (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) -- 2.34.0