diff options
| author | Richard M. Stallman | 2004-08-22 17:41:15 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-08-22 17:41:15 +0000 |
| commit | e0dbfecc414a5856e7855b2803f145ba5fe6c74a (patch) | |
| tree | 06f1eb32abfe136a7939463682f8aa8d4da520e0 | |
| parent | 5106fd70821119dec999a8215c36c670d3e15689 (diff) | |
| download | emacs-e0dbfecc414a5856e7855b2803f145ba5fe6c74a.tar.gz emacs-e0dbfecc414a5856e7855b2803f145ba5fe6c74a.zip | |
(Major Mode Conventions): Discuss rebinding of standard key bindings.
| -rw-r--r-- | lispref/modes.texi | 28 |
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 | |||
| 188 | characters are reserved for minor modes, and ordinary letters are | 188 | characters are reserved for minor modes, and ordinary letters are |
| 189 | reserved for users. | 189 | reserved for users. |
| 190 | 190 | ||
| 191 | It is reasonable for a major mode to rebind a key sequence with a | 191 | A major mode can also rebind the keys @kbd{M-n}, @kbd{M-p} and |
| 192 | standard 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 |
| 193 | in a way that fits the major mode better. For example, a major mode for | 193 | be some kind of ``moving forward and backward,'' but this does not |
| 194 | editing a programming language might redefine @kbd{C-M-a} to ``move to | 194 | necessarily mean cursor motion. |
| 195 | the beginning of a function'' in a way that works better for that | 195 | |
| 196 | language. | 196 | It is legitimate for a major mode to rebind a standard key sequence if |
| 197 | 197 | it provides a command that does ``the same job'' in a way better | |
| 198 | Major modes such as Dired or Rmail that do not allow self-insertion of | 198 | suited to the text this mode is used for. For example, a major mode |
| 199 | text can reasonably redefine letters and other printing characters as | 199 | for editing a programming language might redefine @kbd{C-M-a} to |
| 200 | editing commands. Dired and Rmail both do this. | 200 | ``move to the beginning of a function'' in a way that works better for |
| 201 | that language. | ||
| 202 | |||
| 203 | It is also legitimate for a major mode to rebind a standard key | ||
| 204 | sequence whose standard meaning is rarely useful in that mode. For | ||
| 205 | instance, minibuffer modes rebind @kbd{M-r}, whose standard meaning is | ||
| 206 | rarely of any use in the minibuffer. Major modes such as Dired or | ||
| 207 | Rmail that do not allow self-insertion of text can reasonably redefine | ||
| 208 | letters and other printing characters as special commands. | ||
| 201 | 209 | ||
| 202 | @item | 210 | @item |
| 203 | Major modes must not define @key{RET} to do anything other than insert | 211 | Major modes must not define @key{RET} to do anything other than insert |