emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116020: Fix rst-mode deprecated keybindings


From: Daniel Colascione
Subject: [Emacs-diffs] trunk r116020: Fix rst-mode deprecated keybindings
Date: Mon, 13 Jan 2014 23:50:28 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116020
revision-id: address@hidden
parent: address@hidden
committer: Daniel Colascione <address@hidden>
branch nick: trunk
timestamp: Mon 2014-01-13 15:50:20 -0800
message:
  Fix rst-mode deprecated keybindings
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/textmodes/rst.el          rst.el-20091113204419-o5vbwnq5f7feedwu-8690
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-01-13 22:13:44 +0000
+++ b/lisp/ChangeLog    2014-01-13 23:50:20 +0000
@@ -1,3 +1,9 @@
+2014-01-13  Daniel Colascione  <address@hidden>
+
+       * 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  <address@hidden>
 
        * simple.el (define-alternatives): Call the selected command

=== modified file 'lisp/textmodes/rst.el'
--- a/lisp/textmodes/rst.el     2014-01-06 03:58:59 +0000
+++ b/lisp/textmodes/rst.el     2014-01-13 23:50:20 +0000
@@ -611,17 +611,28 @@
 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)))
 


reply via email to

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