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

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

Re: How to bind isearch-repeat-forward to F3 in a certain mode only?


From: Marcin Borkowski
Subject: Re: How to bind isearch-repeat-forward to F3 in a certain mode only?
Date: Fri, 24 Jul 2015 01:09:54 +0200

On 2015-07-24, at 00:53, Javier <nospam@nospam.com> wrote:

>> ,----
>> | (my-mode)
>> | (make-local-variable 'isearch-mode-map)
>> | (define-key isearch-mode-map (kbd "<F3>") #'isearch-repeat-forward)
>> `----
>> 
>> but to no avail.  Inspecting `isearch-mode-map' implies that it was in
>> fact changed globally.  Pressing F3 while in isearch, though, starts
>> recording a keyboard macro anyway (both in my-mode and outside it).
>
>
> (defun my-mode-keys ()
>   "Keybindings for my-mode.  To be used as a hook."
>   (local-set-key (kbd "<F3>") 'isearch-repeat-forward)
>   )
> (add-hook 'my-mode-hook 'my-mode-keys)
>
> Would this work?  Is 'my-mode-hook defined in your case?

Yes and no.  I mean, it probably would - but then F3 would be bound to
isearch-repeat-forward also outside isearch.  (Not a big deal, but I'm
just curious whether it's at all possible to "do it right".)

Thanks,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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