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

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

[elpa] 45/287: Fix ergoemacs-describe-key


From: Matthew Fidler
Subject: [elpa] 45/287: Fix ergoemacs-describe-key
Date: Wed, 02 Jul 2014 14:44:29 +0000

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

commit def72c96a8243d72d83b0ecbe047a9bee4af47fc
Author: Matthew L. Fidler <address@hidden>
Date:   Wed Jun 4 14:58:06 2014 -0500

    Fix ergoemacs-describe-key
---
 ergoemacs-shortcuts.el |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index 3602f26..fc03163 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -162,7 +162,7 @@ equivalent is <apps> f M-k.  When enabled, pressing this 
should also perfomr `ou
 (defvar ergoemacs-describe-key nil)
 (defun ergoemacs-describe-key ()
   "Ergoemacs replacement for `describe-key'
-Uses `ergoemacs-read'"
+Uses `ergoemacs-read-key'"
   (interactive)
   (setq ergoemacs-describe-key t)
   (ergoemacs-read-key nil 'normal))
@@ -651,8 +651,44 @@ In addition, when the function is called:
    ((and (boundp 'ergoemacs-test-fn) ergoemacs-test-fn)
     (setq ergoemacs-test-fn function))
    (ergoemacs-describe-key
-    (describe-key key)
-    (setq ergoemacs-describe-key nil))
+    (let ((pt (point))
+          (buf (current-buffer))
+          (keys '())
+          test)
+      (unwind-protect
+          (save-excursion
+            (describe-function function)
+            (set-buffer (help-buffer))
+            (let ((inhibit-read-only t))
+              (goto-char (point-min))
+              (insert (format "%s runs the command "
+                              (ergoemacs-pretty-key (key-description key))))
+              (when (search-forward " is" nil t)
+                (replace-match ", which is"))
+              (fill-paragraph)
+              (when (search-forward "bound to" nil t)
+                (delete-region
+                 (point)
+                 (if (re-search-forward "\\.\n\n") (point) (point)))
+                (save-excursion
+                  (set-buffer buf)
+                  (goto-char pt)
+                  (ergoemacs-with-global
+                   (dolist (global-key (where-is-internal function))
+                     (setq test (gethash global-key 
ergoemacs-original-keys-to-shortcut-keys))
+                     (when test
+                       (unless (eq (elt test 0) 'menu-bar)
+                         (push (ergoemacs-pretty-key (key-description test))
+                             keys)))))
+                  (let (ergoemacs-modal ergoemacs-repeat-keys 
ergoemacs-read-input-keys
+                                        ergoemacs-shortcut-keys)
+                    (dolist (global-key (where-is-internal function))
+                      (unless (eq (elt global-key 0) 'menu-bar)
+                        (push (ergoemacs-pretty-key (key-description 
global-key))
+                            keys)))))
+                (insert (mapconcat (lambda(x) x) keys ", "))
+                (insert ".\n\n"))))
+        (setq ergoemacs-describe-key nil))))
    ((condition-case err
         (string-match "self-insert" (symbol-name function))
       (error nil))



reply via email to

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