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: Tassilo Horn
Subject: Re: my search/paste idiom not supported in emacs
Date: Thu, 30 Dec 2010 10:39:06 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

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.

> 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---

Bye,
Tassilo




reply via email to

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