emacs-diffs
[Top][All Lists]
Advanced

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

master a7f2eb3054: Make isearch respond to 'mouse-yank-at-point'


From: Lars Ingebrigtsen
Subject: master a7f2eb3054: Make isearch respond to 'mouse-yank-at-point'
Date: Wed, 27 Apr 2022 08:02:40 -0400 (EDT)

branch: master
commit a7f2eb3054588ce627aeb6c24ca0b4c469f68914
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make isearch respond to 'mouse-yank-at-point'
    
    * doc/emacs/killing.texi (Secondary Selection): Document it.
    * lisp/isearch.el (isearch-mouse-2): Make isearch respond to
    mouse-yank-at-point (bug#7787).
    
    * lisp/mouse.el (mouse-yank-at-point): Mention it.
---
 doc/emacs/killing.texi | 3 +++
 etc/NEWS               | 8 ++++++++
 lisp/isearch.el        | 7 ++++---
 lisp/mouse.el          | 4 +++-
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index e3de2bc2fa..02a42a34fc 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -698,6 +698,9 @@ lines, much like @kbd{mouse-1}.
 If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-mouse-2} yanks
 at point.  Then it does not matter precisely where you click, or even
 which of the frame's windows you click on.  @xref{Mouse Commands}.
+This user option also as an effect on interactive search: If this
+variable is non-@code{nil}, yanking with the mouse anywhere in the
+frame will add the text to the search string.
 
 @node Accumulating Text
 @section Accumulating Text
diff --git a/etc/NEWS b/etc/NEWS
index a2818c8bf7..2ecad81b11 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -766,6 +766,14 @@ but doesn't exit the minibuffer.
 
 ** Isearch and Replace
 
++++
+*** Changes in how isearch responds to 'mouse-yank-at-point'.
+If a user does 'C-s' and then uses '<mouse-2>' ('mouse-yank-primary')
+outside the echo area, Emacs will, by default, end the isearch and
+yank the text where the mouse cursor is.  In Emacs 29, if
+'mouse-yank-at-point' is non-nil, the text will be added to the
+isearch instead.
+
 +++
 *** New user option 'char-fold-override'.
 Non-nil means that the default definitions of equivalent characters
diff --git a/lisp/isearch.el b/lisp/isearch.el
index be0227b6e7..750324a9fe 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2631,9 +2631,10 @@ is bound to outside of Isearch."
                        ;; 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)))))
 
diff --git a/lisp/mouse.el b/lisp/mouse.el
index b66cfad487..c08ecaf334 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -42,7 +42,9 @@
   :group 'editing)
 
 (defcustom mouse-yank-at-point nil
-  "If non-nil, mouse yank commands yank at point instead of at click."
+  "If non-nil, mouse yank commands yank at point instead of at click.
+This also allows yanking text into an isearch without moving the
+mouse cursor to the echo area."
   :type 'boolean)
 
 (defcustom mouse-drag-copy-region nil



reply via email to

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