mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit af5765ba8e7d6677a2176f4259d1b4c469a3c7f3 Author: Matthew L. Fidler <[email protected]> Date: Thu Jun 19 08:47:20 2014 -0500 Remove adjoin issues in 24.1 and 24.2 --- ergoemacs-advices.el | 2 +- ergoemacs-functions.el | 2 ++ ergoemacs-macros.el | 11 +++++++++++ ergoemacs-menus.el | 4 ++-- ergoemacs-theme-engine.el | 23 ++++++++++++++--------- ergoemacs-translate.el | 13 +++++++------ ergoemacs-unbind.el | 8 ++++---- 7 files changed, 41 insertions(+), 22 deletions(-) diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el index 010f37e..451aa91 100644 --- a/ergoemacs-advices.el +++ b/ergoemacs-advices.el @@ -103,7 +103,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. - (pushnew kd ergoemacs-global-changed-cache :test 'equal) + (ergoemacs-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-functions.el b/ergoemacs-functions.el index 2a4ba3d..a210229 100644 --- a/ergoemacs-functions.el +++ b/ergoemacs-functions.el @@ -517,6 +517,8 @@ This will not honor `shift-select-mode'." (defvar font-lock) (defvar ergoemacs-beginning-of-line-or-what-last-command nil) +(declare-function comment-search-backward "newcomment.el") +(declare-function comment-search-forward "newcomment.el") (defun ergoemacs-beginning-of-line-or-what (&optional N) "Move cursor to beginning of indentation, line, or text block, or beginning of buffer. (a text block is separated by empty lines). diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el index 26bfd96..a8f1225 100644 --- a/ergoemacs-macros.el +++ b/ergoemacs-macros.el @@ -345,6 +345,17 @@ DIFFERENCES are the differences from the layout based on the functions. These a (<= 4 emacs-minor-version)) 'eieio-object-set-name-string) (t 'object-set-name-string)) ,obj ,name)) + +(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))))) + (provide 'ergoemacs-macros) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ergoemacs-macros.el ends here diff --git a/ergoemacs-menus.el b/ergoemacs-menus.el index c674beb..d27415c 100644 --- a/ergoemacs-menus.el +++ b/ergoemacs-menus.el @@ -609,11 +609,11 @@ All other modes are assumed to be minor modes or unimportant. (if (fboundp 'tabbar-install-faces) (tabbar-install-faces) (when (fboundp 'package-install)` - (pushnew '("melpa" . "http://melpa.milkbox.net/packages/") + (ergoemacs-pushnew '("melpa" . "http://melpa.milkbox.net/packages/") package-archives :test 'equal ) (when (< emacs-major-version 24) - (pushnew '("melpa" . "http://melpa.milkbox.net/packages/") + (ergoemacs-pushnew '("melpa" . "http://melpa.milkbox.net/packages/") package-archives :test 'equal)) (package-refresh-contents) diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el index 95a9c43..aeb1c5c 100644 --- a/ergoemacs-theme-engine.el +++ b/ergoemacs-theme-engine.el @@ -60,6 +60,9 @@ (buffer-file-name) default-directory))))) +;;; Not sure why `adjoin' may be called at run-time; sigh. +(autoload 'adjoin "cl.el") + (defgroup ergoemacs-themes nil "Default Ergoemacs Layout" :group 'ergoemacs-mode) @@ -492,6 +495,8 @@ DEF is anything that can be a key's definition: (let* ((key-desc (key-description key)) (key-vect (read-kbd-macro key-desc t)) swapped + (shift-list shortcut-shifted-movement) + (move-list shortcut-movement) tmp) ;; Swap out apps for menu on the appropriate system. (dotimes (number (length key-vect)) @@ -526,11 +531,11 @@ DEF is anything that can be a key's definition: (if (let (case-fold-search) (string-match "\\(S-\\|[A-Z]$\\)" key-desc)) (progn - (pushnew key-vect shortcut-shifted-movement :test 'equal) - (oset obj shortcut-shifted-movement shortcut-shifted-movement) + (ergoemacs-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)) - (pushnew key-vect shortcut-movement :test 'equal) - (oset obj shortcut-movement shortcut-movement) + (ergoemacs-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)) (oset obj no-shortcut-map no-shortcut-map) @@ -1088,7 +1093,7 @@ Assumes maps are orthogonal." (when (ergoemacs-theme-component-maps-p map) (with-slots (versions) map (dolist (ver versions) - (pushnew ver ret :test 'equal))))) + (ergoemacs-pushnew ver ret :test 'equal))))) (sort ret 'string<)))) (defmethod ergoemacs-get-hooks ((obj ergoemacs-theme-component-map-list) &optional match keymaps) @@ -1100,7 +1105,7 @@ Assumes maps are orthogonal." (when (ergoemacs-theme-component-maps-p map) (setq ret (ergoemacs-get-hooks map match ret keymaps)))) (dolist (item ret) - (pushnew item final :test 'equal)) + (ergoemacs-pushnew item final :test 'equal)) (puthash (list match keymaps) final hooks)) final))) @@ -1270,7 +1275,7 @@ FULL-SHORTCUT-MAP-P " (funcall (if remove-p #'remove-hook #'add-hook) hook fn-name))) ((and modify-map (not (boundp map-name))) - (pushnew (list map-name full-map map deferred-keys) ergoemacs-deferred-maps)) + (ergoemacs-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? @@ -1369,7 +1374,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))) - (pushnew (substring (nth 0 c) 0 -1) + (ergoemacs-pushnew (substring (nth 0 c) 0 -1) ergoemacs-shortcut-prefix-keys :test 'equal)) (when (eq (nth 1 (nth 1 c)) 'global) @@ -1859,7 +1864,7 @@ DONT-COLLAPSE doesn't collapse empty keymaps" (maphash (lambda(key ignore) (when (< 1 (length key)) - (pushnew (substring key 0 -1) + (ergoemacs-pushnew (substring key 0 -1) ergoemacs-shortcut-prefix-keys :test 'equal))) ergoemacs-command-shortcuts-hash) diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el index 94e1103..79ec34d 100644 --- a/ergoemacs-translate.el +++ b/ergoemacs-translate.el @@ -59,6 +59,7 @@ (buffer-file-name) default-directory))))) + ;;; ergoemacs pretty keys @@ -380,7 +381,7 @@ This is called through `ergoemacs-universal-argument'. This function is made in `ergoemacs-translation'") (interactive) (ergoemacs-universal-argument ',(plist-get arg-plist ':name))))) - (pushnew (intern (concat "ergoemacs-" (symbol-name (plist-get arg-plist ':name)) "-universal-argument")) + (ergoemacs-pushnew (intern (concat "ergoemacs-" (symbol-name (plist-get arg-plist ':name)) "-universal-argument")) ergoemacs-universal-fns) (eval (macroexpand @@ -807,16 +808,16 @@ and `ergoemacs-pretty-key' descriptions. (while (< i 60) (unless (or (string= "" (nth i lay)) (string= "" (nth (+ i 60) lay))) - (pushnew `(,(nth i lay) . ,(nth (+ i 60) lay)) + (ergoemacs-pushnew `(,(nth i lay) . ,(nth (+ i 60) lay)) ergoemacs-shifted-assoc :test 'equal) - (pushnew `(,(nth (+ i 60) lay) . ,(nth i lay)) + (ergoemacs-pushnew `(,(nth (+ i 60) lay) . ,(nth i lay)) ergoemacs-shifted-assoc :test 'equal) - (pushnew (nth i lay) + (ergoemacs-pushnew (nth i lay) unshifted-list :test 'equal) - (pushnew (nth (+ i 60) lay) + (ergoemacs-pushnew (nth (+ i 60) lay) shifted-list :test 'equal)) (setq i (+ i 1))) @@ -844,7 +845,7 @@ and `ergoemacs-pretty-key' descriptions. (while (< i len) (unless (or (string= "" (nth i base)) (string= "" (nth i lay))) - (pushnew `(,(nth i base) . ,(nth i lay)) + (ergoemacs-pushnew `(,(nth i base) . ,(nth i lay)) ergoemacs-translation-assoc :test 'equal)) (setq i (+ i 1))) diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el index c246e53..b8a9f9f 100644 --- a/ergoemacs-unbind.el +++ b/ergoemacs-unbind.el @@ -737,7 +737,7 @@ (let ((key (read-kbd-macro (nth 0 x)))) (dolist (fn (nth 1 x)) (let ((keys (gethash fn ergoemacs-where-is-global-hash))) - (pushnew key keys :test 'equal) + (ergoemacs-pushnew key keys :test 'equal) (puthash fn keys ergoemacs-where-is-global-hash)))))) @@ -753,7 +753,7 @@ (setq fn (lookup-key global-map (read-kbd-macro first))) (if (not (functionp fn)) elt - (pushnew fn last :test 'equal) + (ergoemacs-pushnew fn last :test 'equal) `(,first ,last)))) ergoemacs-emacs-default-bindings)) (ergoemacs-reset-global-where-is)) @@ -898,8 +898,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)))) - (pushnew key-kbd ergoemacs-global-changed-cache :test 'equal)) - (pushnew key-kbd ergoemacs-global-not-changed-cache :test 'equal)) + (ergoemacs-pushnew key-kbd ergoemacs-global-changed-cache :test 'equal)) + (ergoemacs-pushnew key-kbd ergoemacs-global-not-changed-cache :test 'equal)) has-changed)))))) (declare-function ergoemacs-get-fixed-layout "ergoemacs-translate.el")
