]> git.eshelyaron.com Git - emacs.git/commitdiff
Promptly disable 'completion-in-region-mode' (bug#67001)
authorEshel Yaron <me@eshelyaron.com>
Wed, 8 Nov 2023 17:27:03 +0000 (18:27 +0100)
committerJuri Linkov <juri@linkov.net>
Thu, 9 Nov 2023 07:40:54 +0000 (09:40 +0200)
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

index bf1e014319e09b7e29d61e70cea399e42b2c3768..d84e92fc01340badfafbce6b3e84ea46ac6288af 100644 (file)
@@ -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