unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why some key binding don't work in Latex mode but they do in other modes? How fix?
@ 2013-01-13  3:33 Chris Seberino
  2013-01-13  9:29 ` Pascal J. Bourguignon
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Seberino @ 2013-01-13  3:33 UTC (permalink / raw)
  To: help-gnu-emacs

Some custom key bindings work everywhere except for Latex mode....how
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.

cs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why some key binding don't work in Latex mode but they do in other modes? How fix?
  2013-01-13  3:33 Why some key binding don't work in Latex mode but they do in other modes? How fix? Chris Seberino
@ 2013-01-13  9:29 ` Pascal J. Bourguignon
  2013-01-14 16:09   ` Chris Seberino
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal J. Bourguignon @ 2013-01-13  9:29 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> Some custom key bindings work everywhere except for Latex mode....how
> 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 <next>."
      (interactive)
      (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__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why some key binding don't work in Latex mode but they do in other modes? How fix?
  2013-01-13  9:29 ` Pascal J. Bourguignon
@ 2013-01-14 16:09   ` Chris Seberino
  2013-01-14 16:19     ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Seberino @ 2013-01-14 16:09 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 13, 3:29 am, "Pascal J. Bourguignon" <p...@informatimago.com>
wrote:

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

So there is no way to "force" keybindings to avoid "shadowing" in all
modes?
If I insisted on binding arbitrary keys I must "unshadow" them for
each
mode separately?

cs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why some key binding don't work in Latex mode but they do in other modes? How fix?
  2013-01-14 16:09   ` Chris Seberino
@ 2013-01-14 16:19     ` Dmitry Gutov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2013-01-14 16:19 UTC (permalink / raw)
  To: Chris Seberino; +Cc: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> On Jan 13, 3:29 am, "Pascal J. Bourguignon" <p...@informatimago.com>
> wrote:
>
>> 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.
>
> So there is no way to "force" keybindings to avoid "shadowing" in all
> modes?
> If I insisted on binding arbitrary keys I must "unshadow" them for
> each
> mode separately?

No easy way, but you can use `emulation-mode-map-alists' for this, as
described here: http://stackoverflow.com/questions/5332221/globally-overriding-emacs-keybindings



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-14 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-13  3:33 Why some key binding don't work in Latex mode but they do in other modes? How fix? Chris Seberino
2013-01-13  9:29 ` Pascal J. Bourguignon
2013-01-14 16:09   ` Chris Seberino
2013-01-14 16:19     ` Dmitry Gutov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).