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

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

Re: my search/paste idiom not supported in emacs


From: Perry Wagle
Subject: Re: my search/paste idiom not supported in emacs
Date: Thu, 30 Dec 2010 08:23:54 -0800


On Dec 30, 2010, at 1:39 AM, Tassilo Horn wrote:

Perry Wagle <wagle@mac.com> writes:

Hi Perry,

In xemacs, if I double click on a word, the word is highlighted.  If I
then press control-s for search, and click the middle mouse button
*without moving the mouse*, I will paste that word into the search
string, and all is good.

Emacs, on the other hand, does not support this idiom.  For some
reason, the middle mouse button *ABORTS* the search mode, and then
pastes the word under the mouse.  Why would you want that?

Hm, middle mouse button is "paste the primary selection at this
position" in almost any X application.

The position is the search function waiting for a string to look for.

This idiom alone has kept me using xemacs for over a decade.  I'd like
to switch to emacs now.

Can I fix this easily with option-setting, or does it require me to
hack and add the correct behavior?

Simply add a keybinding for that:

--8<---------------cut here---------------start------------->8---
(define-key isearch-mode-map (kbd "<mouse-2>")
 'isearch-yank-x-selection)
--8<---------------cut here---------------end--------------->8---

If you don't like how that expands the region (including highlighting),
then use something like that to deactivate the mark before:

--8<---------------cut here---------------start------------->8---
(define-key isearch-mode-map (kbd "<mouse-2>")
 (lambda ()
   (interactive)
   (deactivate-mark)
   (isearch-yank-x-selection)))
--8<---------------cut here---------------end--------------->8---


WIll try this, thanks!

-- Perry


reply via email to

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