Mercurial > hg > xemacs-beta
comparison lisp/help.el @ 5679:a81a739181dc
Add command remapping, a more robust alternative to #'substitute-key-definition
src/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea@parhasard.net>
* keymap.c:
Add command remapping, a more robust equivalent to
#'substitute-key-definition.
* keymap.c (CHECK_REMAPPING_POSITION): New.
* keymap.c (keymap_equal): Correct a comment here.
* keymap.c (Fdefine_key): Document the command remapping syntax.
* keymap.c (Fremap_command): New.
* keymap.c (command_remapping): New.
* keymap.c (Fcommand_remapping): New.
* keymap.c (commands_remapped_to_mapper): New.
* keymap.c (commands_remapped_to_traverser): New.
* keymap.c (Fcommands_remapped_to): New.
* keymap.c (get_relevant_keymaps): Take a new POSITION argument.
* keymap.c (Fcurrent_keymaps, event_binding):
Supply the new POSITION argument to get_relevant_keymaps.
* keymap.c (Fkey_binding):
Add new arguments, NO-REMAP and POSITION.
* keymap.c (map_keymap_mapper):
* keymap.c (Fwhere_is_internal):
* keymap.c (where_is_to_char):
* keymap.c (where_is_recursive_mapper):
Don't expose the key remapping in these functions. This conflicts
with GNU, but is more sane for our callers. Access to command
remapping is with the functions #'command-remapping,
#'commands-remapped-to, and #'remap-command, not with the general
keymap functions, apart from the compatibility hack in #'define-key.
* keymap.c (syms_of_keymap):
* keymap.c (vars_of_keymap):
* keymap.c (complex_vars_of_keymap):
* lisp.h: New CHECK_COMMAND macro.
man/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea@parhasard.net>
* lispref/keymaps.texi (Keymaps):
* lispref/keymaps.texi (Changing Key Bindings):
* lispref/keymaps.texi (Scanning Keymaps):
* lispref/keymaps.texi (Remapping commands):
* lispref/keymaps.texi (XEmacs): New.
* lispref/keymaps.texi (Other Keymap Functions):
Document the new command remapping functionality in this file.
lisp/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea@parhasard.net>
* help.el (describe-function-1):
Document any command remapping that has been done in this function.
tests/ChangeLog addition:
2012-09-02 Aidan Kehoe <kehoea@parhasard.net>
* automated/keymap-tests.el:
Test the new command remapping functionality.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 02 Sep 2012 14:31:40 +0100 |
parents | cc8ea7ed4286 |
children | 7371081ce8f7 |
comparison
equal
deleted
inserted
replaced
5678:b0d40183ac79 | 5679:a81a739181dc |
---|---|
1495 (let ((global-binding | 1495 (let ((global-binding |
1496 (where-is-internal function global-map)) | 1496 (where-is-internal function global-map)) |
1497 (global-tty-binding | 1497 (global-tty-binding |
1498 (where-is-internal function global-tty-map)) | 1498 (where-is-internal function global-tty-map)) |
1499 (global-window-system-binding | 1499 (global-window-system-binding |
1500 (where-is-internal function global-window-system-map))) | 1500 (where-is-internal function global-window-system-map)) |
1501 (command-remapping (command-remapping function)) | |
1502 (commands-remapped-to (commands-remapped-to function))) | |
1501 (if (or global-binding global-tty-binding | 1503 (if (or global-binding global-tty-binding |
1502 global-window-system-binding) | 1504 global-window-system-binding) |
1503 (if (and (equal global-binding | 1505 (if (and (equal global-binding |
1504 global-tty-binding) | 1506 global-tty-binding) |
1505 (equal global-binding | 1507 (equal global-binding |
1529 (princ | 1531 (princ |
1530 (format | 1532 (format |
1531 "\n%s\n -- generally (that is, unless\ | 1533 "\n%s\n -- generally (that is, unless\ |
1532 overridden by TTY- or | 1534 overridden by TTY- or |
1533 window-system-specific mappings)\n" | 1535 window-system-specific mappings)\n" |
1534 (mapconcat #'key-description | 1536 (mapconcat #'key-description global-binding |
1535 global-binding | |
1536 ", "))))) | 1537 ", "))))) |
1537 (princ (substitute-command-keys | 1538 (if command-remapping |
1538 (format "\n\\[%s]" function)))))))))))) | 1539 (progn |
1540 (princ "Its keys are remapped to `") | |
1541 (princ (symbol-name command-remapping)) | |
1542 (princ "'.\n")) | |
1543 (princ (substitute-command-keys | |
1544 (format "\n\\[%s]" function)))) | |
1545 (when commands-remapped-to | |
1546 (if (cdr commands-remapped-to) | |
1547 (princ (format "The following functions are \ | |
1548 remapped to it:\n`%s'" (mapconcat #'prin1-to-string commands-remapped-to | |
1549 "', `"))) | |
1550 (princ (format "`%s' is remapped to it.\n" | |
1551 (car | |
1552 commands-remapped-to)))))))))))))) | |
1539 | 1553 |
1540 ;;; [Obnoxious, whining people who complain very LOUDLY on Usenet | 1554 ;;; [Obnoxious, whining people who complain very LOUDLY on Usenet |
1541 ;;; are binding this to keys.] | 1555 ;;; are binding this to keys.] |
1542 (defun describe-function-arglist (function) | 1556 (defun describe-function-arglist (function) |
1543 (interactive (list (or (function-at-point) | 1557 (interactive (list (or (function-at-point) |