emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 184/287: Now use ergoemacs-pretty-key to describe fn keys


From: Matthew Fidler
Subject: [elpa] 184/287: Now use ergoemacs-pretty-key to describe fn keys
Date: Wed, 02 Jul 2014 14:45:49 +0000

mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.

commit ea8b799b0715318a071ad40f4e63b27ffb2e9788
Author: Matthew L. Fidler <address@hidden>
Date:   Sat Jun 21 16:39:57 2014 -0500

    Now use ergoemacs-pretty-key to describe fn keys
---
 ergoemacs-advices.el |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index aa20178..2d5db7f 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -198,7 +198,24 @@ This assumes any key defined while running a hook is a 
user-defined hook."
   (let ((ergoemacs-run-mode-hooks t))
     ad-do-it))
 
-;;; Unfortunately, the advice route doesn't seem to work :(
+
+;;; Unfortunately, the advice route doesn't seem to work for these
+;;; functions :(
+
+;;; key-description
+(declare-function ergoemacs-real-key-description
+                  "ergoemacs-advices.el" (keys &optional prefix) t)
+(fset 'ergoemacs-real-key-description (symbol-function 'key-description))
+(defvar ergoemacs-key-description-commands '(describe-function))
+(defun ergoemacs-key-description (keys &optional prefix)
+  "Allows `describe-function' to show the `ergoemacs-pretty-key' bindings.
+Uses `ergoemacs-real-key-description'."
+  (let ((ret (ergoemacs-real-key-description keys prefix)))
+    (when (and ergoemacs-mode
+               (memq this-command ergoemacs-key-description-commands))
+      (setq ret (ergoemacs-pretty-key ret)))
+    ret))
+
 (declare-function ergoemacs-real-substitute-command-keys 
"ergoemacs-advices.el" (string) t)
 (fset 'ergoemacs-real-substitute-command-keys (symbol-function 
'substitute-command-keys))
 
@@ -220,7 +237,7 @@ will add MAP to substitution."
            (test-hash (gethash test-vect 
ergoemacs-original-keys-to-shortcut-keys)))
       (if test-hash
           (progn
-            (setq test (key-description (nth 0 test-hash)))
+            (setq test (ergoemacs-real-key-description (nth 0 test-hash)))
             (ergoemacs-pretty-key test))
         (let (ergoemacs-modal ergoemacs-repeat-keys ergoemacs-read-input-keys
                               ergoemacs-shortcut-keys)
@@ -370,7 +387,7 @@ Uses `ergoemacs-real-key-binding' to get the key-binding."
   "Enabling advices for C code and complex changes to functions.
 DISABLE when non-nil.
 Assumes ergoemacs-real-FUNCTION and ergoemacs-FUNCTION as the two functions to 
toggle"
-  (dolist (ad '(completing-read substitute-command-keys key-binding))
+  (dolist (ad '(completing-read substitute-command-keys key-binding 
key-description))
     (cond
      (disable
       (fset ad (symbol-function (intern (concat "ergoemacs-real-" (symbol-name 
ad))))))



reply via email to

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