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

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

Re: Cant global map overwrite local maps?


From: Pascal Bourguignon
Subject: Re: Cant global map overwrite local maps?
Date: Wed, 29 Mar 2006 20:58:54 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Florian Kaufmann" <sensorflo@gmail.com> writes:

> Hello
>
> Isn't it possible to bind a key to command such that this definition is
> effective in all major & minor modes? In my particular case I'd like to
> bind forward-char and backward-char to C-j and C-l respectively. But I
> 'd like to write this definition only once, and not for all minor and
> major modes which overwrite the global map. For example currently in my
> init.el I not only have to write
>
> (global-set-key [(control j)] 'backward-char)
> (global-set-key [(control l)] 'forward-char)
>
> but disturbingly also
>
> (add-hook 'c++-mode-hook
>           '(lambda ()
>              (define-key c++-mode-map [(control j)] 'backward-char)
>              (define-key c++-mode-map [(control l)] 'forward-char) ))
>
> And I also have to add lines for countless of other modes I intend to
> use. 

Yes, that's what you have to do.  
The mode shall decide what keybindings are good for you.

If you want to avoid it globally, the best that could be done is to
advice define-key and local-set-key, etc, to filter out unwanted mode
bindings.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

What is this talk of 'release'? Klingons do not make software 'releases'.
Our software 'escapes' leaving a bloody trail of designers and quality
assurance people in it's wake.


reply via email to

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