From: Alan Mackenzie <acm@muc.de>
Subject: Re: How can I bind these two keys?
Date: Mon, 10 Apr 2006 08:27:57 +0000 [thread overview]
Message-ID: <du4d1e.n7.ln@acm.acm> (raw)
In-Reply-To: 1144610677.752530.197580@i39g2000cwa.googlegroups.com
volunteers@gmail.com wrote on 9 Apr 2006 12:24:37 -0700:
> Hi, group,
> I just start to use emacs. How can I bind the keys 'C-c C-s' to one key
> such as 'C-m'? I don't want 'C-m' to be a global keybinding and I just
> want it works when I edit matlab codes. How about bind them to 'F5'?
I'm guessing you already know about `global-set-key' and have tried it.
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.
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)
(Be careful about the ' signs - they are critically important.)
However, C-m probably isn't a good choice, since it produces the same
effect as carriage return. F5 is just fine, though.
> Thanks.
> Vol
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").
next prev parent reply other threads:[~2006-04-10 8:27 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 [this message]
2006-04-10 12:07 ` Miles Bader
2006-04-10 15:12 ` Kevin Rodgers
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=du4d1e.n7.ln@acm.acm \
--to=acm@muc.de \
/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).