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

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

Re: How can I bind these two keys?


From: Kevin Rodgers
Subject: Re: How can I bind these two keys?
Date: Mon, 10 Apr 2006 09:12:56 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Alan Mackenzie wrote:
To set it for matlab files, you'll need to know what "mode" you're using
for them.  This is displayed on the "mode line" near the bottom of your
screen, and for Text Mode would look something like "(Text H Fill)" -
ignore the "H Fill" bit.

Your new key sequence will be active for all buffers using this mode.
(It is tricky to restrict it further than this.)

Firstly, you need the name of the "key map" belonging to the mode.
There's no totally systematic way of finding this, but for Text Mode it
is `text-mode-map', for Texinfo Mode it is `texinfo-mode-map', for Emacs
Lisp Mode it is `emacs-lisp-mode-map'.  Use C-h v, typing in your guesses
for the name till you find it.

There's no need to look up the keymap variable.  Just do:

(add-hook 'foo-mode-hook (lambda () (local-set-key KEY COMMAND) ...))

Then find out the name the function on C-c C-s - Use C-h c followed by
the actual key sequence to get this.  It might be something like
`matlab-show-info'.  You'd then bind this by writing one of the following
Lisp forms into your .emacs:

   (define-key matlab-mode-map "\C-m" 'matlab-show-info)
   (define-key matlab-mode-map [F5] 'matlab-show-info)

--
Kevin Rodgers





reply via email to

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