aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-08-22 17:41:15 +0000
committerRichard M. Stallman2004-08-22 17:41:15 +0000
commite0dbfecc414a5856e7855b2803f145ba5fe6c74a (patch)
tree06f1eb32abfe136a7939463682f8aa8d4da520e0
parent5106fd70821119dec999a8215c36c670d3e15689 (diff)
downloademacs-e0dbfecc414a5856e7855b2803f145ba5fe6c74a.tar.gz
emacs-e0dbfecc414a5856e7855b2803f145ba5fe6c74a.zip
(Major Mode Conventions): Discuss rebinding of standard key bindings.
-rw-r--r--lispref/modes.texi28
1 files changed, 18 insertions, 10 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi
index 040c229bb00..78b8fc440d7 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -188,16 +188,24 @@ The key sequences bound in a major mode keymap should usually start with
188characters are reserved for minor modes, and ordinary letters are 188characters are reserved for minor modes, and ordinary letters are
189reserved for users. 189reserved for users.
190 190
191It is reasonable for a major mode to rebind a key sequence with a 191A major mode can also rebind the keys @kbd{M-n}, @kbd{M-p} and
192standard meaning, if it implements a command that does ``the same job'' 192@kbd{M-s}. The bindings for @kbd{M-n} and @kbd{M-p} should normally
193in a way that fits the major mode better. For example, a major mode for 193be some kind of ``moving forward and backward,'' but this does not
194editing a programming language might redefine @kbd{C-M-a} to ``move to 194necessarily mean cursor motion.
195the beginning of a function'' in a way that works better for that 195
196language. 196It is legitimate for a major mode to rebind a standard key sequence if
197 197it provides a command that does ``the same job'' in a way better
198Major modes such as Dired or Rmail that do not allow self-insertion of 198suited to the text this mode is used for. For example, a major mode
199text can reasonably redefine letters and other printing characters as 199for editing a programming language might redefine @kbd{C-M-a} to
200editing commands. Dired and Rmail both do this. 200``move to the beginning of a function'' in a way that works better for
201that language.
202
203It is also legitimate for a major mode to rebind a standard key
204sequence whose standard meaning is rarely useful in that mode. For
205instance, minibuffer modes rebind @kbd{M-r}, whose standard meaning is
206rarely of any use in the minibuffer. Major modes such as Dired or
207Rmail that do not allow self-insertion of text can reasonably redefine
208letters and other printing characters as special commands.
201 209
202@item 210@item
203Major modes must not define @key{RET} to do anything other than insert 211Major modes must not define @key{RET} to do anything other than insert