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: Michael Heerdegen
Subject: Re: How to bind isearch-repeat-forward to F3 in a certain mode only?
Date: Mon, 27 Jul 2015 23:43:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> So, what is [F3] exactly and how it differs from [f3]?

The key <F3> is represented by the symbol `f3' in Emacs, that's it.  I
think it's by convention because all event basic types are represented
by lower case symbols.  Unlike in Common Lisp, in Emacs Lisp symbol
names are case sensitive.

That (kbd "<F3>") doesn't return what could be expected is not nice,
OTOH it's just consistent.

> > (setq-local isearch-mode-map (copy-keymap isearch-mode-map))
> > (define-key isearch-mode-map [f3] #'isearch-repeat-forward)
> >
> > You can do that in your `my-mode-hook' of course.
>
> Do I get it right that I should be careful to execute those lines
> exactly once per each buffer in my-mode?

That would not harm (would it?), though avoiding it would be cleaner.


> Is there any reason to put in in the hook and not in the command which
> will create that buffer and enter that mode?

No.

If the bindings are not directly related to your mode, you should not
put it into its hook.

But be careful: changing the major mode in any buffer kills all buffer
local variable bindings.


Regards,

Michael.




reply via email to

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