mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit 4b7b0dee0af8e326358c4fa16d0c3a3a2d421982 Author: Matthew L. Fidler <[email protected]> Date: Fri May 30 08:16:36 2014 -0500 Some cleanups for ergoemacs-setup-translation --- ergoemacs-translate.el | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el index 1120313..a18d5a4 100644 --- a/ergoemacs-translate.el +++ b/ergoemacs-translate.el @@ -855,23 +855,25 @@ and `ergoemacs-pretty-key' descriptions. (defun ergoemacs-setup-translation (layout &optional base-layout) "Setup translation from BASE-LAYOUT to LAYOUT." - (let ((orig-base (or base-layout "us")) - lay shifted-list unshifted-list base - len i) - (setq lay (symbol-value (intern (concat "ergoemacs-layout-" layout)))) - (setq base (symbol-value (intern (concat "ergoemacs-layout-" orig-base)))) - - (setq len (length base)) - (setq i 0) + (let* ((orig-base (or base-layout "us")) + (lay (symbol-value (intern (concat "ergoemacs-layout-" layout)))) + shifted-list unshifted-list + (base (symbol-value (intern (concat "ergoemacs-layout-" orig-base)))) + (len (length base)) + (i 0)) (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 'ergoemacs-shifted-assoc + `(,(nth i lay) . ,(nth (+ i 60) lay)) + :test 'equal) + (pushnew 'ergoemacs-shifted-assoc + `(,(nth (+ i 60) lay) . ,(nth i lay)) + :test 'equal) + (pushnew 'unshifted-list (nth i lay) + :test 'equal) + (pushnew 'shifted-list (nth (+ i 60) lay) + :test 'equal)) (setq i (+ i 1))) (setq ergoemacs-shifted-regexp (format "\\(-\\| \\|^\\)\\(%s\\)\\($\\| \\)" @@ -897,8 +899,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)))) + (pushnew 'ergoemacs-translation-assoc + `(,(nth i base) . ,(nth i lay)) + :test 'equal)) (setq i (+ i 1))) (setq ergoemacs-translation-regexp (format "\\(-\\| \\|^\\)\\(%s\\)\\($\\| \\)"
