[Top][All Lists]

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

Re: Why some key binding don't work in Latex mode but they do in other m

From: Pascal J. Bourguignon
Subject: Re: Why some key binding don't work in Latex mode but they do in other modes? How fix?
Date: Sun, 13 Jan 2013 10:29:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Chris Seberino <> writes:

> Some custom key bindings work everywhere except for Latex
> fix for Latex mode? i.e. how tell Latex mode not to stomp on my key
> bindings?
> Specifically....I customized Ctrl-j but it doesn't work right in Latex
> mode.

Modes can redefine bindings locally.

The EmacsManual says that the combination of C-c followed by a plain
letter, and the function keys f5 through f9 are reserved for users. That
means that you can expect that no other mode ever uses these.

So if you don't want your bindings to be clobbered or shadowed, you need
to choose one of those keys.  (Now of course, f28 is probably not used
by modes, if you map it on your keyboard).

But you still can bind any key you want, just be prepared to have them
shadowed.  Since you can always access any command thru M-x, you can
also write your own command to reset your binding.

For example, I have:

    (defun reset-movement-keypad ()
      "Locally set the keys <insert>, <suppr>, <home>, <end>, <prior> and 
      (local-set-key (kbd "<home>")        'beginning-of-buffer)
      (local-set-key (kbd "<end>")         'end-of-buffer)
      (local-set-key (kbd "<prior>")       'scroll-down)
      (local-set-key (kbd "<next>")        'scroll-up)
      (global-set-key (kbd "<home>")        'beginning-of-buffer)
      (global-set-key (kbd "<end>")         'end-of-buffer)
      (global-set-key (kbd "<prior>")       'scroll-down)
      (global-set-key (kbd "<next>")        'scroll-up))

and when I enter a mode that changes the behavior of <home>, I just have
to M-x reset-movement-keypad RET to revert to my setting, and to add
reset-movement-keypad to the hook of that mode.

__Pascal Bourguignon__           
A bad day in () is better than a good day in {}.

reply via email to

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