unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: How can I bind these two keys?
Date: Mon, 10 Apr 2006 09:12:56 -0600	[thread overview]
Message-ID: <e1dsn1$s5r$1@sea.gmane.org> (raw)
In-Reply-To: <du4d1e.n7.ln@acm.acm>

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

      parent reply	other threads:[~2006-04-10 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-09 19:24 How can I bind these two keys? volunteers
2006-04-10  8:27 ` Alan Mackenzie
2006-04-10 12:07   ` Miles Bader
2006-04-10 15:12   ` Kevin Rodgers [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='e1dsn1$s5r$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /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.
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).