emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/etc/NEWS


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/etc/NEWS
Date: Wed, 06 Feb 2002 18:08:22 -0500

Index: emacs/etc/NEWS
diff -c emacs/etc/NEWS:1.589 emacs/etc/NEWS:1.590
*** emacs/etc/NEWS:1.589        Wed Feb  6 13:42:56 2002
--- emacs/etc/NEWS      Wed Feb  6 18:08:22 2002
***************
*** 136,141 ****
--- 136,162 ----
  The info-search bindings on C-h C-f, C-h C-k and C-h C-i
  have been moved to C-h F, C-h K and C-h S.
  
+ C-h c, C-h k, C-h w, and C-h f now handle remapped interactive commands.
+ 
+ - C-h c and C-h k report the actual command (after possible remapping)
+   run by the key sequence.
+ 
+ - C-h w and C-h f on a command which has been remapped now report the
+   command it is remapped to, and the keys which can be used to run
+   that command.
+ 
+ For example, if C-k is bound to kill-line, and kill-line is remapped
+ to new-kill-line, these commands now report: 
+ 
+ - C-h c and C-h k C-k reports:
+   C-k runs the command new-kill-line
+ 
+ - C-h w and C-h f kill-line reports:
+   kill-line is remapped to new-kill-line which is on C-k, <deleteline>
+ 
+ - C-h w and C-h f new-kill-line reports:
+   new-kill-line is on C-k
+ 
  ** C-w in incremental search now grabs either a character or a word,
  making the decision in a heuristic way.  This new job is done by the
  command `isearch-yank-word-or-char'.  To restore the old behavior,
***************
*** 415,420 ****
--- 436,501 ----
  
  
  * Lisp Changes in Emacs 21.3
+ 
+ ** Interactive commands can be remapped through keymaps.
+ 
+ This is an alternative to using defadvice or substitute-key-definition
+ to modify the behaviour of a key binding using the normal keymap
+ binding and lookup functionality.
+ 
+ When a key sequence is bound to a command, and that command is
+ remapped to another command, that command is run instead of the
+ original command.
+ 
+ Example:
+ Suppose that minor mode my-mode has defined the commands
+ my-kill-line and my-kill-word, and it wants C-k (and any other key
+ bound to kill-line) to run the command my-kill-line instead of
+ kill-line, and likewise it wants to run my-kill-word instead of
+ kill-word.
+ 
+ Instead of rebinding C-k and the other keys in the minor mode map,
+ command remapping allows you to directly map kill-line into
+ my-kill-line and kill-word into my-kill-word through the minor mode
+ map using define-key:
+ 
+    (define-key my-mode-map 'kill-line 'my-kill-line)
+    (define-key my-mode-map 'kill-word 'my-kill-word)
+ 
+ Now, when my-mode is enabled, and the user enters C-k or M-d,
+ the commands my-kill-line and my-kill-word are run.
+ 
+ Notice that only one level of remapping is supported.  In the above
+ example, this means that if my-kill-line is remapped to other-kill,
+ then C-k still runs my-kill-line.
+ 
+ The following changes have been made to provide command remapping:
+ 
+ - define-key now accepts a command name as the KEY argument.
+   This identifies the command to be remapped in the specified keymap.
+   This is equivalent to specifying the command name as the only
+   element of a vector, e.g [kill-line], except that when KEY is a
+   symbol, the DEF argument must also be a symbol.
+ 
+ - In calls from Lisp, global-set-key, global-unset-key, local-set-key,
+   and local-unset-key also accept a command name as the KEY argument.
+ 
+ - key-binding now remaps interactive commands unless the optional
+   third argument NO-REMAP is non-nil.  It also accepts a command name
+   as the KEY argument.
+ 
+ - lookup-key now accepts a command name as the KEY argument.
+ 
+ - where-is-internal now returns nil for a remapped command (e.g.
+   kill-line if my-mode is enabled), and the actual key binding for
+   the command it is remapped to (e.g. C-k for my-kill-line).
+   It also has a new optional fifth argument, NO-REMAP, which inhibits
+   remapping if non-nil (e.g. it returns C-k for kill-line and
+   <kill-line> for my-kill-line).
+ 
+ - The new variable `this-original-command' contains the original
+   command before remapping.  It is equal to `this-command' when the
+   command was not remapped.
  
  ** Atomic change groups.
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]