mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit 5e8e46e9bc1e1c9bf0528581562a4ba843ed0dc6 Author: Matthew L. Fidler <[email protected]> Date: Wed Jun 18 12:33:41 2014 -0500 pushnew instead of add-to-list --- ergoemacs-functions.el | 43 ++++++++++++++++++------------------------- ergoemacs-menus.el | 8 ++++++-- ergoemacs-theme-engine.el | 4 ++-- ergoemacs-translate.el | 28 ++++++++++++++++++---------- ergoemacs-unbind.el | 10 ++++------ 5 files changed, 48 insertions(+), 45 deletions(-) diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el index 4fe43c2..9b645f3 100644 --- a/ergoemacs-functions.el +++ b/ergoemacs-functions.el @@ -249,24 +249,6 @@ C-u C=u deletes old byte compilde `ergoemacs-mode' files." "\""))) full-exe)) -(defvar ergoemacs-theme--object) -(declare-function ergoemacs-gen-svg "ergoemacs-extras.el") -(declare-function ergoemacs-theme-component-map-list-md5 "ergoemacs-theme-engine.el") -(defun ergoemacs-cheat-sheet-file () - "Cheet sheet file for ergoemacs." - (let ((var-dir "") extra-dir) - (setq extra-dir (expand-file-name "ergoemacs-extras" user-emacs-directory)) - (when ergoemacs-theme - (setq var-dir (concat ergoemacs-theme "/")) - (setq extra-dir (expand-file-name ergoemacs-theme extra-dir))) - (setq extra-dir (expand-file-name "ergo-layouts" extra-dir)) - (setq extra-dir (expand-file-name (concat "ergoemacs-layout-" ergoemacs-keyboard-layout (if ergoemacs-theme--object - (concat "-" (ergoemacs-theme-component-map-list-md5 ergoemacs-theme--object)) - "") ".svg"))) - (when (not (file-exists-p extra-dir)) - (ergoemacs-gen-svg ergoemacs-theme "kbd-ergo.svg" (concat var-dir "ergo-layouts"))) - extra-dir)) - (defun ergoemacs-open-line () "Inserts an indented newline after the current line and moves the point to it." (interactive "P") @@ -1903,6 +1885,9 @@ If arg is a negative prefix, copy file path only" :group 'ergoemacs-mode) (defvar ergoemacs-dir) +(defvar ergoemacs-theme--object) +(declare-function ergoemacs-gen-svg "ergoemacs-extras.el") +(declare-function ergoemacs-theme-component-map-list-md5 "ergoemacs-theme-engine.el") (defun ergoemacs-display-current-svg (&optional arg) "Generates the current ergoemacs layout, unless it already exists and opens it in a browser. With a prefix, force regeneration. " @@ -1915,27 +1900,35 @@ With a prefix, force regeneration. " (png-tmp) (png-prefix "") (file-prefix "") + (md5 (if ergoemacs-theme--object + (concat + "-" (ergoemacs-theme-component-map-list-md5 ergoemacs-theme--object)) + "")) (file "")) (when var (setq extra (concat var "/ergo-layouts"))) (setq dir (expand-file-name extra (expand-file-name "ergoemacs-extras" user-emacs-directory))) - (setq file (expand-file-name (concat "ergoemacs-layout-" layout ".svg") dir)) - (setq file-prefix (expand-file-name (concat "ergoemacs-layout-" layout "-prefix.svg") dir)) + (setq file (expand-file-name (concat "ergoemacs-layout-" layout md5 ".svg") dir)) + (setq file-prefix (expand-file-name (concat "ergoemacs-layout-" layout md5 "-prefix.svg") dir)) - (setq png (expand-file-name (concat "ergoemacs-layout-" layout ".png") dir)) - (setq png-tmp (expand-file-name (concat "ergoemacs-layout-" layout "-tmp.png") dir)) - (setq png-prefix (expand-file-name (concat "ergoemacs-layout-" layout "-prefix.png") dir)) + (setq png (expand-file-name (concat "ergoemacs-layout-" layout md5 ".png") dir)) + (setq png-tmp (expand-file-name (concat "ergoemacs-layout-" layout md5 "-tmp.png") dir)) + (setq png-prefix (expand-file-name (concat "ergoemacs-layout-" layout md5 "-prefix.png") dir)) (unless (and (not current-prefix-arg) (file-exists-p file)) (if (called-interactively-p 'any) (let ((temp-file (make-temp-file "ergoemacs-gen" nil ".el"))) (with-temp-file temp-file - (insert (format "(setq ergoemacs-theme %s)\n(setq ergoemacs-keyboard-layout \"%s\")\n(ergoemacs-mode 1)\n(ergoemacs-display-current-svg 1)" + (insert (format "(setq ergoemacs-theme %s)\n(setq ergoemacs-keyboard-layout \"%s\")\n(setq ergoemacs-theme-options '" (if var (concat "\"" var "\"") "nil") - layout))) + layout)) + (let ((print-level nil) + (print-length nil)) + (prin1 ergoemacs-theme-options (current-buffer))) + (insert ")\n(ergoemacs-mode 1)\n(ergoemacs-display-current-svg 1)")) (shell-command (format "%s -Q --batch -l %s/ergoemacs-mode -l %s &" (ergoemacs-emacs-exe) diff --git a/ergoemacs-menus.el b/ergoemacs-menus.el index daafceb..e89be39 100644 --- a/ergoemacs-menus.el +++ b/ergoemacs-menus.el @@ -614,9 +614,13 @@ All other modes are assumed to be minor modes or unimportant. (if (fboundp 'tabbar-install-faces) (tabbar-install-faces) (when (fboundp 'package-install)` - (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) + (pushnew '("melpa" . "http://melpa.milkbox.net/packages/") + package-archives + :test 'equal ) (when (< emacs-major-version 24) - (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) + (pushnew '("melpa" . "http://melpa.milkbox.net/packages/") + package-archives + :test 'equal)) (package-refresh-contents) (package-install 'tabbar-ruler) (require 'tabbar-ruler nil t) diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el index 739de00..2f187cb 100644 --- a/ergoemacs-theme-engine.el +++ b/ergoemacs-theme-engine.el @@ -2261,7 +2261,8 @@ If OFF is non-nil, turn off the options instead." (if (and ergoemacs-theme--object (not ergoemacs-get-fixed-layout)) (setq ergoemacs-get-fixed-layout (ergoemacs-fixed-layout-list ergoemacs-theme--object)) - (setq ergoemacs-get-fixed-layout nil))) + (setq ergoemacs-get-fixed-layout nil)) + 'ergoemacs-get-fixed-layout) (defun ergoemacs-rm-key (keymap key) "Removes KEY from KEYMAP even if it is an ergoemacs composed keymap. @@ -2358,7 +2359,6 @@ When SILENT is true, also include silent themes" (sort (ergoemacs-get-themes silent) 'string<)) (symbol :tag "Other"))) -;; FIXME ;;;###autoload (defun ergoemacs-key (key function &optional desc only-first fixed-key) "Defines KEY in ergoemacs keyboard based on QWERTY and binds to FUNCTION. diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el index 2aaf603..ebb94de 100644 --- a/ergoemacs-translate.el +++ b/ergoemacs-translate.el @@ -92,7 +92,7 @@ (switch-to-buffer buf) ;; Save it so the user doesn't see the buffer popup very much ;; (if at all). - (add-to-list 'ergoemacs-display-char-list (list (list face char window-system) ret)) + (push (list (list face char window-system) ret) ergoemacs-display-char-list) ret)))) (defun ergoemacs-unicode-char (char alt-char) @@ -380,7 +380,8 @@ This is called through `ergoemacs-universal-argument'. This function is made in `ergoemacs-translation'") (interactive) (ergoemacs-universal-argument ',(plist-get arg-plist ':name))))) - (add-to-list 'ergoemacs-universal-fns (intern (concat "ergoemacs-" (symbol-name (plist-get arg-plist ':name)) "-universal-argument"))) + (pushnew (intern (concat "ergoemacs-" (symbol-name (plist-get arg-plist ':name)) "-universal-argument")) + :test 'equal) (eval (macroexpand `(defun ,(intern (concat "ergoemacs-" (symbol-name (plist-get arg-plist ':name)) "-digit-argument")) () @@ -810,12 +811,18 @@ and `ergoemacs-pretty-key' descriptions. (while (< i 60) (unless (or (string= "" (nth i lay)) (string= "" (nth (+ i 60) lay))) - (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))) - (add-to-list 'unshifted-list (nth i lay)) - (add-to-list 'shifted-list (nth (+ i 60) lay))) + (pushnew `(,(nth i lay) . ,(nth (+ i 60) lay)) + ergoemacs-shifted-assoc + :test 'equal) + (pushnew `(,(nth (+ i 60) lay) . ,(nth i lay)) + ergoemacs-shifted-assoc + :test 'equal) + (pushnew (nth i lay) + unshifted-list + :test 'equal) + (pushnew (nth (+ i 60) lay) + shifted-list + :test 'equal)) (setq i (+ i 1))) (setq ergoemacs-shifted-regexp (format "\\(-\\| \\|^\\)\\(%s\\)\\($\\| \\)" @@ -841,8 +848,9 @@ and `ergoemacs-pretty-key' descriptions. (while (< i len) (unless (or (string= "" (nth i base)) (string= "" (nth i lay))) - (add-to-list 'ergoemacs-translation-assoc - `(,(nth i base) . ,(nth i lay)))) + (pusnew `(,(nth i base) . ,(nth i lay)) + ergoemacs-translation-assoc + :test 'equal)) (setq i (+ i 1))) (setq ergoemacs-translation-regexp (format "\\(-\\| \\|^\\)\\(%s\\)\\($\\| \\)" diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el index f1cfccc..45e54e3 100644 --- a/ergoemacs-unbind.el +++ b/ergoemacs-unbind.el @@ -739,7 +739,7 @@ (mapc (lambda(fn) (let ((keys (gethash fn ergoemacs-where-is-global-hash))) - (add-to-list 'keys key) + (pushnew key keys :test equal) (puthash fn keys ergoemacs-where-is-global-hash))) (nth 1 x)))) ergoemacs-emacs-default-bindings)) @@ -757,9 +757,7 @@ (setq fn (lookup-key global-map (read-kbd-macro first))) (if (not (functionp fn)) elt - ;; FIXME: Use `push' or `cl-pushnew' instead of - ;; `add-to-list'. - (add-to-list 'last fn) + (pusnew fn last :test 'equal) `(,first ,last)))) ergoemacs-emacs-default-bindings)) (ergoemacs-reset-global-where-is)) @@ -904,8 +902,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)))) - (add-to-list 'ergoemacs-global-changed-cache key-kbd)) - (add-to-list 'ergoemacs-global-not-changed-cache key-kbd)) + (pushnew key-kbd ergoemacs-global-changed-cache :test 'equal)) + (pusnew key-kbd ergoemacs-global-not-changed-cache :test 'equal)) has-changed)))))) (declare-function ergoemacs-get-fixed-layout "ergoemacs-translate.el")
