unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Bob Floyd <bobfloyd@comcast.net>, 47755@debbugs.gnu.org
Subject: bug#47755: 27.1; mouse-yank-at-click fails
Date: Tue, 13 Apr 2021 23:27:45 +0300	[thread overview]
Message-ID: <874kg9oqbt.fsf@mail.linkov.net> (raw)
In-Reply-To: <87o8einfci.fsf@mail.linkov.net> (Juri Linkov's message of "Tue,  13 Apr 2021 22:44:57 +0300")

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

>>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: isearch-mouse-2.patch --]
[-- Type: text/x-diff, Size: 667 bytes --]

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	other threads:[~2021-04-13 20:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 17:57 bug#47755: 27.1; mouse-yank-at-click fails Bob Floyd
2021-04-13 18:11 ` Eli Zaretskii
2021-04-13 18:31   ` Bob Floyd
2021-04-13 19:44   ` Juri Linkov
2021-04-13 20:27     ` Juri Linkov [this message]
2021-04-13 20:55     ` Gregory Heytings
2021-04-13 20:57       ` Gregory Heytings
2021-04-14 16:24         ` Bob Floyd
2021-04-14 18:36       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kg9oqbt.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=47755@debbugs.gnu.org \
    --cc=bobfloyd@comcast.net \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).