GNU bug report logs - #7787
23.2; wrong meaning for mouse-2 while in search mode

Previous Next

Package: emacs;

Reported by: Perry Wagle <wagle <at> mac.com>

Date: Wed, 5 Jan 2011 06:54:01 UTC

Severity: minor

Tags: confirmed, moreinfo

Found in versions 26.3, 23.2, 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #64 received at 7787 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 7787 <at> debbugs.gnu.org, Perry Wagle <wagle <at> mac.com>,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#7787: 23.2; wrong meaning for mouse-2 while in search mode
Date: Sun, 17 Apr 2022 14:37:21 +0200
Juri Linkov <juri <at> linkov.net> writes:

>>   0. emacs -Q
>>   1. M-: (setq mouse-yank-at-point t) RET
>>   2. double click any word to mark it
>>   3. C-s
>>   4. mouse-2 [with cursor still over the original window, not in
>>      minibuffer]
>>
>>> I see that the existing implementation of isearch-mouse-2
>>> allows yanking the selection when clicked in the echo area,
>>> but when clicked in the buffer it goes into infinite recursion,
>>> because isearch-mouse-2 calls itself again.
>>
>> This is what I see as well, on current master.
>
> The problem is that 'key-binding' in 'isearch-mouse-2'
>
>   (let ((overriding-terminal-local-map nil))
>     (key-binding (this-command-keys-vector) t))
>
> still returns the keybinding from 'overriding-terminal-local-map'
> that contains isearch keybindings.  Something is wrong here.

I'm wholly unfamiliar with this code, but the following trivial patch
seems to do the trick?

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 168d71ada3..26db141781 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2629,9 +2629,10 @@ isearch-mouse-2
                        ;; Key search 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
-	(isearch-yank-x-selection)
+    (if (or mouse-yank-at-point
+            (and (window-minibuffer-p w)
+	         (not (minibuffer-window-active-p w)))) ; in echo area
+        (isearch-yank-x-selection)
       (when (functionp binding)
 	(call-interactively binding)))))
 

Is this the wrong thing to do for some reason?  I mean, we don't care
about the value of binding in this case, I think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.