help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: middle mouse paste into isearch minibuffer


From: Perry Wagle
Subject: Re: middle mouse paste into isearch minibuffer
Date: Wed, 09 Nov 2011 20:09:32 -0800

Hi Again --

I'm trying to use the mouse to paste to the isearch prompt.

The following mod lets me highlight some text with my mouse (or
otherwise have it in my kill buffer), then press control-s with my
left hand, then middle mouse with my right hand to paste the
kill-buffer (?) into the mini-buffer where isearch is waiting for a
string to search for.  

This is without the tedium of carefully moving the mouse way down to
the mini-buffer where I don't even want to look, much less navigate
the mouse to.  My peripheral vision is good enough to see that
something is happening down there, which is all the information I
need.


It's got a problem that I need advice on:

(defun isearch-mouse-2 (click)
 "Handle mouse-2 in Isearch mode.
For a click in the echo area, invoke `isearch-yank-x-selection'.
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)))
;;    (if (and (window-minibuffer-p w)
;;           (not (minibuffer-window-active-p w))) ; in echo area
        (isearch-yank-x-selection)
        (transient-mark-mode)
;;      (when (functionp binding)
;;        (call-interactively binding)))))
)

The problem is with the call to transient-mark-mode.  Its my first
attempt to fix what I think is a runaway mark-region.

If I don't have it, then varying regions of text become highlighted
when I move around with repeated pressings of control-s.

If I do have it, then I get the other extreme of closing down
transient mark mode entirely.

The advice I need is this: I think this should work similarly to how
keyboard bound people use it.  I think that there is some intention
that control-s SHOULD move the highlighted region around.  But if I
double click on or otherwise highlight a region so it can be pasted to
isearch mini-buffer, that SHOULDN'T set the mark (I think) for
afterwards, when you are control-s'ing around.

Is this right?  What do I want to do to be consistent with the rest of
emacs?  How do I do "the right thing"?  Do I start using the mark-ring
or something?

In short, I don't know what all behavior I need to preserve to do this
correctly.

Thanks!

-- Perry


PS.  If you hate your mouse, please refrain from saying how to do this
without the mouse.  Its been done, to excess, thanks.  The question is
"how to integrate the mouse cleanly and consistently in a small way
into emacs?".




reply via email to

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