Commit c176054f authored by Daniel Colascione's avatar Daniel Colascione
Browse files

Fix rst-mode deprecated keybindings

parent 1b49bd5d
2014-01-13 Daniel Colascione <dancol@dancol.org>
* textmodes/rst.el (rst-define-key): Provide deprecated
keybindings through named functions instead of anonymous ones so
that "??" doesn't appear in describe-mode output.
2014-01-13 Bastien Guerry <bzg@gnu.org> 2014-01-13 Bastien Guerry <bzg@gnu.org>
* simple.el (define-alternatives): Call the selected command * simple.el (define-alternatives): Call the selected command
......
...@@ -611,17 +611,28 @@ KEYMAP, KEY, and DEF are as in `define-key'. DEPRECATED key ...@@ -611,17 +611,28 @@ KEYMAP, KEY, and DEF are as in `define-key'. DEPRECATED key
definitions should be in vector notation. These are defined as definitions should be in vector notation. These are defined as
well but give an additional message." well but give an additional message."
(define-key keymap key def) (define-key keymap key def)
(dolist (dep-key deprecated) (when deprecated
(define-key keymap dep-key (let* ((command-name (symbol-name def))
`(lambda () (forwarder-function-name
,(format "Deprecated binding for %s, use \\[%s] instead." def def) (if (string-match "^rst-\\(.*\\)$" command-name)
(interactive) (concat "rst-deprecated-"
(call-interactively ',def) (match-string 1 command-name))
(message "[Deprecated use of key %s; use key %s instead]" (error "not an RST command: %s" command-name)))
(key-description (this-command-keys)) (forwarder-function (intern forwarder-function-name)))
(key-description ,key)))))) (unless (fboundp forwarder-function)
(defalias forwarder-function
;; Key bindings. (lexical-let ((key key) (def def))
(lambda ()
(interactive)
(call-interactively def)
(message "[Deprecated use of key %s; use key %s instead]"
(key-description (this-command-keys))
(key-description key))))
(format "Deprecated binding for %s, use \\[%s] instead."
def def)))
(dolist (dep-key deprecated)
(define-key keymap dep-key forwarder-function)))))
;; Key bindings.
(defvar rst-mode-map (defvar rst-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment