changeset 39047:d177c68813c0

(isearch-mouse-2): Renamed from isearch-mouse-yank. Instead of running mouse-yank-at-click, see what the event is bound to outside Isearch and run that.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 31 Aug 2001 08:51:39 +0000
parents a61b3d907098
children 0c97582defff
files lisp/isearch.el
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Fri Aug 31 08:03:43 2001 +0000
+++ b/lisp/isearch.el	Fri Aug 31 08:51:39 2001 +0000
@@ -317,7 +317,7 @@
     (define-key map "\C-^" 'isearch-toggle-specified-input-method)
 
     ;; People expect to be able to paste with the mouse.
-    (define-key map [mouse-2] #'isearch-mouse-yank)
+    (define-key map [mouse-2] #'isearch-mouse-2)
     (define-key map [down-mouse-2] nil)
 
     ;; Some bindings you may want to put in your isearch-mode-hook.
@@ -1046,16 +1046,26 @@
   (interactive)
   (isearch-yank-string (x-get-selection)))
 
-(defun isearch-mouse-yank (click arg)
-  "Yank with the mouse in Isearch mode.
+
+(defun isearch-mouse-2 (click arg)
+  "Handle mouse-2 in Isearch mode.
 For a click in the echo area, invoke `isearch-yank-x-selection'.
-Otherwise invoke `mouse-yank-at-click'."
+Otherwise invoke whatever mouse-2 is bound to outside of Isearch."
   (interactive "e\nP")
-  (let ((w (posn-window (event-start click))))
+  (let* ((w (posn-window (event-start click)))
+	 (overriding-terminal-local-map nil)
+	 (key (vector (event-basic-type click)))
+	 (binding (key-binding key)))
     (if (and (window-minibuffer-p w)
 	     (not (minibuffer-window-active-p w))) ; in echo area
 	(isearch-yank-x-selection)
-      (mouse-yank-at-click click arg))))
+      (when binding
+	;; Kluge to allow passing ARG to functions that support it,
+	;; like mouse-yank-at-click.
+	(if (equal (cadr (interactive-form binding)) "e\nP")
+	    (funcall binding click arg)
+	  (funcall binding click))))))
+
 
 (defun isearch-yank-word ()
   "Pull next word from buffer into search string."