all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#67001: [PATCH] ; Promptly disable 'completion-in-region-mode'
@ 2023-11-08 17:53 Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-11-09  7:41 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-11-08 17:53 UTC (permalink / raw)
  To: 67001; +Cc: Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

Tags: patch

This patch addresses an issue that Juri (CC'd) observed in Bug#66948,
where `completion-at-point` leaves TAB bound to `completion-at-point`
even when it doesn't show the completions list.

To reproduce:
1. emacs -Q
2. In the *scratch* buffer, insert the following:
--8<---------------cut here---------------start------------->8---
(defun foo ()
bar
--8<---------------cut here---------------end--------------->8---
3. With point after "bar", press C-M-i to invoke `completion-at-point`.
   This shows a message saying "No match".  That's expected.
4. Press TAB.  This again shows a message saying "No match".
   This is unexpected, instead TAB should indent "bar" as usual.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Promptly-disable-completion-in-region-mode.patch --]
[-- Type: text/patch, Size: 1746 bytes --]

From 846659798143826351de01d10b69613ec1d16c9a Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
Date: Wed, 8 Nov 2023 18:27:03 +0100
Subject: [PATCH] ; Promptly disable 'completion-in-region-mode'

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 @@ completion--in-region-1
    (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.42.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#67001: [PATCH] ; Promptly disable 'completion-in-region-mode'
  2023-11-08 17:53 bug#67001: [PATCH] ; Promptly disable 'completion-in-region-mode' Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-11-09  7:41 ` Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2023-11-09  7:41 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: 67001

close 67001 30.0.50
thanks

> This patch addresses an issue that Juri (CC'd) observed in Bug#66948,
> where `completion-at-point` leaves TAB bound to `completion-at-point`
> even when it doesn't show the completions list.
>
> To reproduce:
> 1. emacs -Q
> 2. In the *scratch* buffer, insert the following:
>
> (defun foo ()
> bar
>
> 3. With point after "bar", press C-M-i to invoke `completion-at-point`.
>    This shows a message saying "No match".  That's expected.
> 4. Press TAB.  This again shows a message saying "No match".
>    This is unexpected, instead TAB should indent "bar" as usual.

Thanks for the patch.  This looks like the right way to fix this
issue.  So now pushed to master.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-09  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08 17:53 bug#67001: [PATCH] ; Promptly disable 'completion-in-region-mode' Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-09  7:41 ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.