unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: 23007@debbugs.gnu.org
Subject: bug#23007: 24.5; buggy interactive search with middle click
Date: Mon, 29 May 2017 13:56:25 -0600	[thread overview]
Message-ID: <871sr7h1xy.fsf@gmail.com> (raw)
In-Reply-To: <87a8m13gba.fsf@zira.vinc17.org> (Vincent Lefevre's message of "Mon, 14 Mar 2016 04:10:33 +0100")

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

tags 23007 patch
quit

Vincent Lefevre <vincent@vinc17.net> writes:

> 1. Start Emacs with its own UI under X Window.
>
> 2. Type: M-<
>    Here the cursor is at the beginning of the buffer, which contains
>    some text.
>
> 3. In some other window, select some text (e.g. the letter "n").
>
> 4. Type: C-s
>    This starts the interactive search. It says:
>    I-search:
>
> 5. Click with the middle button near the bottom of the window.
>    This pastes the text at the end of the buffer.
>
> 6. Type: C-_
>    This removes the pasted text and moves the cursor back at the
>    beginning of the buffer.
>
> 7. Type: C-s
>    This starts the interactive search again. But this time, it says:
>    I-search:  [No previous search string]
>
> 8. Type: e
>    This searches for "e". All the occurrences of "e" are highlighted.
>
> 9. Type: <down>
>    This is no longer the interactive search, but the occurrences of "e"
>    are still highlighted.
>
> Typing other letters brings back to the interactive search.

This is because clicking the middle button during isearch calls
isearch-mouse-2, which calls the usual mouse-yank-primary, which calls
isearch-done to finish isearch. Problem is, it let-binds
overriding-terminal-local-map around this call, which counteracts
isearch-done setting this variable to nil. The end result is having quit
isearch, but with the overriding map still in place.

I have attached a simple patch below. Eli, if it's satisfactory, would
you commit it for me?

TIA


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

From 33251d03d1d2298b29ae2a35ecccb8ae41e8bdd4 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Mon, 29 May 2017 13:43:23 -0600
Subject: [PATCH] Limit scope of local overriding-terminal-local-map

The function `binding' may call isearch-done, which globally sets
overriding-terminal-local-map to nil (Bug #23007).
* lisp/isearch.el (isearch-mouse-2): Don't bind
overriding-terminal-local-map around the call to `binding'.
---
 lisp/isearch.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index c34739d638..992794e43a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2036,14 +2036,15 @@ isearch-mouse-2
 Otherwise invoke whatever the calling mouse-2 command sequence
 is bound to outside of Isearch."
   (interactive "e")
-  (let* ((w (posn-window (event-start click)))
-	 (overriding-terminal-local-map nil)
-	 (binding (key-binding (this-command-keys-vector) t)))
+  (let ((w (posn-window (event-start click)))
+        binding)
     (if (and (window-minibuffer-p w)
-	     (not (minibuffer-window-active-p w))) ; in echo area
-	(isearch-yank-x-selection)
+             (not (minibuffer-window-active-p w))) ; in echo area
+        (isearch-yank-x-selection)
+      (let ((overriding-terminal-local-map nil))
+        (setq binding (key-binding (this-command-keys-vector) t)))
       (when (functionp binding)
-	(call-interactively binding)))))
+        (call-interactively binding)))))
 
 (declare-function xterm--pasted-text "term/xterm" ())
 
-- 
2.11.0


  reply	other threads:[~2017-05-29 19:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  3:10 bug#23007: 24.5; buggy interactive search with middle click Vincent Lefevre
2017-05-29 19:56 ` Alex [this message]
2017-05-29 23:56   ` npostavs
2017-05-30  0:41     ` Drew Adams
2017-05-30  0:53       ` npostavs
2017-05-30  1:07         ` Drew Adams
2017-05-30  1:28           ` npostavs
2017-05-30  2:04             ` Drew Adams
2017-05-30  2:47     ` Alex
2017-05-30  4:44       ` Drew Adams
2017-05-30 11:47       ` npostavs
2017-06-01 22:09         ` npostavs

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=871sr7h1xy.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=23007@debbugs.gnu.org \
    --cc=vincent@vinc17.net \
    /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).