summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorDaniel Colascione <dancol@dancol.org>2014-01-13 15:50:20 -0800
committerDaniel Colascione <dancol@dancol.org>2014-01-13 15:50:20 -0800
commitc176054fe1e2e72fb1c34d56658269361bacadd3 (patch)
treeace1ad22b97d7866f804002aab1277b9a56adfab /lisp
parent1b49bd5d72d012cd349c29822fd6985bb4e5a158 (diff)
downloademacs-c176054fe1e2e72fb1c34d56658269361bacadd3.tar.gz
emacs-c176054fe1e2e72fb1c34d56658269361bacadd3.tar.bz2
emacs-c176054fe1e2e72fb1c34d56658269361bacadd3.zip
Fix rst-mode deprecated keybindings
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/textmodes/rst.el33
2 files changed, 28 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 22a31f336ac..bd194393fef 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+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>
* simple.el (define-alternatives): Call the selected command
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index a533bdb75e3..516431006f6 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -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
well but give an additional message."
(define-key keymap key def)
- (dolist (dep-key deprecated)
- (define-key keymap dep-key
- `(lambda ()
- ,(format "Deprecated binding for %s, use \\[%s] instead." def def)
- (interactive)
- (call-interactively ',def)
- (message "[Deprecated use of key %s; use key %s instead]"
- (key-description (this-command-keys))
- (key-description ,key))))))
-
-;; Key bindings.
+ (when deprecated
+ (let* ((command-name (symbol-name def))
+ (forwarder-function-name
+ (if (string-match "^rst-\\(.*\\)$" command-name)
+ (concat "rst-deprecated-"
+ (match-string 1 command-name))
+ (error "not an RST command: %s" command-name)))
+ (forwarder-function (intern forwarder-function-name)))
+ (unless (fboundp forwarder-function)
+ (defalias forwarder-function
+ (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
(let ((map (make-sparse-keymap)))