aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS81
-rw-r--r--lisp/ChangeLog9
-rw-r--r--src/ChangeLog22
3 files changed, 112 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index ba34f61de66..3cd41801aff 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -136,6 +136,27 @@ C-h C-e displays the PROBLEMS file.
136The info-search bindings on C-h C-f, C-h C-k and C-h C-i 136The info-search bindings on C-h C-f, C-h C-k and C-h C-i
137have been moved to C-h F, C-h K and C-h S. 137have been moved to C-h F, C-h K and C-h S.
138 138
139C-h c, C-h k, C-h w, and C-h f now handle remapped interactive commands.
140
141- C-h c and C-h k report the actual command (after possible remapping)
142 run by the key sequence.
143
144- C-h w and C-h f on a command which has been remapped now report the
145 command it is remapped to, and the keys which can be used to run
146 that command.
147
148For example, if C-k is bound to kill-line, and kill-line is remapped
149to new-kill-line, these commands now report:
150
151- C-h c and C-h k C-k reports:
152 C-k runs the command new-kill-line
153
154- C-h w and C-h f kill-line reports:
155 kill-line is remapped to new-kill-line which is on C-k, <deleteline>
156
157- C-h w and C-h f new-kill-line reports:
158 new-kill-line is on C-k
159
139** C-w in incremental search now grabs either a character or a word, 160** C-w in incremental search now grabs either a character or a word,
140making the decision in a heuristic way. This new job is done by the 161making the decision in a heuristic way. This new job is done by the
141command `isearch-yank-word-or-char'. To restore the old behavior, 162command `isearch-yank-word-or-char'. To restore the old behavior,
@@ -416,6 +437,66 @@ SQL buffer.
416 437
417* Lisp Changes in Emacs 21.3 438* Lisp Changes in Emacs 21.3
418 439
440** Interactive commands can be remapped through keymaps.
441
442This is an alternative to using defadvice or substitute-key-definition
443to modify the behaviour of a key binding using the normal keymap
444binding and lookup functionality.
445
446When a key sequence is bound to a command, and that command is
447remapped to another command, that command is run instead of the
448original command.
449
450Example:
451Suppose that minor mode my-mode has defined the commands
452my-kill-line and my-kill-word, and it wants C-k (and any other key
453bound to kill-line) to run the command my-kill-line instead of
454kill-line, and likewise it wants to run my-kill-word instead of
455kill-word.
456
457Instead of rebinding C-k and the other keys in the minor mode map,
458command remapping allows you to directly map kill-line into
459my-kill-line and kill-word into my-kill-word through the minor mode
460map using define-key:
461
462 (define-key my-mode-map 'kill-line 'my-kill-line)
463 (define-key my-mode-map 'kill-word 'my-kill-word)
464
465Now, when my-mode is enabled, and the user enters C-k or M-d,
466the commands my-kill-line and my-kill-word are run.
467
468Notice that only one level of remapping is supported. In the above
469example, this means that if my-kill-line is remapped to other-kill,
470then C-k still runs my-kill-line.
471
472The following changes have been made to provide command remapping:
473
474- define-key now accepts a command name as the KEY argument.
475 This identifies the command to be remapped in the specified keymap.
476 This is equivalent to specifying the command name as the only
477 element of a vector, e.g [kill-line], except that when KEY is a
478 symbol, the DEF argument must also be a symbol.
479
480- In calls from Lisp, global-set-key, global-unset-key, local-set-key,
481 and local-unset-key also accept a command name as the KEY argument.
482
483- key-binding now remaps interactive commands unless the optional
484 third argument NO-REMAP is non-nil. It also accepts a command name
485 as the KEY argument.
486
487- lookup-key now accepts a command name as the KEY argument.
488
489- where-is-internal now returns nil for a remapped command (e.g.
490 kill-line if my-mode is enabled), and the actual key binding for
491 the command it is remapped to (e.g. C-k for my-kill-line).
492 It also has a new optional fifth argument, NO-REMAP, which inhibits
493 remapping if non-nil (e.g. it returns C-k for kill-line and
494 <kill-line> for my-kill-line).
495
496- The new variable `this-original-command' contains the original
497 command before remapping. It is equal to `this-command' when the
498 command was not remapped.
499
419** Atomic change groups. 500** Atomic change groups.
420 501
421To perform some changes in the current buffer "atomically" so that 502To perform some changes in the current buffer "atomically" so that
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f71e1beb4ef..64d044d9e1b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12002-02-06 Kim F. Storm <storm@cua.dk>
2
3 * help.el (where-is): Report remapped commands.
4
5 * help-fns.el (describe-function-1): Ditto.
6
7 * subr.el (global-set-key, local-set-key): Accept a symbol for the
8 KEY argument (like define-key).
9
12002-02-06 Pavel Jan,Bm(Bk <Pavel@Janik.cz> 102002-02-06 Pavel Jan,Bm(Bk <Pavel@Janik.cz>
2 11
3 * textmodes/flyspell.el (flyspell-insert-function): Doc fix. 12 * textmodes/flyspell.el (flyspell-insert-function): Doc fix.
diff --git a/src/ChangeLog b/src/ChangeLog
index 0c5d745360e..8c52b05f8f0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12002-02-06 Kim F. Storm <storm@cua.dk>
2
3 * keymap.c (Fdefine_key): Allow symbol as KEY argument for
4 defining command remapping. Doc updated.
5 (Flookup_key): Remap command through keymap if KEY is a symbol.
6 (is_command_symbol): New function.
7 (Fkey_binding): Use it. New optional argument NO-REMAP. Doc
8 updated. Callers changed. Perform command remapping via
9 recursive call unless that arg is non-nil.
10 (where_is_internal): New argument no_remap. Callers changed.
11 Call recursively to find original key bindings for a remapped
12 comand unless that arg is non-nil.
13 (Fwhere_is_internal): New optional argument NO-REMAP. Doc
14 updated. Callers changed. Pass arg to where_is_internal.
15
16 * keymap.h (Fkey_binding, Fwhere_is_internal): Update prototype.
17 (is_command_symbol): Added prototype.
18
19 * keyboard.c (Vthis_original_command): New variable.
20 (syms_of_keyboard): DEFVAR_LISP it.
21 (command_loop_1): Set it, and perform command remapping.
22
12002-02-06 Pavel Jan,Bm(Bk <Pavel@Janik.cz> 232002-02-06 Pavel Jan,Bm(Bk <Pavel@Janik.cz>
2 24
3 * keyboard.c (recursive_edit_1): Call cancel_hourglass 25 * keyboard.c (recursive_edit_1): Call cancel_hourglass