136 |
The info-search bindings on C-h C-f, C-h C-k and C-h C-i |
The info-search bindings on C-h C-f, C-h C-k and C-h C-i |
137 |
have been moved to C-h F, C-h K and C-h S. |
have been moved to C-h F, C-h K and C-h S. |
138 |
|
|
139 |
|
C-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 |
|
|
148 |
|
For example, if C-k is bound to kill-line, and kill-line is remapped |
149 |
|
to 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 |
|
|
160 |
** C-w in incremental search now grabs either a character or a word, |
** C-w in incremental search now grabs either a character or a word, |
161 |
making the decision in a heuristic way. This new job is done by the |
making the decision in a heuristic way. This new job is done by the |
162 |
command `isearch-yank-word-or-char'. To restore the old behavior, |
command `isearch-yank-word-or-char'. To restore the old behavior, |
437 |
|
|
438 |
* Lisp Changes in Emacs 21.3 |
* Lisp Changes in Emacs 21.3 |
439 |
|
|
440 |
|
** Interactive commands can be remapped through keymaps. |
441 |
|
|
442 |
|
This is an alternative to using defadvice or substitute-key-definition |
443 |
|
to modify the behaviour of a key binding using the normal keymap |
444 |
|
binding and lookup functionality. |
445 |
|
|
446 |
|
When a key sequence is bound to a command, and that command is |
447 |
|
remapped to another command, that command is run instead of the |
448 |
|
original command. |
449 |
|
|
450 |
|
Example: |
451 |
|
Suppose that minor mode my-mode has defined the commands |
452 |
|
my-kill-line and my-kill-word, and it wants C-k (and any other key |
453 |
|
bound to kill-line) to run the command my-kill-line instead of |
454 |
|
kill-line, and likewise it wants to run my-kill-word instead of |
455 |
|
kill-word. |
456 |
|
|
457 |
|
Instead of rebinding C-k and the other keys in the minor mode map, |
458 |
|
command remapping allows you to directly map kill-line into |
459 |
|
my-kill-line and kill-word into my-kill-word through the minor mode |
460 |
|
map 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 |
|
|
465 |
|
Now, when my-mode is enabled, and the user enters C-k or M-d, |
466 |
|
the commands my-kill-line and my-kill-word are run. |
467 |
|
|
468 |
|
Notice that only one level of remapping is supported. In the above |
469 |
|
example, this means that if my-kill-line is remapped to other-kill, |
470 |
|
then C-k still runs my-kill-line. |
471 |
|
|
472 |
|
The 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 |
|
|
500 |
** Atomic change groups. |
** Atomic change groups. |
501 |
|
|
502 |
To perform some changes in the current buffer "atomically" so that |
To perform some changes in the current buffer "atomically" so that |