From e4af142698f741ea60009dfbe8985c126522a927 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 31 Aug 2001 08:51:39 +0000 Subject: [PATCH] (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. --- lisp/isearch.el | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 1de8fce8e3b..2392bf2935b 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -317,7 +317,7 @@ Default value, nil, means edit the string instead." (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 @@ If no previous match was done, just beep." (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." -- 2.39.5