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

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

[elpa] 70/287: Fix most global-set-key after issues


From: Matthew Fidler
Subject: [elpa] 70/287: Fix most global-set-key after issues
Date: Wed, 02 Jul 2014 14:44:42 +0000

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

commit 76ea8ef15f82e7e56d9545a14b519571aa83b19c
Author: Matthew L. Fidler <address@hidden>
Date:   Wed Jun 11 12:11:37 2014 -0500

    Fix most global-set-key after issues
---
 ergoemacs-advices.el   |   11 +++++++-
 ergoemacs-mode.el      |   66 +++++++++++------------------------------------
 ergoemacs-shortcuts.el |    9 ++++--
 ergoemacs-test.el      |    1 -
 4 files changed, 32 insertions(+), 55 deletions(-)

diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index eb4fbec..acd50b9 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -105,7 +105,16 @@ Also adds keymap-flag for user-defined keys run with 
`run-mode-hooks'."
           (delete (key-description key) ergoemacs-global-not-changed-cache))
         (add-to-list 'ergoemacs-global-override-rm-keys key)
         (when (and (boundp 'ergoemacs-mode) ergoemacs-mode)
-          (ergoemacs-theme-remove-key-list (list key) t))))))
+          (setq ergoemacs-shortcut-keymap (ergoemacs-rm-key 
ergoemacs-shortcut-keymap key)
+                ergoemacs-read-input-keymap (ergoemacs-rm-key 
ergoemacs-read-input-keymap key)
+                ergoemacs-keymap (ergoemacs-rm-key ergoemacs-keymap key)
+                ergoemacs-unbind-keymap (ergoemacs-rm-key ergoemacs-keymap 
key))
+          (setq ergoemacs-read-emulation-mode-map-alist
+                (list (cons 'ergoemacs-read-input-keys 
ergoemacs-read-input-keymap))
+                ergoemacs-emulation-mode-map-alist
+                (append (nbutlast ergoemacs-emulation-mode-map-alist 1)
+                        (list (cons 'ergoemacs-shortcut-keys 
ergoemacs-shortcut-keymap))))
+          (ergoemacs-shuffle-keys t))))))
 
 (defadvice local-set-key (around ergoemacs-local-set-key-advice (key command) 
activate)
   "This let you use `local-set-key' as usual when `ergoemacs-mode' is enabled."
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index df87470..20c2d8b 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -81,7 +81,7 @@
       (let ((temp-map keymap))
         (ergoemacs-debug "%s" (substitute-command-keys "\\{temp-map}")))
     (ergoemacs-debug-heading "%s"
-     (format "Keymap Description: %s" (symbol-name keymap)))
+                             (format "Keymap Description: %s" (symbol-name 
keymap)))
     (ergoemacs-debug "%s" (substitute-command-keys (format "\\{%s}" 
(symbol-name keymap))))))
 
 (defvar ergoemacs-debug-heading-start-time (float-time))
@@ -127,9 +127,10 @@
   (save-excursion
     (with-current-buffer (get-buffer-create ergoemacs-debug-buffer) 
       (goto-char (point-max))
+      (unless (looking-back "\n")
+        (insert "\n"))
       (insert ergoemacs-debug)
-      (delete-region (save-excursion (skip-chars-backward "\n\t ") (point)) 
(point))
-      (insert "\n")))
+      (delete-region (save-excursion (skip-chars-backward "\n\t ") (point)) 
(point))))
   (setq ergoemacs-debug ""))
 
 ;; Include extra files
@@ -560,24 +561,6 @@ bindings the keymap is:
 (defvar ergoemacs-local-keymap nil
   "Local ergoemacs keymap")
 
