all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <8738y5cty0.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: b70d8a4a-abd9-4d9b-8326-b2f23f9c411f@v7g2000yqv.googlegroups.com

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


  reply	other threads:[~2013-01-13  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-01-14 16:09   ` Chris Seberino
2013-01-14 16:19     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738y5cty0.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.