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

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

[elpa] 14/287: Fix `ergoemacs-populate-pre-command-hook'


From: Matthew Fidler
Subject: [elpa] 14/287: Fix `ergoemacs-populate-pre-command-hook'
Date: Wed, 02 Jul 2014 14:44:12 +0000

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

commit e9717d9ee189cf8ff3bc19ad4c1ecd62d43a64f5
Author: Matthew L. Fidler <address@hidden>
Date:   Fri May 23 22:12:13 2014 +0800

    Fix `ergoemacs-populate-pre-command-hook'
---
 ergoemacs-mode.el |   54 +++++++++++++++++++++++++++-------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index bb2735c..fbd2bea 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -771,32 +771,34 @@ These hooks are deferred to make sure `this-command' is 
set appropriately.")
 
 (defun ergoemacs-populate-pre-command-hook (&optional depopulate)
   "Populate `ergoemacs-pre-command-hook' with `pre-command-hook' values."
-  (let (do-append ergoemacs-mode)
-    (mapc
-     (lambda(item)
-       (if (eq item t)
-           (setq do-append t)
-         (unless (or depopulate (not (memq item ergoemacs-hook-functions)))
-           (add-hook 'ergoemacs-pre-command-hook item do-append nil)
-           (remove-hook 'pre-command-hook item nil))
-         (when depopulate
-           (add-hook 'pre-command-hook item do-append nil)
-           (remove-hook 'ergoemacs-pre-command-hook item do-append))))
-     (default-value (if depopulate 'ergoemacs-pre-command-hook 
'pre-command-hook)))
-    (unless (equal (default-value (if depopulate 'ergoemacs-pre-command-hook 
'pre-command-hook))
-                   (symbol-value (if depopulate 'ergoemacs-pre-command-hook 
'pre-command-hook)))
-      (setq do-append nil)
-      (mapc
-       (lambda(item)
-         (if (eq item t)
-             (setq do-append t)
-           (unless (or depopulate (not (memq item ergoemacs-hook-functions)))
-             (add-hook 'ergoemacs-pre-command-hook item do-append t)
-             (remove-hook 'pre-command-hook item t))
-           (when depopulate
-             (add-hook 'pre-command-hook item do-append t)
-             (remove-hook 'ergoemacs-pre-command-hook item t))))
-       (symbol-value (if depopulate 'ergoemacs-pre-command-hook 
'pre-command-hook))))))
+  (let ((from-hook (or (and depopulate 'ergoemacs-pre-command-hook)
+                       'pre-command-hook))
+        do-append ergoemacs-mode)
+    (dolist (item (default-value from-hook))
+      (if (eq item t)
+          (setq do-append t)
+        (unless (or depopulate (not (memq item ergoemacs-hook-functions)))
+          (add-hook 'ergoemacs-pre-command-hook item do-append nil)
+          (remove-hook 'pre-command-hook item nil))
+        (when depopulate
+          (add-hook 'pre-command-hook item do-append nil)
+          (remove-hook 'ergoemacs-pre-command-hook item do-append))))
+    (save-excursion
+      (dolist (buf (buffer-list))
+        (with-current-buffer buf
+          (unless (equal (default-value from-hook)
+                         (symbol-value from-hook))
+            (setq do-append nil)
+            (dolist (item (symbol-value from-hook))
+              (if (eq item t)
+                  (setq do-append t)
+                (unless (or depopulate (not (memq item 
ergoemacs-hook-functions)))
+                  (add-hook 'ergoemacs-pre-command-hook item do-append t)
+                  (remove-hook 'pre-command-hook item t))
+                (when depopulate
+                  (add-hook 'pre-command-hook item do-append t)
+                  (remove-hook 'ergoemacs-pre-command-hook item t))))))))))
+
 (defvar ergoemacs-smart-functions
   '(ergoemacs-shortcut
     ergoemacs-shortcut-movement-no-shift-select ergoemacs-shortcut-movement 
ergoemacs-read-key



reply via email to

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