From 5416896d608b68a969977f91b8de1e613300421d Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 8 Nov 2023 18:27:03 +0100 Subject: [PATCH] Promptly disable 'completion-in-region-mode' (bug#67001) Avoid keeping 'completion-in-region-mode' on when exiting 'completion--in-region-1' if the *Completions* buffer isn't shown. Otherwise, the bindings from 'completion-in-region-mode-map' linger, notable shadowing other bindings for TAB. * lisp/minibuffer.el (completion--in-region-1): Disable 'completion-in-region-mode' if the *Completions* buffer isn't visible. --- lisp/minibuffer.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index bf1e014319e..d84e92fc013 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1561,11 +1561,12 @@ scroll the window of possible completions." (t (prog1 (pcase (completion--do-completion beg end) (#b000 nil) (_ t)) - (when (and (eq completion-auto-select t) - (window-live-p minibuffer-scroll-window) - (eq t (frame-visible-p (window-frame minibuffer-scroll-window)))) - ;; When the completion list window was displayed, select it. - (switch-to-completions)))))) + (if (window-live-p minibuffer-scroll-window) + (and (eq completion-auto-select t) + (eq t (frame-visible-p (window-frame minibuffer-scroll-window))) + ;; When the completion list window was displayed, select it. + (switch-to-completions)) + (completion-in-region-mode -1)))))) (defun completion--cache-all-sorted-completions (beg end comps) (add-hook 'after-change-functions -- 2.39.2