* How to change key bindings in a particular mode
@ 2009-04-22 14:12 Guo Qiang
2009-04-22 20:30 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Guo Qiang @ 2009-04-22 14:12 UTC (permalink / raw
To: help-gnu-emacs
Hi, all
I am now writing a small function for mew. I want to remake
key bingings to a function in mew's draft mode. How can I do
that ?
Thank you
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: How to change key bindings in a particular mode
2009-04-22 14:12 How to change key bindings in a particular mode Guo Qiang
@ 2009-04-22 20:30 ` Drew Adams
2009-04-23 7:14 ` Tassilo Horn
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2009-04-22 20:30 UTC (permalink / raw
To: 'Guo Qiang', help-gnu-emacs
> I am now writing a small function for mew. I want to remake
> key bingings to a function in mew's draft mode. How can I do
> that ?
1. Find the name of the mode: `C-h v major-mode'. Example: `foo-mode'.
2. The mode's keymap is probably the same, with `-map' appended. Example:
`foo-mode-map'.
3. Define or redefine each of the keys you want in that map, using function
`define-key'. Example: (define-key foo-mode-map "\C-a" 'my-cmd)
To see the key bindings for a mode, use `C-h b'.
To better see the key bindings in a particular keymap, use `describe-keymap',
avaiable in library `help-fns+.el':
http://www.emacswiki.org/emacs/help-fns%2b.el
http://www.emacswiki.org/emacs/HelpPlus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to change key bindings in a particular mode
2009-04-22 20:30 ` Drew Adams
@ 2009-04-23 7:14 ` Tassilo Horn
0 siblings, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2009-04-23 7:14 UTC (permalink / raw
To: help-gnu-emacs
"Drew Adams" <drew.adams@oracle.com> writes:
Hi!
> 3. Define or redefine each of the keys you want in that map, using
> function `define-key'. Example: (define-key foo-mode-map "\C-a"
> 'my-cmd)
>
> To see the key bindings for a mode, use `C-h b'.
Just a short addition: Instead of using somewhat special keybinding
syntax like "\C-a", you can also use (kbd "C-a"). This has the benefit
that the `kbd' macro accepts the keys exactly as they're printed by the
help commands (like `C-h k' and `C-h b').
Bye,
Tassilo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-23 7:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22 14:12 How to change key bindings in a particular mode Guo Qiang
2009-04-22 20:30 ` Drew Adams
2009-04-23 7:14 ` Tassilo Horn
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.