bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47755: 27.1; mouse-yank-at-click fails


From: Juri Linkov
Subject: bug#47755: 27.1; mouse-yank-at-click fails
Date: Tue, 13 Apr 2021 23:27:45 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>> int main()
>>> {
>>>   xyzz = abcc;
>>> }
>>>
>>> 1. Place mouse over `main` and left double click - `main` is selected
>>> 2. isearch-forward (C-s) `xyzz` - `xyzz` is selected
>>> 3. place cursor over `x` of `xyzz` and mouse-yank-at-click (middle mouse
>>> down)
>>>
>>> You should see error "Lisp nesting exceeds `max-lisp-eval-depth`"
>>
>> It's an infinite recursion inside isearch-mouse-2.
>
> This is because let-binding overriding-terminal-local-map to nil
>
>   (let ((overriding-terminal-local-map nil))
>     (key-binding (this-command-keys-vector) t))
>
> doesn't disable its current value anymore.  It used to work when bug#23007
> was fixed in 2017.  So in Emacs 26.3 it correctly returned 
> 'mouse-yank-primary',
> but in Emacs 27 it's broken and returns 'isearch-mouse-2' without ignoring
> the current value of overriding-terminal-local-map, i.e. currently let-binding
> 'overriding-terminal-local-map nil' has no effect for 'key-binding'.

In 2018 the logic of searching a key binding was changed.
Now it magically depends of the current mode instead of
more explicit keymaps as before:

Before 2018:

  (let ((isearch-mode t))
    (key-binding [mouse-2] t))
  => mouse-yank-primary

After 2018:

  (let ((isearch-mode t))
    (key-binding [mouse-2] t))
  => isearch-mouse-2

Anyway here is the fix:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5efac4c78f..d3c0f261ba 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2561,7 +2561,9 @@ isearch-mouse-2
 is bound to outside of Isearch."
   (interactive "e")
   (let ((w (posn-window (event-start click)))
-        (binding (let ((overriding-terminal-local-map nil))
+        (binding (let ((overriding-terminal-local-map nil)
+                       ;; Key search now depends on mode (bug#47755).
+                       (isearch-mode nil))
                    (key-binding (this-command-keys-vector) t))))
     (if (and (window-minibuffer-p w)
             (not (minibuffer-window-active-p w))) ; in echo area

reply via email to

[Prev in Thread] Current Thread [Next in Thread]