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

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

[elpa] 33/35: Defined variables use add-to-list otherwise pushnew


From: Matthew Fidler
Subject: [elpa] 33/35: Defined variables use add-to-list otherwise pushnew
Date: Fri, 11 Jul 2014 22:33:33 +0000

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

commit 36ea201c5e3513d01ddbdde559bee4efcf14bb59
Author: Matthew L. Fidler <address@hidden>
Date:   Fri Jul 11 17:03:40 2014 -0500

    Defined variables use add-to-list otherwise pushnew
---
 ergoemacs-advices.el      |    2 +-
 ergoemacs-macros.el       |   11 -----------
 ergoemacs-theme-engine.el |   16 ++++++++--------
 ergoemacs-translate.el    |   26 +++++++++++++-------------
 ergoemacs-unbind.el       |    8 ++++----
 5 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index 191e17e..b7de57d 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -98,7 +98,7 @@ Also adds keymap-flag for user-defined keys run with 
`run-mode-hooks'."
                   (and (not (vectorp key))
                        (string= "ESC" kd)))
         ;; Let `ergoemacs-mode' know these keys have changed.
-        (ergoemacs-pushnew kd ergoemacs-global-changed-cache :test 'equal)
+        (pushnew kd ergoemacs-global-changed-cache :test 'equal)
         (setq ergoemacs-global-not-changed-cache (delete kd 
ergoemacs-global-not-changed-cache))
         ;; Remove the key from `ergoemacs-mode' bindings
         (ergoemacs-theme-component--ignore-globally-defined-key key t)))))
diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el
index a84c8fe..fe5266f 100644
--- a/ergoemacs-macros.el
+++ b/ergoemacs-macros.el
@@ -389,17 +389,6 @@ DIFFERENCES are the differences from the layout based on 
the functions.  These a
       (t 'object-set-name-string)) ,obj ,name))
 
 ;;;###autoload
-(defmacro ergoemacs-pushnew (x place &rest plist)
-  "Fix byte-compile errors for emacs versions less than 24.3.
-It says that `adjoin' from `cl' may be called at runtime, so use
-`add-to-list' instead of `pushnew'"
-  (cond
-   ((and (<= 24 emacs-major-version)
-         (<= 3 emacs-minor-version))
-    `(pushnew ,x ,place ,@plist))
-   (t `(add-to-list ',place ,x ,(plist-get plist ':test)))))
-
-;;;###autoload
 (defmacro ergoemacs-save-buffer-state (&rest body)
   "Eval BODY,
 then restore the buffer state under the assumption that no significant
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 9382e7f..fd718ca 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -509,10 +509,10 @@ DEF is anything that can be a key's definition:
             (if (let (case-fold-search)
                   (string-match "\\(S-\\|[A-Z]$\\)" key-desc))
                 (progn
-                  (ergoemacs-pushnew key-vect shift-list :test 'equal)
+                  (pushnew key-vect shift-list :test 'equal)
                   (oset obj shortcut-shifted-movement shift-list)
                   (define-key shortcut-map key 
'ergoemacs-shortcut-movement-no-shift-select))
-              (ergoemacs-pushnew key-vect move-list :test 'equal)
+              (pushnew key-vect move-list :test 'equal)
               (oset obj shortcut-movement move-list)
               (define-key shortcut-map key 'ergoemacs-shortcut-movement))
           (define-key shortcut-map key 'ergoemacs-shortcut))
@@ -1072,7 +1072,7 @@ Assumes maps are orthogonal."
         (when (ergoemacs-theme-component-maps-p map)
           (with-slots (versions) map
             (dolist (ver versions)
-              (ergoemacs-pushnew ver ret :test 'equal)))))
+              (pushnew ver ret :test 'equal)))))
       (sort ret 'string<))))
 
 (defmethod ergoemacs-get-hooks ((obj ergoemacs-theme-component-map-list) 
&optional match keymaps)
@@ -1084,7 +1084,7 @@ Assumes maps are orthogonal."
           (when (ergoemacs-theme-component-maps-p map)
             (setq ret (ergoemacs-get-hooks map match ret keymaps))))
         (dolist (item ret)
-          (ergoemacs-pushnew item final :test 'equal))
+          (pushnew item final :test 'equal))
         (puthash (list match keymaps) final hooks))
       final)))
 
@@ -1278,7 +1278,7 @@ FULL-SHORTCUT-MAP-P "
                   (funcall (if remove-p #'remove-hook #'add-hook) hook
                            fn-name)))
                ((and modify-map (not (boundp map-name)))
-                (ergoemacs-pushnew (list map-name full-map map deferred-keys) 
ergoemacs-deferred-maps))
+                (pushnew (list map-name full-map map deferred-keys) 
ergoemacs-deferred-maps))
                ((and modify-map (boundp map-name))
                 ;; Maps that are modified once (modify NOW if bound);
                 ;; no need for hooks?
@@ -1379,7 +1379,7 @@ The actual keymap changes are included in 
`ergoemacs-emulation-mode-map-alist'."
             (unless (member (nth 0 c) rm-list)
               (puthash (nth 0 c) (nth 1 c) ergoemacs-command-shortcuts-hash)
               (when (< 1 (length (nth 0 c)))
-                (ergoemacs-pushnew (substring (nth 0 c) 0 -1)
+                (pushnew (substring (nth 0 c) 0 -1)
                          ergoemacs-shortcut-prefix-keys
                          :test 'equal))
               (when (eq (nth 1 (nth 1 c)) 'global)
@@ -1876,7 +1876,7 @@ DONT-COLLAPSE doesn't collapse empty keymaps"
             (maphash
              (lambda(key ignore)
                (when (< 1 (length key))
-                 (ergoemacs-pushnew (substring key 0 -1)
+                 (pushnew (substring key 0 -1)
                           ergoemacs-shortcut-prefix-keys
                           :test 'equal)))
              ergoemacs-command-shortcuts-hash)
@@ -1892,7 +1892,7 @@ DONT-COLLAPSE doesn't collapse empty keymaps"
           (when (and (or (commandp lk t)
                          (keymapp lk))
                      (not (member key '([remap] ))))
-            (ergoemacs-pushnew key ergoemacs-global-override-rm-keys
+            (pushnew key ergoemacs-global-override-rm-keys
                      :test 'equal)
             (throw 'found-global-command t)))
         (setq key (substring key 0 (- (length key) 1)))))))
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index e377335..a1cff4f 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -410,8 +410,8 @@ This is called through `ergoemacs-universal-argument'.
 This function is made in `ergoemacs-translation'")
               (interactive)
               (ergoemacs-universal-argument ',(plist-get arg-plist ':name)))))
-    (ergoemacs-pushnew (intern (concat "ergoemacs-" (symbol-name (plist-get 
arg-plist ':name)) "-universal-argument"))
-             ergoemacs-universal-fns)
+    (add-to-list 'ergoemacs-universal-fns
+                 (intern (concat "ergoemacs-" (symbol-name (plist-get 
arg-plist ':name)) "-universal-argument")))
 
     (eval (macroexpand
            `(defun ,(intern (concat "ergoemacs-" (symbol-name (plist-get 
arg-plist ':name)) "-digit-argument")) ()
@@ -834,16 +834,17 @@ and `ergoemacs-pretty-key' descriptions.
     (while (< i 60)
       (unless (or (string= "" (nth i lay))
                   (string= "" (nth (+ i 60) lay)))
-        (ergoemacs-pushnew `(,(nth i lay) . ,(nth (+ i 60) lay))
-                 ergoemacs-shifted-assoc
-                 :test 'equal)
-        (ergoemacs-pushnew `(,(nth (+ i 60) lay) . ,(nth i lay))
-                 ergoemacs-shifted-assoc
-                 :test 'equal)
-        (ergoemacs-pushnew (nth i lay)
+        ;; Add to list is incompatible with lexical scoping.  However
+        ;; this use is OK since `ergoemacs-shifted-assoc' is defined
+        ;; in a defvar statement.
+        (add-to-list 'ergoemacs-shifted-assoc
+                     `(,(nth i lay) . ,(nth (+ i 60) lay)))
+        (add-to-list 'ergoemacs-shifted-assoc
+                     `(,(nth (+ i 60) lay) . ,(nth i lay)))
+        (pushnew (nth i lay)
                  unshifted-list
                  :test 'equal)
-        (ergoemacs-pushnew (nth (+ i 60) lay)
+        (pushnew (nth (+ i 60) lay)
                  shifted-list
                  :test 'equal))
       (setq i (+ i 1)))
@@ -871,9 +872,8 @@ and `ergoemacs-pretty-key' descriptions.
         (while (< i len)
           (unless (or (string= "" (nth i base))
                       (string= "" (nth i lay)))
-            (ergoemacs-pushnew `(,(nth i base) . ,(nth i lay))
-                    ergoemacs-translation-assoc
-                    :test 'equal))
+            (add-to-list 'ergoemacs-translation-assoc
+                         `(,(nth i base) . ,(nth i lay))))
           (setq i (+ i 1)))
         (setq ergoemacs-translation-regexp
               (format "\\(-\\| \\|^\\)\\(%s\\)\\($\\| \\)"
diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el
index 4cc5463..64e05fd 100644
--- a/ergoemacs-unbind.el
+++ b/ergoemacs-unbind.el
@@ -734,7 +734,7 @@
     (let ((key (read-kbd-macro (nth 0 x))))
       (dolist (fn (nth 1 x))
         (let ((keys (gethash fn ergoemacs-where-is-global-hash)))
-          (ergoemacs-pushnew key keys :test 'equal)
+          (pushnew key keys :test 'equal)
           (puthash fn keys ergoemacs-where-is-global-hash))))))
 
 
@@ -750,7 +750,7 @@
              (setq fn (lookup-key global-map (read-kbd-macro first)))
              (if (not (functionp fn))
                  elt
-               (ergoemacs-pushnew fn last :test 'equal)
+               (pushnew fn last :test 'equal)
                `(,first ,last))))
          ergoemacs-emacs-default-bindings))
   (ergoemacs-reset-global-where-is))
@@ -864,8 +864,8 @@ This should only be run when no global keys have been set.
                     (when fix
                       (unless (integerp trans-function)
                         (ergoemacs-global-fix-defualt-bindings key-kbd 
trans-function))))
-                  (ergoemacs-pushnew key-kbd ergoemacs-global-changed-cache 
:test 'equal))
-              (ergoemacs-pushnew key-kbd ergoemacs-global-not-changed-cache 
:test 'equal))
+                  (pushnew key-kbd ergoemacs-global-changed-cache :test 
'equal))
+              (pushnew key-kbd ergoemacs-global-not-changed-cache :test 
'equal))
             has-changed))))))
 
 (declare-function ergoemacs-get-fixed-layout "ergoemacs-translate.el")



reply via email to

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