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

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

[elpa] 63/117: Attempt to fix Issue #278


From: Matthew Fidler
Subject: [elpa] 63/117: Attempt to fix Issue #278
Date: Fri, 25 Jul 2014 13:24:16 +0000

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

commit 2d31a0e7556a5c0a3b2046735c4908f8f1c0a8cd
Author: Matthew L. Fidler <address@hidden>
Date:   Fri Jul 18 08:33:53 2014 -0500

    Attempt to fix Issue #278
---
 ergoemacs-mode.el         |   11 +++++----
 ergoemacs-theme-engine.el |   55 +++++++++++++++++++++++++++++++-------------
 ergoemacs-themes.el       |    3 ++
 3 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index 6c01116..4e28cd7 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -696,11 +696,6 @@ This is done by checking if this is a command that 
supports shift selection or c
 (declare-function ergoemacs-install-shortcuts-up "ergoemacs-shortcuts.el")
 (defun ergoemacs-pre-command-hook ()
   "Ergoemacs pre-command-hook."
-  (dolist (item ergoemacs-first-keymaps)
-    (let ((hook (car item)))
-      (dolist (fn (cdr item))
-        (remove-hook hook fn)
-        (add-hook hook fn))))
   (when (and ergoemacs-mark-active
              (not ergoemacs-read-input-keys)
              (not mark-active))
@@ -767,6 +762,12 @@ This is done by checking if this is a command that 
supports shift selection or c
     (condition-case err
         (progn
           (when ergoemacs-mode
+            (dolist (item ergoemacs-first-keymaps)
+              (let ((hook (car item)))
+                (unless (ignore-errors (keymapp (symbol-value hook)))
+                  (dolist (fn (cdr item))
+                    (remove-hook hook fn)
+                    (add-hook hook fn)))))
             (setq ergoemacs-shortcut-keys t)
             (setq ergoemacs-no-shortcut-keys nil)
             (ergoemacs-shuffle-keys)
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 8d474b4..d5eacc0 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -1359,7 +1359,6 @@ If it is not a composed KEYMAP, return the keymap as is."
                          full-map
                          always
                          first
-                         cmd-list
                          deferred-keys) (ergoemacs-get-fixed-map obj map-name)
               (cond
                ((and modify-map always)
@@ -1372,19 +1371,32 @@ If it is not a composed KEYMAP, return the keymap as 
is."
                   (fset fn-name
                         `(lambda() ,(format "Turn on `ergoemacs-mode' for `%s' 
during the hook `%s'."
                                        (symbol-name map-name) (symbol-name 
hook))
-                           (let ((new-map ',map))
-                             (ergoemacs-theme--install-shortcuts-list 
-                              ',(reverse shortcut-list) new-map ,map-name 
,full-map)
-                             (dolist (item ',deferred-keys) ; Install deferred 
keys now.
-                               (catch 'found-bound-command
-                                 (dolist (fn (nth 1 item))
-                                   (when (commandp fn t)
-                                     (define-key new-map (nth 0 item) fn)
-                                     (throw 'found-bound-command t)))))
-                             (setq new-map (ergoemacs-flatten-composed-keymap 
(make-composed-keymap new-map ,map-name)))
-                             ;; Try to modify in place, without any
-                             ;; copying of keymaps.
-                             (ergoemacs-flatten-composed-keymap--define-key 
new-map ,map-name))))
+                           (dolist (map ergoemacs-first-keymaps)
+                             (when (eq (car map) ',map-name)
+                               (dolist (fn (cdr map))
+                                 (unless (eq fn ',fn-name)
+                                   (funcall fn)))))
+                           (message ,(format "Run %s" (symbol-name fn-name)))
+                           (unless (and ,(and first (ergoemacs-is-first-p obj 
hook map-name))
+                                        (eq (lookup-key ,map-name [,map-name]) 
'ignore))  
+                             (let ((new-map ',map))
+                               (ergoemacs-theme--install-shortcuts-list 
+                                ',(reverse shortcut-list) new-map ,map-name 
,full-map)
+                               (dolist (item ',deferred-keys) ; Install 
deferred keys now.
+                                 (catch 'found-bound-command
+                                   (dolist (fn (nth 1 item))
+                                     (when (commandp fn t)
+                                       (define-key new-map (nth 0 item) fn)
+                                       (throw 'found-bound-command t)))))
+                               (setq new-map 
(ergoemacs-flatten-composed-keymap (make-composed-keymap new-map ,map-name)))
+                               ;; Try to modify in place, without any
+                               ;; copying of keymaps.
+                               (ergoemacs-flatten-composed-keymap--define-key 
new-map ,map-name)
+                               ,(when (and first (ergoemacs-is-first-p obj 
hook map-name))
+                                  `(define-key ,map-name [,map-name] 'ignore))
+                               ;; ,(when (eq hook 
'iswitchb-minibuffer-setup-hook)
+                               ;;    `(message "%s" (substitute-command-keys 
"\\{minibuffer-local-map}")))
+                               ))))
                   (funcall (if remove-p #'remove-hook #'add-hook) hook
                            fn-name)
                   (when (and first (not remove-p)
@@ -1398,7 +1410,17 @@ If it is not a composed KEYMAP, return the keymap as is."
                                  (append (list hook fn-name) (cdr x))))
                              ergoemacs-first-keymaps))
                       (unless found
-                        (push (list hook fn-name) ergoemacs-first-keymaps))))))
+                        (push (list hook fn-name) ergoemacs-first-keymaps))
+                      (setq found nil)
+                      (setq ergoemacs-first-keymaps
+                            (mapcar
+                             (lambda(x)
+                               (if (not (eq (car x) map-name)) x
+                                 (setq found t)
+                                 (append (list map-name fn-name) (cdr x))))
+                             ergoemacs-first-keymaps))
+                      (unless found
+                        (push (list map-name fn-name) 
ergoemacs-first-keymaps))))))
                ((and modify-map (not (boundp map-name)))
                 (pushnew (list map-name full-map map deferred-keys) 
ergoemacs-deferred-maps))
                ((and modify-map (boundp map-name))
@@ -1457,7 +1479,8 @@ The actual keymap changes are included in 
`ergoemacs-emulation-mode-map-alist'."
                            ergoemacs-first-keymaps))
                     (unless found
                       (push (list hook emulation-var)
-                            ergoemacs-first-keymaps))))))))
+                            ergoemacs-first-keymaps))
+                    (setq found nil)))))))
           (unless (equal tmp '())
             (unless (eq defer '())
               (push (cons i defer) ergoemacs-deferred-keys))
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 7223333..482665b 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -471,6 +471,7 @@
   (when iswitchb-define-mode-map-hook
     :always t
     :modify-map t
+    :run-hook minibuffer-setup-hook
     (define-key iswitchb-mode-map (kbd "<f11>") 'iswitchb-prev-match)
     (define-key iswitchb-mode-map (kbd "<f12>") 'iswitchb-next-match)
     (define-key iswitchb-mode-map (kbd "S-<f11>") 'iswitchb-prev-match)
@@ -580,6 +581,7 @@
   (when iswitchb-define-mode-map-hook 
     :always t
     :modify-keymap t
+    :run-hook minibuffer-setup-hook
     (define-key iswitchb-mode-map (kbd "M-j") 'iswitchb-prev-match)
     (define-key iswitchb-mode-map (kbd "M-l") 'iswitchb-next-match)))
 
@@ -791,6 +793,7 @@
   (when iswitchb-define-mode-map-hook
     :modify-map t
     :always t
+    :run-hook minibuffer-setup-hook
     (define-key iswitchb-mode-map (kbd "M-?") 'iswitchb-toggle-case)
     (define-key iswitchb-mode-map (kbd "M-/") 'iswitchb-toggle-regexp)))
 



reply via email to

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