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

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

[elpa] externals/ergoemacs-mode 87b722e 251/325: Make calculate ergoemac


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode 87b722e 251/325: Make calculate ergoemacs bindings an interactive function
Date: Sat, 23 Oct 2021 18:49:04 -0400 (EDT)

branch: externals/ergoemacs-mode
commit 87b722e4b2cf1c33e0a29d90d632f7249bbd69a4
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>

    Make calculate ergoemacs bindings an interactive function
---
 ergoemacs-calculate-bindings.el | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/ergoemacs-calculate-bindings.el b/ergoemacs-calculate-bindings.el
index b11f0a0..745bc94 100644
--- a/ergoemacs-calculate-bindings.el
+++ b/ergoemacs-calculate-bindings.el
@@ -116,8 +116,7 @@ SPACE represents the amount of sacing to add"
     (let* ((command (nth 1 elt))
            (key (nth 0 elt))
            (key-code (read-kbd-macro key))
-           (bind (lookup-key (symbol-value keymap) key-code))
-           ergoemacs-command)
+           (bind (lookup-key (symbol-value keymap) key-code)))
       (when bind
         (dolist (ergoemacs-command (where-is-internal command 
ergoemacs-override-keymap nil t t))
           (insert (format "%s(ergoemacs-define-key %s (kbd \"%s\") '%s)" space 
(symbol-name keymap)
@@ -127,6 +126,31 @@ SPACE represents the amount of sacing to add"
 
 (defvar ergoemacs-calculate-bindings-for-both-theme--tmp nil)
 (defun ergoemacs-calculate-bindings-for-both-themes (keymap)
+  "Calculates ergoemacs-style bindings for KEYMAP."
+  (interactive
+   (let ((v (variable-at-point))
+            (enable-recursive-minibuffers t)
+         (orig-buffer (current-buffer))
+            val)
+     (setq val (completing-read
+                (if (and (symbolp v) (keymapp (symbol-value v)))
+                    (format
+                     "Calculate egoemacs-mode keybindings for keymap (default 
%s): " v)
+                  "Calculate ergoemacs-mode keybindings: ")
+                #'help--symbol-completion-table
+                (lambda (vv)
+                  ;; In case the variable only exists in the buffer
+                  ;; the command we switch back to that buffer before
+                  ;; we examine the variable.
+                  (with-current-buffer orig-buffer
+                    (and (boundp vv) (keymapp (symbol-value vv)))))
+                t nil nil
+                (if (and (symbolp v) (keymapp (symbol-value v)))
+                    (symbol-name v))))
+     (list (if (equal val "")
+                  v (intern val)))))
+  (when (stringp v)
+    (error "This funcion requires a keymap"))
   (setq ergoemacs-calculate-bindings-for-both-theme--tmp
         (copy-keymap ergoemacs-override-keymap)
         ergoemacs-override-keymap (make-sparse-keymap))



reply via email to

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