-(defun ergoemacs-local-set-key (key command)
-  "Set a key in the ergoemacs local map."
-  ;; install keymap if not already installed
-  (interactive)
-  (unless ergoemacs-local-keymap
-    (set (make-local-variable 'ergoemacs-local-keymap) (make-sparse-keymap)))
-  (let (major)
-    (eval (macroexpand `(setq major ',(intern (format 
"ergoemacs--emulation-for-%s-local" major-mode)))))
-    (set (make-local-variable major) t)
-    (progn
-      ;; add key
-      (define-key ergoemacs-local-keymap key command)
-      (ergoemacs-add-emulation major ergoemacs-local-keymap))))
-
-(defun ergoemacs-local-unset-key (key)
-  "Unset a key in the ergoemacs local map."
-  (ergoemacs-local-set-key key nil))
-
 
 
 (unless (featurep 'ergoemacs-advices)
@@ -672,36 +655,19 @@ However instead of using M-a `eval-buffer', you could use 
M-a `eb'"
       (setq ergoemacs-shortcut-keys nil)
       (ergoemacs-debug "WARNING: ergoemacs-shortcut-keys was turned on; 
Turning off."))))
 
-(defun ergoemacs-add-emulation (&optional var keymap keymap-list)
-  "Add emulation map
-VAR is the emulation map variable
-KEYMAP is the emulation map keymap
-KEYMAP-LIST is a list of emulation maps.
-This is added to `ergoemacs-emulation-mode-map-alist' while keeping the order 
correct."
-  (let ((small-emulation ergoemacs-emulation-mode-map-alist))
-    (while (memq (car (car small-emulation))
-                 '(ergoemacs-modal
-                   ergoemacs-repeat-keys
-                   ergoemacs-read-input-keys))
-      (pop small-emulation))
-    (when (eq (car (nth (- (length small-emulation) 1) small-emulation))
-              'ergoemacs-shortcut-keys)
-      (setq small-emulation (nbutlast small-emulation 1)))
-    (when (and var keymap)
-      (setq x (assq var small-emulation))
-      (when x
-        (delq x small-emulation))
-      (push (cons var keymap) small-emulation))
-    (when (listp keymap-list)
-      (setq small-emulation (append keymap-list small-emulation)))
-    (setq ergoemacs-emulation-mode-map-alist
-          `(,@small-emulation
-            (ergoemacs-shortcut-keys ,@(or ergoemacs-shortcut-keymap 
(make-sparse-keymap)))))))
-
-(defun ergoemacs-shuffle-keys (&optional var keymap keymap-list)
+(defun ergoemacs-shuffle-keys (&optional force-update)
   "Shuffle ergoemacs keymaps in `minor-mode-map-alist'."
-  (let ((x (assq 'ergoemacs-unbind-keys minor-mode-map-alist)))
-    (setq minor-mode-map-alist (append (delq x minor-mode-map-alist) (list 
x)))))
+  (when (or force-update (not (eq (car (nth 0 minor-mode-map-alist)) 
'ergoemacs-mode)))
+    (let ((x (assq 'ergoemacs-mode minor-mode-map-alist)))
+      (when x
+        (setq minor-mode-map-alist (delq x minor-mode-map-alist)))
+      (push (cons 'ergoemacs-mode ergoemacs-keymap) minor-mode-map-alist)))
+  (when (or force-update (not (eq (car (nth (- 1 (length 
minor-mode-map-alist)) minor-mode-map-alist)) 'ergoemacs-unbind-keys)))
+    (let ((x (assq 'ergoemacs-unbind-keys minor-mode-map-alist)))
+      (when x
+        (setq minor-mode-map-alist (delq x minor-mode-map-alist)))
+      (setq minor-mode-map-alist (append minor-mode-map-alist
+                                         (list (cons 'ergoemacs-unbind-keys 
ergoemacs-unbind-keymap)))))))
 
 (defun ergoemacs-is-movement-command-p (command)
   "Determines if COMMAND is a movement command.
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index 0898a94..d764daa 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -1740,11 +1740,14 @@ If MAP is nil, base this on a sparse keymap."
         (ergoemacs-orig-keymap
          (if map
              (copy-keymap map) nil))
-        overall-keymaps
+        shortcut-list
         fn-lst)
-    (setq overall-keymaps (ergoemacs-theme-keymaps ergoemacs-theme))
+    (maphash
+     (lambda (key item)
+       (push (list key item) shortcut-list))
+     ergoemacs-command-shortcuts-hash)
     (ergoemacs-theme--install-shortcuts-list
-     (nth 3 overall-keymaps) ergoemacs-shortcut-override-keymap 
+     shortcut-list ergoemacs-shortcut-override-keymap 
      ergoemacs-orig-keymap (not dont-complete))
     ergoemacs-shortcut-override-keymap))
 
diff --git a/ergoemacs-test.el b/ergoemacs-test.el
index a570aee..42bde6b 100644
--- a/ergoemacs-test.el
+++ b/ergoemacs-test.el
@@ -445,7 +445,6 @@ Test next and prior translation."
     (setq ergoemacs-theme nil)
     (setq ergoemacs-keyboard-layout "colemak")
     (ergoemacs-mode 1)
-    (ergoemacs-for-isearch-mode-hook)
     (setq ret (lookup-key isearch-mode-map (read-kbd-macro
                                   (format "<%s> s"
                                   (if (eq system-type 'windows-nt)



reply via email to

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