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

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

[elpa] 01/287: Stefan Monnier's Patch


From: Matthew Fidler
Subject: [elpa] 01/287: Stefan Monnier's Patch
Date: Wed, 02 Jul 2014 14:44:05 +0000

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

commit 8e95ab15132087ce163b3d8834a5d2b0d322140d
Author: Matthew L. Fidler <address@hidden>
Date:   Fri May 23 16:40:08 2014 +0800

    Stefan Monnier's Patch
---
 .gitignore                |    2 +
 ergoemacs-advices.el      |   45 ++--
 ergoemacs-extras.el       |    6 +-
 ergoemacs-functions.el    |    6 +-
 ergoemacs-layouts.el      |    4 +-
 ergoemacs-menus.el        |    6 +-
 ergoemacs-modal.el        |    2 +-
 ergoemacs-mode.el         |   18 +-
 ergoemacs-shortcuts.el    |  183 +++++----------
 ergoemacs-test.el         |    2 +-
 ergoemacs-theme-engine.el |  553 +++++++++++++++++++++++----------------------
 ergoemacs-themes.el       |    6 +
 ergoemacs-track.el        |    8 +-
 ergoemacs-translate.el    |   33 ++--
 ergoemacs-unbind.el       |  161 +++++++-------
 15 files changed, 492 insertions(+), 543 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9849c5e..a296883 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
 *~
 out/*
+*-autoloads.el
+*-pkg.el
 *.elc
 \#*\#
 .\#*
diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index d54e03e..9b590b2 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -35,60 +35,67 @@
   "Ergoemacs directory.")
 (add-to-list 'load-path ergoemacs-dir)
 (require 'ergoemacs-shortcuts)
+(require 'ergoemacs-unbind)
+
+(defvar ergoemacs-advices '()
+  "List of advices to enable and disable when ergoemacs is running.")
+
+(defvar ergoemacs-run-mode-hooks ())
 
 (defmacro ergoemacs-define-overrides (&rest body)
   "Force the define-keys to work"
   `(let ((ergoemacs-run-mode-hooks t))
      ,@body))
 
-(defadvice add-hook (around ergoemacs-add-hook-advice (hook function &optional 
append  local))
+(defadvice add-hook (around ergoemacs-add-hook-advice (hook function &optional 
append  local) activate)
   "Advice to allow `this-command' to be set correctly before running 
`pre-command-hook'
 If `pre-command-hook' is used and `ergoemacs-mode' is enabled add to 
`ergoemacs-pre-command-hook' instead."
   (cond
    ((and ergoemacs-mode (eq hook 'pre-command-hook)
+         (boundp 'ergoemacs-hook-functions)
          (memq hook ergoemacs-hook-functions))
     (add-hook 'ergoemacs-pre-command-hook function append local))
    (t
     ad-do-it)))
-(ad-activate 'add-hook)
 
-(defadvice remove-hook (around ergoemacs-remove-hook-advice (hook function 
&optional local))
+(defadvice remove-hook (around ergoemacs-remove-hook-advice (hook function 
&optional local) activate)
   "Advice to allow `this-command' to be set correctly before running 
`pre-command-hook'.
 If `pre-command-hook' is used and `ergoemacs-mode' is remove from 
`ergoemacs-pre-command-hook' instead."
   (cond
    ((and ergoemacs-mode (eq hook 'pre-command-hook)
+         (boundp 'ergoemacs-hook-functions)
          (memq hook ergoemacs-hook-functions))
     (remove-hook 'ergoemacs-pre-command-hook function local))
    (t
     ad-do-it)))
-(ad-activate 'remove-hook)
 
-(defadvice define-key (around ergoemacs-define-key-advice (keymap key def))
+(defadvice define-key (around ergoemacs-define-key-advice (keymap key def) 
activate)
   "This does the right thing when modifying `ergoemacs-keymap'.
 Also adds keymap-flag for user-defined keys run with `run-mode-hooks'."
-  (let ((is-global-p (equal keymap (current-global-map))))
-    (if (and (boundp 'ergoemacs-run-mode-hooks) ergoemacs-run-mode-hooks
-             (not (equal keymap (current-global-map)))
-             (not (equal keymap ergoemacs-keymap)))
+  (let ((is-global-p (eq keymap (current-global-map))))
+    (if (and ergoemacs-run-mode-hooks
+             (not is-global-p)
+             (not (and (boundp 'ergoemacs-keymap)
+                       (eq keymap ergoemacs-keymap))))
         (let ((ergoemacs-run-mode-hooks nil)
               (new-key (read-kbd-macro
                         (format "<ergoemacs-user> %s"
                                 (key-description key)))))
-          (unwind-protect
-              (define-key keymap new-key def))))
+          (define-key keymap new-key def)))
     ad-do-it
     (when is-global-p
       (let ((vk key))
-        (ergoemacs-global-set-key-after key def)
+        (ergoemacs-global-set-key-after key)
         (unless (vectorp vk) ;; Do vector def too.
           (setq vk (read-kbd-macro (key-description key) t))
-          (ergoemacs-global-set-key-after vk def))))))
-(ad-activate 'define-key)
+          (ergoemacs-global-set-key-after vk))))))
 
 (defvar ergoemacs-global-override-rm-keys '())
+
+(defvar no-ergoemacs-advice nil)
 ;;; Advices enabled or disabled with ergoemacs-mode
-(defun ergoemacs-global-set-key-after (key command)
-  (if (and (boundp 'no-ergoemacs-advice) no-ergoemacs-advice) nil
+(defun ergoemacs-global-set-key-after (key)
+  (if no-ergoemacs-advice nil
     (unless (or (and (vectorp key)
                      (memq (elt key 0) '(menu-bar 27 remap)))
                 (and (not (vectorp key))
@@ -212,18 +219,16 @@ This require `ergoemacs-mode' to be enabled as well as
     (ad-activate 'helm-ff-auto-expand-to-home-or-root)))
 
 
-(defadvice run-mode-hooks (around ergoemacs-run-hooks)
+(defadvice run-mode-hooks (around ergoemacs-run-hooks activate)
   "`ergoemacs-mode' run-hooks advice helps user define keys properly.
 This assumes any key defined while running a hook is a user-defined hook."
   (let ((ergoemacs-run-mode-hooks t))
     ad-do-it))
-(ad-activate 'run-mode-hooks)
 
-(defadvice turn-on-undo-tree-mode (around ergoemacs-undo-tree-mode)
+(defadvice turn-on-undo-tree-mode (around ergoemacs-undo-tree-mode activate)
   "Make `ergoemacs-mode' and undo-tree compatible."
   (ergoemacs-with-global
    ad-do-it))
-(ad-activate 'turn-on-undo-tree-mode)
 
 
 (defcustom ergoemacs-check-new-buffer-auto-mode 't
diff --git a/ergoemacs-extras.el b/ergoemacs-extras.el
index d711285..318fdf5 100644
--- a/ergoemacs-extras.el
+++ b/ergoemacs-extras.el
@@ -587,7 +587,7 @@ function change_layout() {
       (while (re-search-forward "\\<C-" nil t)
         (replace-match (if swap-option-and-control "~" "^") nil t))
       (setq ret (buffer-string)))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-gen-mac-osx (layout &optional file-name extra 
swap-opiton-and-control)
   "Generates an Autohotkey Script for Ergoemacs Keybindings.
@@ -1104,7 +1104,7 @@ Files are generated in the dir 〔ergoemacs-extras〕 at 
`user-emacs-directory'.
       (goto-char (point-min))
       (while (re-search-forward ">\\(AA\\)<" nil t)
         (replace-match "><" t)))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-keyfreq-calc-ergo (x list var-layout cmd-n total-n)
   "Calculate keyfreq based on ergoemacs positions."
@@ -1637,7 +1637,7 @@ IS-PREFIX tell ergoemacs if this is a prefix diagram."
       (message "Generated!"))
     (when (called-interactively-p 'interactive)
       (browse-url (concat "file://" file)))
-    (symbol-value 'file)))
+    file))
 
 ;;;###autoload
 (defun ergoemacs-svgs (&optional layouts)
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index 571ff46..7ba0795 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -239,7 +239,7 @@ C-u C=u deletes old byte compilde `ergoemacs-mode' files."
         (emacs-dir (invocation-directory))
         (full-exe (concat "\"" (expand-file-name emacs-exe emacs-dir)
                           "\"")))
-    (symbol-value 'full-exe)))
+    full-exe))
 
 (defun ergoemacs-cheat-sheet-file ()
   "Cheet sheet file for ergoemacs."
@@ -252,7 +252,7 @@ C-u C=u deletes old byte compilde `ergoemacs-mode' files."
     (setq extra-dir (expand-file-name (concat "ergoemacs-layout-" 
ergoemacs-keyboard-layout ".svg")))
     (when (not (file-exists-p extra-dir))
       (ergoemacs-gen-svg ergoemacs-theme "kbd-ergo.svg" (concat var-dir 
"ergo-layouts")))
-    (symbol-value 'extra-dir)))
+    extra-dir))
 
 (defun ergoemacs-open-line ()
   "Inserts an indented newline after the current line and moves the point to 
it."
@@ -1886,7 +1886,7 @@ With a prefix, force regeneration. "
             (browse-url-of-file file)
           (error
            (ergoemacs-open-in-external-app file)))))
-    (symbol-value 'file)))
+    file))
 
 ;;; Unaccent region taken and modified from Drew Adam's unaccent.el
 
diff --git a/ergoemacs-layouts.el b/ergoemacs-layouts.el
index 07c2eec..d14a25a 100644
--- a/ergoemacs-layouts.el
+++ b/ergoemacs-layouts.el
@@ -363,10 +363,10 @@
   "Get the list of all known layouts."
   (if (and ergoemacs-get-layouts-no-aliases
            (not aliases))
-      (symbol-value 'ergoemacs-get-layouts-no-aliases)
+      ergoemacs-get-layouts-no-aliases
     (if (and ergoemacs-get-layouts-aliases
              aliases)
-        (symbol-value 'ergoemacs-get-layouts-aliases)
+        ergoemacs-get-layouts-aliases
       (let (ret)
         (mapatoms
          (lambda(s)
diff --git a/ergoemacs-menus.el b/ergoemacs-menus.el
index cb4bf16..5bbdfe0 100644
--- a/ergoemacs-menus.el
+++ b/ergoemacs-menus.el
@@ -134,7 +134,7 @@ Tries to get the value from `ergoemacs-mode-names'.  If not 
guess the language n
       (setq ret (car (cdr ret))))
     (setq ret (concat (upcase (substring ret 0 1))
                       (substring ret 1)))
-    (symbol-value 'ret)))
+    ret))
 
 ;; `Languages'  
 (defun ergoemacs-get-major-modes ()
@@ -683,9 +683,9 @@ All other modes are assumed to be minor modes or 
unimportant.
                            (:toggle and
                                     (boundp 'speedbar-frame)
                                     (frame-live-p
-                                     (symbol-value 'speedbar-frame))
+                                     speedbar-frame)
                                     (frame-visible-p
-                                     (symbol-value 'speedbar-frame)))
+                                     speedbar-frame))
                            :keys "")
         ;; (datetime-separator)
         ;; (showhide-date-time)
diff --git a/ergoemacs-modal.el b/ergoemacs-modal.el
index 1c7d9ac..60bdc38 100644
--- a/ergoemacs-modal.el
+++ b/ergoemacs-modal.el
@@ -246,7 +246,7 @@ If so return the hash of translation values."
              (lookup-key ergoemacs-modal-ignored-keymap
                          (or ergoemacs-single-command-keys 
(this-single-command-keys))))
         (setq ret nil)))
-      (symbol-value 'ret))))
+      ret)))
 
 (defun ergoemacs-modal-default (&optional arg)
   "The default command for `ergoemacs-mode' modal.
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index c7c3ec8..c38be7a 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -366,9 +366,6 @@ remove the keymap depends on user input and KEEP-PRED:
 
 ;; ErgoEmacs hooks
 
-(defvar ergoemacs-advices '()
-  "List of advices to enable and disable when ergoemacs is running.")
-
 (defun ergoemacs-setup-keys (&optional no-check)
   "Setups keys based on a particular layout. Based on 
`ergoemacs-keyboard-layout'."
   (interactive)
@@ -771,7 +768,9 @@ 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)
+  (let ((from-hook (if depopulate 'ergoemacs-pre-command-hook
+                     'pre-command-hook))
+        do-append ergoemacs-mode)
     (mapc
      (lambda(item)
        (if (eq item t)
@@ -781,10 +780,11 @@ These hooks are deferred to make sure `this-command' is 
set appropriately.")
            (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)))
+           (remove-hook 'ergoemacs-pre-command-hook item nil))))
+     (default-value from-hook))
+    ;; FIXME: This should be done in every buffer!
+    (unless (equal (default-value from-hook)
+                   (symbol-value from-hook))
       (setq do-append nil)
       (mapc
        (lambda(item)
@@ -796,7 +796,7 @@ These hooks are deferred to make sure `this-command' is set 
appropriately.")
            (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))))))
+       (symbol-value from-hook)))))
 (defvar ergoemacs-smart-functions
   '(ergoemacs-shortcut
     ergoemacs-shortcut-movement-no-shift-select ergoemacs-shortcut-movement 
ergoemacs-read-key
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index ea8bb04..50a7668 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -50,6 +50,8 @@
 ;; 
 ;;; Code:
 (require 'guide-key nil t)
+(unless (fboundp 'ergoemacs-pretty-key)
+  (require 'ergoemacs-translate))
 
 (defmacro ergoemacs-with-ergoemacs (&rest body)
   "With basic `ergoemacs-mode' mode keys.
@@ -173,13 +175,13 @@ This sequence is compatible with `listify-key-sequence'."
   (let (input)
     (cond
      ((not key)) ;; Not specified.
-     ((eq (type-of key) 'vector) ;; Actual key sequence
+     ((vectorp key) ;; Actual key sequence
       (setq input (listify-key-sequence key)))
-     ((eq (type-of key) 'cons) ;; Listified key sequence
+     ((consp key) ;; Listified key sequence
       (setq input key))
-     ((eq (type-of key) 'string) ;; Kbd code
+     ((stringp key) ;; Kbd code
       (setq input (listify-key-sequence (read-kbd-macro key t)))))
-    (symbol-value 'input)))
+    input))
 
 (defun ergoemacs-universal-argument (&optional type)
   "Ergoemacs universal argument.
@@ -415,7 +417,7 @@ universal argument can be entered.
            ((eq current-prefix-arg '-)
             (setq current-prefix-arg nil)
             (setq ret nil))))))))
-    (symbol-value 'ret)))
+    ret))
 
 (defcustom ergoemacs-read-swaps
   '(((normal normal) unchorded)
@@ -504,7 +506,7 @@ It will replace anything defined by `ergoemacs-translation'"
          (setq next-key (plist-put next-key var-pretty pretty))
          (setq next-key (plist-put next-key var-s-pretty pretty))))
      ergoemacs-translations)
-    (symbol-value 'next-key)))
+    next-key))
 
 (defvar ergoemacs-alt-text
   (replace-regexp-in-string
@@ -531,7 +533,7 @@ It will replace anything defined by `ergoemacs-translation'"
     (setq pretty (plist-get next-key ':alt-pretty))
     (setq kbd (plist-get next-key ':alt))
     (setq next-key (ergoemacs-read-key-install-next-key next-key key pretty 
kbd))
-    (symbol-value 'next-key)))
+    next-key))
 
 (defun ergoemacs-read-key-next-key-is-ctl (&optional type pretty-key)
   "The next key read is an Ctrl+ key. (or C- )"
@@ -546,22 +548,19 @@ It will replace anything defined by 
`ergoemacs-translation'"
     (setq pretty (plist-get next-key ':ctl-pretty))
     (setq kbd (plist-get next-key ':ctl))
     (setq next-key (ergoemacs-read-key-install-next-key next-key key pretty 
kbd))
-    (symbol-value 'next-key)))
+    next-key))
 
 (defun ergoemacs-read-key-next-key-is-alt-ctl (&optional type pretty-key)
   "The next key read is an Alt+Ctrl+ key. (or C-M- )"
   (interactive)
-  (let (next-key
-        key pretty kbd)
-    (setq next-key
-              (ergoemacs-translate
-               (vector
-                (ergoemacs-read-event nil pretty-key ergoemacs-alt-ctl-text))))
-    (setq key (plist-get next-key ':alt-ctl-key))
-    (setq pretty (plist-get next-key ':alt-ctl-pretty))
-    (setq kbd (plist-get next-key ':alt-ctl))
-    (setq next-key (ergoemacs-read-key-install-next-key next-key key pretty 
kbd))
-    (symbol-value'next-key)))
+  (let* ((next-key
+          (ergoemacs-translate
+           (vector
+            (ergoemacs-read-event nil pretty-key ergoemacs-alt-ctl-text))))
+         (key (plist-get next-key ':alt-ctl-key))
+         (pretty (plist-get next-key ':alt-ctl-pretty))
+         (kbd (plist-get next-key ':alt-ctl)))
+    (ergoemacs-read-key-install-next-key next-key key pretty kbd)))
 
 (defun ergoemacs-read-key-next-key-is-quoted (&optional type pretty-key)
   "The next key read is quoted."
@@ -575,7 +574,7 @@ It will replace anything defined by `ergoemacs-translation'"
       (setq pretty (plist-get next-key ':normal-pretty))
       (setq kbd (plist-get next-key ':normal))
       (setq next-key (ergoemacs-read-key-install-next-key next-key key pretty 
kbd))
-      (symbol-value 'next-key))))
+      next-key)))
 
 (defun ergoemacs-read-key-help ()
   "Show help for the current sequence KEY."
@@ -626,15 +625,15 @@ It will replace anything defined by 
`ergoemacs-translation'"
 (defun ergoemacs-defer-post-command-hook ()
   "Defers `post-command-hook'."
   (set-default 'ergoemacs-defer-post-command-hook (default-value 
'post-command-hook))
-  (set (make-local-variable 'ergoemacs-defer-post-command-hook) (symbol-value 
'post-command-hook))
+  (set (make-local-variable 'ergoemacs-defer-post-command-hook) 
post-command-hook)
   (set (make-local-variable 'post-command-hook) nil)
   (set-default 'post-command-hook nil))
 
 (defun ergoemacs-restore-post-command-hook ()
   (when (or (default-value 'ergoemacs-defer-post-command-hook)
-            (symbol-value 'ergoemacs-defer-post-command-hook))
+            ergoemacs-defer-post-command-hook)
     (set-default 'post-command-hook (default-value 
'ergoemacs-defer-post-command-hook))
-    (set (make-local-variable 'post-command-hook) (symbol-value 
'ergoemacs-defer-post-command-hook))
+    (set (make-local-variable 'post-command-hook) 
ergoemacs-defer-post-command-hook)
     (set (make-local-variable 'ergoemacs-defer-post-command-hook) nil)
     (set-default 'ergoemacs-defer-post-command-hook nil)))
 
@@ -732,7 +731,7 @@ In addition, when the function is called:
       (setq tmp (intern (match-string 1 tmp)))
       (setq type tmp
             first-type tmp))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-read-key-lookup-get-ret (fn)
   "Get ret type for FN.
@@ -748,7 +747,24 @@ to the appropriate values for `ergoemacs-read-key'.
       (setq ret 'keymap))
     (when (memq fn ergoemacs-universal-fns)
       (setq ret (ergoemacs-read-key-lookup-get-ret---universal fn)))
-    (symbol-value 'ret)))
+    ret))
+
+(defun ergoemacs--key-message (pretty-key dest)
+  (when (and ergoemacs-echo-function
+             (boundp 'pretty-key-undefined)
+             (not (or this-command-keys-shift-translated
+                      ergoemacs-shift-translated)))
+    (let (message-log-max)
+      (if (string= pretty-key-undefined pretty-key)
+          (when (eq ergoemacs-echo-function t)
+            (message "%s%s%s" pretty-key
+                     (ergoemacs-unicode-char "→" "->")
+                     dest))
+        (message "%s%s%s (from %s)"
+                 pretty-key
+                 (ergoemacs-unicode-char "→" "->")
+                 dest
+                 pretty-key-undefined)))))
 
 (defun ergoemacs-read-key-lookup (prior-key prior-pretty-key key pretty-key 
force-key)
   "Lookup KEY and run if necessary.
@@ -853,21 +869,7 @@ FORCE-KEY forces keys like <escape> to work properly.
                            (error nil))))
                   (setq fn (or (command-remapping fn (point)) fn))
                   (setq ergoemacs-single-command-keys key)
-                  (when (and ergoemacs-echo-function
-                             (boundp 'pretty-key-undefined)
-                             (not (or this-command-keys-shift-translated
-                                      ergoemacs-shift-translated)))
-                    (let (message-log-max)
-                      (if (string= pretty-key-undefined pretty-key)
-                          (when (eq ergoemacs-echo-function t)
-                            (message "%s%s%s" pretty-key
-                                     (ergoemacs-unicode-char "→" "->")
-                                     (symbol-name fn)))
-                        (message "%s%s%s (from %s)"
-                                 pretty-key
-                                 (ergoemacs-unicode-char "→" "->")
-                                 (symbol-name fn)
-                                 pretty-key-undefined))))
+                  (ergoemacs--key-message pretty-key fn)
                   (ergoemacs-read-key-call fn nil key)
                   (setq ergoemacs-single-command-keys nil)
                   (setq ret 'translate-fn))
@@ -880,21 +882,8 @@ FORCE-KEY forces keys like <escape> to work properly.
                   (setq unread-command-events (append (listify-key-sequence 
tmp) unread-command-events))
                   (ergoemacs-defer-post-command-hook)
                   (reset-this-command-lengths)
-                  (when (and ergoemacs-echo-function
-                             (boundp 'pretty-key-undefined)
-                             (not (or this-command-keys-shift-translated
-                                      ergoemacs-shift-translated)))
-                    (let (message-log-max)
-                      (if (string= pretty-key-undefined pretty-key)
-                          (when (eq ergoemacs-echo-function t)
-                            (message "%s%s%s" pretty-key
-                                     (ergoemacs-unicode-char "→" "->")
-                                     (ergoemacs-pretty-key (key-description 
tmp))))
-                        (message "%s%s%s (from %s)"
-                                 pretty-key
-                                 (ergoemacs-unicode-char "→" "->")
-                                 (ergoemacs-pretty-key (key-description tmp))
-                                 pretty-key-undefined))))
+                  (ergoemacs--key-message
+                   pretty-key (ergoemacs-pretty-key (key-description tmp)))
                   (when lookup
                     (define-key lookup [ergoemacs-single-command-keys] 'ignore)
                     (setq ergoemacs-read-key-overriding-terminal-local-save 
overriding-terminal-local-map)
@@ -948,45 +937,18 @@ FORCE-KEY forces keys like <escape> to work properly.
                          (condition-case err
                              (interactive-form (nth 0 hash))
                            (error nil)))
-                    (when (and ergoemacs-echo-function
-                               (boundp 'pretty-key-undefined)
-                               (not (or this-command-keys-shift-translated
-                                        ergoemacs-shift-translated)))
-                      (let (message-log-max)
-                        (if (string= pretty-key-undefined pretty-key)
-                            (when (eq ergoemacs-echo-function t)
-                              (message "%s%s%s" pretty-key
-                                       (ergoemacs-unicode-char "→" "->")
-                                       (symbol-name (nth 0 hash))))
-                          (message "%s%s%s (from %s)"
-                                   pretty-key
-                                   (ergoemacs-unicode-char "→" "->")
-                                   (symbol-name (nth 0 hash))
-                                   pretty-key-undefined))))
+                    (ergoemacs--key-message pretty-key (nth 0 hash))
                     (ergoemacs-shortcut-remap (nth 0 hash))
                     (setq ergoemacs-single-command-keys nil)
                     (setq ret 'function-remap))
                    ((and ergoemacs-shortcut-keys (not ergoemacs-describe-key)
                          (not ergoemacs-single-command-keys))
-                    (when (and ergoemacs-echo-function
-                               (boundp 'pretty-key-undefined)
-                               (not (or this-command-keys-shift-translated
-                                        ergoemacs-shift-translated)))
-                      (let (message-log-max)
-                        (if (nth 0 hash)
-                            (setq fn (nth 0 hash))
-                          (setq fn (key-binding key))
-                          (setq fn (or (command-remapping fn (point)) fn)))
-                        (if (string= pretty-key-undefined pretty-key)
-                            (when (eq ergoemacs-echo-function t)
-                              (message "%s%s%s;" pretty-key
-                                       (ergoemacs-unicode-char "→" "->")
-                                       fn))
-                          (message "%s%s%s (from %s);"
-                                   pretty-key
-                                   (ergoemacs-unicode-char "→" "->")
-                                   fn
-                                   pretty-key-undefined))))
+                    (ergoemacs--key-message pretty-key
+                                            (or (nth 0 hash)
+                                                (let ((fn (key-binding key)))
+                                                  (or (command-remapping
+                                                       fn (point))
+                                                      fn))))
                     ;; There is some issue with these keys.  Read-key
                     ;; thinks it is in a minibuffer, so the recursive 
                     ;; minibuffer error is raised unless these are put
@@ -1012,21 +974,7 @@ FORCE-KEY forces keys like <escape> to work properly.
                       (setq ret (ergoemacs-read-key-lookup-get-ret---universal 
fn)))
                     (unless ret
                       (setq ergoemacs-single-command-keys key)
-                      (when (and ergoemacs-echo-function
-                                 (boundp 'pretty-key-undefined)
-                                 (not (or this-command-keys-shift-translated
-                                          ergoemacs-shift-translated)))
-                        (let (message-log-max)
-                          (if (string= pretty-key-undefined pretty-key)
-                              (when (eq ergoemacs-echo-function t)
-                                (message "%s%s%s" pretty-key
-                                         (ergoemacs-unicode-char "→" "->")
-                                         (symbol-name fn)))
-                            (message "%s%s%s (from %s)"
-                                     pretty-key
-                                     (ergoemacs-unicode-char "→" "->")
-                                     (symbol-name fn)
-                                     pretty-key-undefined))))
+                      (ergoemacs--key-message pretty-key fn)
                       (ergoemacs-read-key-call fn nil key)
                       (setq ergoemacs-single-command-keys nil)
                       (setq ret 'function))))))
@@ -1051,23 +999,14 @@ FORCE-KEY forces keys like <escape> to work properly.
                 (unless ret
                   (setq fn (or (command-remapping fn (point)) fn))
                   (setq ergoemacs-single-command-keys key)
-                  (let (message-log-max)
-                    (if (string= pretty-key-undefined pretty-key)
-                        (message "%s%s%s" pretty-key
-                                 (ergoemacs-unicode-char "→" "->")
-                                 fn)
-                      (message "%s%s%s (from %s)"
-                               pretty-key
-                               (ergoemacs-unicode-char "→" "->")
-                               fn
-                               pretty-key-undefined)))
+                  (ergoemacs--key-message pretty-key fn)
                   (ergoemacs-read-key-call fn nil key)
                   (setq ergoemacs-single-command-keys nil)
                   (setq ret 'function-global-or-override)))))
           ;; Fix tempoary over
           (when (and tmp-overlay (not 
ergoemacs-read-key-overriding-overlay-save))
             (delete-overlay tmp-overlay)))
-        (symbol-value 'ret))
+        ret)
     ;; Turn off read-input-keys for shortcuts
     (when unread-command-events
       (when ergoemacs-modal
@@ -1092,7 +1031,7 @@ Otherwise add new translation to key-plist and return it."
       (setq key-plist (plist-put key-plist (intern new-trans) kd))
       (setq kd (ergoemacs-pretty-key kd))
       (setq key-plist (plist-put key-plist (intern (concat new-trans 
"-pretty")) kd)))
-    (symbol-value 'key-plist)))
+    key-plist))
 
 (defvar ergoemacs-shift-translated nil)
 (defvar ergoemacs-deactivate-mark nil)
@@ -1488,7 +1427,7 @@ DEF can be:
                (setq found
                      (ergoemacs-define-key keymap key new-def)))))
          def))
-      (symbol-value 'found)))
+      found))
    ((condition-case err
         (interactive-form def)
       (error nil))
@@ -1707,7 +1646,7 @@ This also considers archaic emacs bindings by looking at
 in effect)."
   (let ((ret (gethash (list function dont-ignore-menu) 
ergoemacs-shortcut-function-binding-hash)))
     (if ret
-        (symbol-value 'ret)
+        ret
       (setq ret (or
                  (if dont-ignore-menu
                      (where-is-internal function (current-global-map))
@@ -1717,7 +1656,7 @@ in effect)."
                     (where-is-internal function (current-global-map))))
                  (gethash function ergoemacs-where-is-global-hash)))
       (puthash (list function dont-ignore-menu) ret 
ergoemacs-shortcut-function-binding-hash)
-      (symbol-value 'ret))))
+      ret)))
 
 (defcustom ergoemacs-use-function-remapping t
   "Uses function remapping.
@@ -1848,7 +1787,7 @@ user-defined keys.
         (use-global-map old-global-map))
       (when ret2
         (setq ret (append ret2 ret)))
-      (symbol-value 'ret))))
+      ret)))
 
 (defun ergoemacs-shortcut-remap (function &optional keys)
   "Runs the FUNCTION or whatever `ergoemacs-shortcut-remap-list' returns.
@@ -2013,7 +1952,7 @@ Setup C-c and C-x keys to be described properly.")
             (overlay-put tmp-overlay 'priority 536870911))
           ;; (ergoemacs-debug-keymap 'override-text-map)
           ))))
-    (symbol-value 'tmp-overlay)))
+    tmp-overlay))
 
 (defun ergoemacs-install-shortcut-up--internal (text keymap &optional 
dont-complete)
   (let* ((keymap keymap)
@@ -2081,7 +2020,7 @@ Setup C-c and C-x keys to be described properly.")
                                    "")
                                  read-map)))
       (puthash hashkey read-map ergoemacs-extract-map-hash))
-    (symbol-value 'keymap)))
+    keymap))
 
 (defun ergoemacs-install-shortcuts-up ()
   "Installs ergoemacs shortcuts into overriding keymaps.
diff --git a/ergoemacs-test.el b/ergoemacs-test.el
index f0216be..099ea94 100644
--- a/ergoemacs-test.el
+++ b/ergoemacs-test.el
@@ -211,7 +211,7 @@ sunt in culpa qui officia deserunt mollit anim id est 
laborum.")
     (when (file-exists-p w-file)
       (setq ret 't)
       (delete-file w-file))
-    (symbol-value 'ret)))
+    ret))
 
 (ert-deftest ergoemacs-test-global-key-set-before-1 ()
   "Test global set key before ergoemacs-mode loads."
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 0a31b34..23c7fa6 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -51,6 +51,9 @@
 ;; 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+(require 'ergoemacs-advices)
+
 (defgroup ergoemacs-themes nil
   "Default Ergoemacs Layout"
   :group 'ergoemacs-mode)
@@ -167,15 +170,42 @@
                  (list (sexp :tag "Command")
                        (string :tag "Short Name"))))
 ;; Dummy variables
-(setq ergoemacs-component-version-curr nil
-      ergoemacs-component-version-list nil
-      ergoemacs-component-version-fixed-layout nil
-      ergoemacs-component-version-fixed-layout-rm nil
-      ergoemacs-component-version-redundant-keys nil
-      ergoemacs-component-version-minor-mode-layout nil
-      ergoemacs-component-version-variable-layout-rm nil
-      ergoemacs-component-version-variable-layout nil
-      ergoemacs-theme-save-variable '())
+(defvar ergoemacs-component-version-curr nil)
+(defvar ergoemacs-component-version-list nil)
+(defvar ergoemacs-component-version-fixed-layout nil)
+(defvar ergoemacs-component-version-fixed-layout-rm nil)
+(defvar ergoemacs-component-version-redundant-keys nil)
+(defvar ergoemacs-component-version-minor-mode-layout nil)
+(defvar ergoemacs-component-version-variable-layout-rm nil)
+(defvar ergoemacs-component-version-variable-layout nil)
+
+(defvar ergoemacs-theme-save-variables '())
+
+(defvar skip-first)
+(defvar component-version)
+(defvar minor-mode-layout)
+(defvar fixed-layout) (defvar variable-layout)
+(defvar fixed-layout-rm) (defvar variable-layout-rm)
+(defvar redundant-keys) (defvar defined-keys)
+(defvar versions)
+
+(defvar ergoemacs-hook)
+(defvar ergoemacs-hook-modify-keymap)
+(defvar ergoemacs-hook-full-shortcut-map)
+(defvar ergoemacs-hook-always)
+
+(defun ergoemacs--with-hook (hook plist body)
+  (let ((ergoemacs-hook hook)
+        (ergoemacs-hook-modify-keymap
+         (or (plist-get plist ':modify-keymap)
+             (plist-get plist ':modify-map)))
+        (ergoemacs-hook-full-shortcut-map
+         (or (plist-get plist ':full-shortcut-keymap)
+             (plist-get plist ':full-shortcut-map)
+             (plist-get plist ':full-map)
+             (plist-get plist ':full-keymap)))
+        (ergoemacs-hook-always (plist-get plist ':always)))
+    (funcall body)))
 
 (defun ergoemacs--parse-keys-and-body (keys-and-body &optional is-theme)
   "Split KEYS-AND-BODY into keyword-and-value pairs and the remaining body.
@@ -210,12 +240,13 @@ particular it:
     ;; Allow
     ;; (component name)
     (unless (or (keywordp (first remaining)) (boundp 'skip-first))
-      (if (condition-case nil
-              (stringp (first remaining))
-            (error nil))
-          (push `(:name . ,(pop remaining)) extracted-key-accu)
-        (push `(:name . ,(symbol-name (pop remaining))) extracted-key-accu))
-      (when (memq (type-of (first remaining)) '(symbol cons))
+      (push `(:name . ,(if (condition-case nil
+                               (stringp (first remaining))
+                             (error nil))
+                           (pop remaining)
+                         (symbol-name (pop remaining))))
+            extracted-key-accu)
+      (when (or (consp (first remaining)) (symbolp (first remaining)))
         (pop remaining))
       (when (stringp (first remaining))
         (push `(:description . ,(pop remaining)) extracted-key-accu)))
@@ -239,87 +270,43 @@ particular it:
                (cond
                 (last-was-version
                  (setq last-was-version nil)
-                 (if (stringp elt)
-                     `(when (boundp 'component-version) (setq 
component-version ,elt))
-                   `(when (boundp 'component-version) (setq component-version 
,(symbol-name elt)))))
-                ((condition-case nil
-                     (eq elt ':version)
-                   (error nil))
+                 `(when (boundp 'component-version)
+                    (setq component-version
+                          ,(if (stringp elt) elt (symbol-name elt)))))
+                ((eq elt ':version)
                  (setq last-was-version t)
                  nil)
-                ((condition-case err
-                     (eq (nth 0 elt) 'global-reset-key)
-                   (error nil))
+                ((eq (car-safe elt) 'global-reset-key)
                  `(ergoemacs-theme-component--global-reset-key ,(nth 1 elt)))
-                ((condition-case err
-                     (eq (nth 0 elt) 'global-unset-key)
-                   (error nil))
+                ((eq (car-safe elt) 'global-unset-key)
                  `(ergoemacs-theme-component--global-set-key ,(nth 1 elt) nil))
-                ((condition-case err
-                     (eq (nth 0 elt) 'setq)
-                   (error nil))
+                ((eq (car-safe elt) 'setq)
                  ;; Currently doesn't support (setq a b c d ), but it should.
                  `(ergoemacs-theme-component--set (quote ,(nth 1 elt)) ,(nth 2 
elt)))
-                ((condition-case err
-                     (eq (nth 0 elt) 'set)
-                   (error nil))
+                ((eq (car-safe elt) 'set)
                  `(ergoemacs-theme-component--set (nth 1 elt) ,(nth 2 elt)))
-                ((condition-case err
-                     (string-match "-mode$" (symbol-name (nth 0 elt)))
-                   (error nil))
-                 `(ergoemacs-theme-component--mode (quote ,(nth 0 elt)) ,(nth 
1 elt)))
-                ((condition-case err
-                     (eq (nth 0 elt) 'global-set-key)
-                   (error nil))
-                 (if (condition-case nil
-                         (keymapp (symbol-value (nth 2 elt)))
-                       (error nil))
-                     (progn
-                       `(ergoemacs-theme-component--global-set-key ,(nth 1 
elt) (quote ,(nth 2 elt))))
-                   `(ergoemacs-theme-component--global-set-key ,(nth 1 elt) 
,(nth 2 elt))))
-                ((condition-case err
-                     (eq (nth 0 elt) 'define-key)
+                ((condition-case nil
+                     (string-match "-mode\\'" (symbol-name (nth 0 elt)))
                    (error nil))
+                 `(ergoemacs-theme-component--mode ',(nth 0 elt) ,(nth 1 elt)))
+                ((eq (car-safe elt) 'global-set-key)
+                 `(ergoemacs-theme-component--global-set-key
+                   ,(nth 1 elt) ',(nth 2 elt)))
+                ((eq (car-safe elt) 'define-key)
                  (if (equal (nth 1 elt) '(current-global-map))
-                     (if (condition-case nil
-                             (keymapp (symbol-value (nth 3 elt)))
-                           (error nil))
-                         `(ergoemacs-theme-component--global-set-key ,(nth 2 
elt) (quote ,(nth 3 elt)))
-                       `(ergoemacs-theme-component--global-set-key ,(nth 2 
elt) ,(nth 3 elt)))
-                   (if (condition-case nil
-                           (keymapp (symbol-value (nth 3 elt)))
-                         (error nil))
-                       `(ergoemacs-theme-component--define-key (quote ,(nth 1 
elt)) ,(nth 2 elt) (quote ,(nth 3 elt)))
-                     `(ergoemacs-theme-component--define-key (quote ,(nth 1 
elt)) ,(nth 2 elt) ,(nth 3 elt)))))
-                ((or (condition-case err
-                         (eq (nth 0 elt) 'with-hook)
-                       (error nil))
-                     (and (condition-case err
-                              (eq (nth 0 elt) 'when)
-                            (error nil))
-                          (condition-case err
-                              (string-match "-\\(hook\\|mode\\)$" (symbol-name 
(nth 1 elt)))
+                     `(ergoemacs-theme-component--global-set-key ,(nth 2 elt) 
',(nth 3 elt))
+                   `(ergoemacs-theme-component--define-key ',(nth 1 elt) ,(nth 
2 elt) ',(nth 3 elt))))
+                ((or (eq (car-safe elt) 'with-hook)
+                     (and (eq (car-safe elt) 'when)
+                          (condition-case nil
+                              (string-match "-\\(hook\\|mode\\)\\'"
+                                            (symbol-name (nth 1 elt)))
                             (error nil))))
-                 (let (tmp skip-first)
-                   (setq tmp (ergoemacs--parse-keys-and-body (cdr (cdr elt))))
-                   `(let ((ergoemacs-hook (quote ,(nth 1 elt)))
-                          (ergoemacs-hook-modify-keymap
-                           ,(or (plist-get (nth 0 tmp)
-                                           ':modify-keymap)
-                                (plist-get (nth 0 tmp)
-                                           ':modify-map)))
-                          (ergoemacs-hook-full-shortcut-map
-                           ,(or (plist-get (nth 0 tmp)
-                                           ':full-shortcut-keymap)
-                                (plist-get (nth 0 tmp)
-                                           ':full-shortcut-map)
-                                (plist-get (nth 0 tmp)
-                                           ':full-map)
-                                (plist-get (nth 0 tmp)
-                                           ':full-keymap)))
-                          (ergoemacs-hook-always ,(plist-get (nth 0 tmp)
-                                                             ':always)))
-                      ,@(nth 1 tmp))))
+                 (let* (skip-first
+                        (tmp (ergoemacs--parse-keys-and-body (cdr (cdr elt)))))
+                   `(ergoemacs--with-hook ',(nth 1 elt)
+                                          ',(nth 0 tmp)
+                                          (lambda () ,@(nth 1 tmp)))))
                 (t elt)))
              remaining)))
     (setq plist (loop for (key . value) in extracted-key-accu
@@ -353,17 +340,21 @@ particular it:
     (setq ergoemacs-component-version-curr component-version)
     (push ergoemacs-component-version-curr versions)
     (unless ergoemacs-component-version-minor-mode-layout
-      (setq ergoemacs-component-version-minor-mode-layout (symbol-value 
'ergoemacs-component-version-minor-mode-layout)))
+      (setq ergoemacs-component-version-minor-mode-layout 
ergoemacs-component-version-minor-mode-layout))
     (unless ergoemacs-component-version-fixed-layout
-      (setq ergoemacs-component-version-fixed-layout (symbol-value 
'fixed-layout)))
+      (setq ergoemacs-component-version-fixed-layout fixed-layout))
     (unless ergoemacs-component-version-fixed-layout-rm
-      (setq ergoemacs-component-version-fixed-layout-rm (symbol-value 
'fixed-layout-rm)))
+      (setq ergoemacs-component-version-fixed-layout-rm fixed-layout-rm))
     (unless ergoemacs-component-version-fixed-layout
-      (setq ergoemacs-component-version-variable-layout (symbol-value 
'variable-layout)))
+      (setq ergoemacs-component-version-variable-layout variable-layout))
     (unless ergoemacs-component-version-fixed-layout-rm
-      (setq ergoemacs-component-version-variable-layout-rm (symbol-value 
'variable-layout-rm)))
+      (setq ergoemacs-component-version-variable-layout-rm variable-layout-rm))
     (unless ergoemacs-component-version-redundant-keys
-      (setq ergoemacs-component-version-redundant-keys (symbol-value 
'redundant-keys)))))
+      (setq ergoemacs-component-version-redundant-keys redundant-keys))))
+
+(defvar ergoemacs-force-variable-reg)
+(defvar ergoemacs-variable-reg)
+(defvar ergoemacs-just-first-reg)
 
 (defun ergoemacs-theme-component--rm-key (key)
   "Remove KEY from `ergoemacs-mode' keymaps"
@@ -414,7 +405,7 @@ will take out KEY from 
`ergoemacs-component-version-redundant-keys'"
 When fixed-layout and variable-layout are bound"
   (cond
    ((and (boundp 'ergoemacs-hook)
-         (string-match "mode$" (symbol-name ergoemacs-hook)))
+         (string-match "mode\\'" (symbol-name ergoemacs-hook)))
     (ergoemacs-theme-component--define-key ergoemacs-hook key command))
    ((and (vectorp key) (eq (elt key 0) 'remap))
     (let ((ergoemacs-hook 'ergoemacs-mode)
@@ -443,14 +434,15 @@ When fixed-layout and variable-layout are bound"
       (if (not command)
           (mapc ;; Remove command from lists.
            (lambda(y)
-             (let (tmp '())
+             (let ((tmp '()))
                (mapc
                 (lambda(x)
                   (unless (equal (nth 0 x) kd)
                     (push x tmp)))
                 (symbol-value y))
                (set y tmp)))
-           '(ergoemacs-component-version-fixed-layout 
ergoemacs-component-version-variable-layout))
+           '(ergoemacs-component-version-fixed-layout
+             ergoemacs-component-version-variable-layout))
         (if (not variable-p)
             (progn ;; Fixed Layout component
               (setq ergoemacs-component-version-fixed-layout
@@ -485,7 +477,7 @@ When fixed-layout and variable-layout are bound"
          (not component-version)
          (boundp 'redundant-keys) (boundp 'defined-keys))
     (let ((kd (key-description key)) cd jf)
-      (if (not command) ; redundant key
+      (if (not command)                 ; redundant key
           (push kd redundant-keys)
         (setq cd (assoc command ergoemacs-function-short-names)) ; Short key 
description
         (when cd
@@ -534,10 +526,10 @@ When fixed-layout and variable-layout are bound"
              a-key
              jf found-1-p found-2-p)
         (when (and (boundp 'emulation-setup) (boundp 'ergoemacs-hook)
-                   (string-match "mode$" (symbol-name ergoemacs-hook)))
-          (add-to-list 'emulation-setup ergoemacs-hook nil 'eq))
+                   (string-match "mode\\'" (symbol-name ergoemacs-hook)))
+          (pushnew ergoemacs-hook emulation-setup :test #'eq))
         (when (boundp 'minor-mode-hook-list)
-          (add-to-list 'minor-mode-hook-list hook nil 'eq))
+          (pushnew hook minor-mode-hook-list :test #'eq))
         (when variable-p
           (setq variable-p t)
           (setq jf (if (boundp 'ergoemacs-force-variable-reg) 
ergoemacs-force-variable-reg
@@ -564,18 +556,22 @@ When fixed-layout and variable-layout are bound"
           ;; Keys are stored as ((hook keymap/t variable-p) ((key def)))
           (setq a-key (list hook (if modify-keymap-p keymap
                                    (or (and (boundp 'ergoemacs-hook)
-                                            (string-match "mode$" (symbol-name 
ergoemacs-hook))
-                                            ergoemacs-hook) t)) variable-p))
+                                            (string-match "mode\\'" 
(symbol-name ergoemacs-hook))
+                                            ergoemacs-hook)
+                                       t))
+                            variable-p))
           (setq minor-mode-layout
                 (mapcar
                  (lambda(elt)
                    (cond
                     ((eq (car elt) hook)
                      (let ((lst (car (cdr elt))))
-                       (add-to-list 'lst (if modify-keymap-p keymap
+                       (pushnew (if modify-keymap-p keymap
                                            (or (and (boundp 'ergoemacs-hook)
-                                                    (string-match "mode$" 
(symbol-name ergoemacs-hook))
-                                                    ergoemacs-hook) t))  nil 
'eq)
+                                                    (string-match "mode\\'" 
(symbol-name ergoemacs-hook))
+                                                    ergoemacs-hook)
+                                               t))
+                                lst :test #'eq)
                        (setq found-1-p t)
                        (list hook lst)))
                     ((equal (car elt) a-key)
@@ -599,12 +595,13 @@ When fixed-layout and variable-layout are bound"
           (unless found-1-p
             (push (list hook (list (if modify-keymap-p keymap
                                      (or (and (boundp 'ergoemacs-hook)
-                                              (string-match "mode$" 
(symbol-name ergoemacs-hook))
-                                              ergoemacs-hook) t)))) 
minor-mode-layout))
+                                              (string-match "mode\\'" 
(symbol-name ergoemacs-hook))
+                                              ergoemacs-hook)
+                                         t))))
+                  minor-mode-layout))
           (unless found-2-p
             (push (list a-key (list (list kd def)) always-run-p 
full-shortcut-p) minor-mode-layout))))))))
 
-
 (defun ergoemacs-theme-component--ignore-globally-defined-key (key)
   "Adds KEY to `ergoemacs-global-override-rm-keys' and 
`ergoemacs-global-override-map' if globally redefined."
   (let ((no-ergoemacs-advice t)
@@ -615,7 +612,7 @@ When fixed-layout and variable-layout are bound"
         (when (and (ergoemacs-global-changed-p key)
                    (or (commandp lk t)
                        (keymapp lk)))
-          (add-to-list 'ergoemacs-global-override-rm-keys key)
+          (pushnew key ergoemacs-global-override-rm-keys :test #'equal)
           (throw 'found-global-command t))
         (setq key (substring key 0 (- (length key) 1)))))))
 
@@ -632,9 +629,9 @@ DEF can be:
 
 "
   (cond
-   ((eq 'cons (type-of def))
+   ((consp def)
     (let (found)
-      (if (condition-case err
+      (if (condition-case nil
               (stringp (nth 0 def))
             (error nil))
           (progn
@@ -647,15 +644,15 @@ DEF can be:
         (mapc
          (lambda(new-def)
            (unless found
-             (when (condition-case err
+             (when (condition-case nil
                        (interactive-form new-def)
                      (error nil))
                (setq found
                      (ergoemacs-theme-component--define-key-in-keymaps
                       keymap keymap-shortcut key new-def)))))
          def))
-      (symbol-value 'found)))
-   ((condition-case err
+      found))
+   ((condition-case nil
         (interactive-form def)
       (error nil))
     (cond
@@ -682,20 +679,22 @@ DEF can be:
       (ergoemacs-theme-component--ignore-globally-defined-key key)
       (define-key keymap key def)))
     t)
-   ((condition-case err
+   ((condition-case nil
         (keymapp (symbol-value def))
       (error nil))
     (ergoemacs-theme-component--ignore-globally-defined-key key)
     (define-key keymap key (symbol-value def))
     t)
-   ((condition-case err
+   ((condition-case nil
         (or (vectorp def) (stringp def))
       (error nil))
     (progn
       (when (boundp 'shortcut-list)
         (push (list (read-kbd-macro (key-description key) t)
                     `(,(if (stringp def) def
-                         (key-description def)) nil)) shortcut-list))
+                         (key-description def))
+                      nil))
+              shortcut-list))
       (if (ergoemacs-is-movement-command-p def)
           (if (let (case-fold-search) (string-match "\\(S-\\|[A-Z]$\\)" 
(key-description key)))
               (progn
@@ -766,14 +765,14 @@ Formatted for use with `ergoemacs-theme-component-hash' 
it will return ::version
           (if best-version
               (setq ret (concat "::" best-version))
             (setq ret (concat "::" smallest-version))))
-        (symbol-value 'ret))
+        ret)
     ""))
 
 (defun ergoemacs-theme--install-shortcut-item (key args keymap lookup-keymap
                                                    full-shortcut-map-p)
   (let (fn-lst)
     (cond
-     ((condition-case err
+     ((condition-case nil
           (interactive-form (nth 0 args))
         (error nil))
       (setq fn-lst (ergoemacs-shortcut-remap-list
@@ -833,7 +832,7 @@ When map-name is t or ends in -mode, it is for a keymap put 
in
 
 This function does not finalize maps by installing them into the original maps.
 "
-  (if (eq (type-of component) 'cons)
+  (if (consp component)
       (let ((ret nil) ;; List of components.
             already-done-list
             (version version)
@@ -893,7 +892,7 @@ This function does not finalize maps by installing them 
into the original maps.
                     (push keymap-list ret)))
                 new-ret))))
          (reverse component))
-        (symbol-value 'ret))
+        ret)
     ;; Single component
     (let ((true-component (replace-regexp-in-string ":\\(fixed\\|variable\\)" 
""
                                                     (or (and (stringp 
component) component)
@@ -907,7 +906,7 @@ This function does not finalize maps by installing them 
into the original maps.
           (version (or version (ergoemacs-theme-get-version)))
           minor-alist keymap-list shortcut-list
           always-p full-shortcut-map-p ret already-done-list)
-      (when (string-match "::\\([0-9.]+\\)$" true-component)
+      (when (string-match "::\\([0-9.]+\\)\\'" true-component)
         (setq version (match-string 1 true-component)
               true-component (replace-match "" nil nil true-component)))
       (if (not version)
@@ -953,7 +952,8 @@ This function does not finalize maps by installing them 
into the original maps.
                       (reverse keys))
                      (unless (equal map '(keymap))
                        (push `(,map-name ,always-p ,map
-                                         ,full-shortcut-map-p) fixed-maps)))))
+                                         ,full-shortcut-map-p)
+                             fixed-maps)))))
                keymap-list)
               (unless (equal fixed-maps '())
                 (puthash (concat true-component version ":" (symbol-name hook) 
":maps") fixed-maps
@@ -1036,14 +1036,14 @@ This function does not finalize maps by installing them 
into the original maps.
                    (push 'keymap composed-map)
                    (setq tmp `(,map-name ,(or (nth 1 keymap-list) (nth 1 
fixed-map))
                                          ,composed-map ,full-shortcut-map-p))
-                   (symbol-value 'tmp))))
+                   tmp)))
              variable-maps))
       (mapc
        (lambda(keymap-list)
          (unless (member (nth 0 keymap-list) already-done-list)
            (push keymap-list ret)))
        fixed-maps)
-      (symbol-value 'ret))))
+      ret)))
 
 (defun ergoemacs-theme-component-keymaps (component &optional version)
   "Gets the keymaps for COMPONENT for component VERSION.
@@ -1056,9 +1056,8 @@ components listed.
 
 Returns list of: read-keymap shortcut-keymap keymap shortcut-list 
unbind-keymap rm-keys emulation-setup vars.
 "
-  (if (eq (type-of component) 'cons)
-      (let ((ret nil)
-            k-l
+  (if (consp component)
+      (let (k-l
             (l0 '())
             (l1 '())
             (l2 '())
@@ -1107,14 +1106,13 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
              (when (nth 7 new-ret)
                (setq l7 (append l7 (nth 7 new-ret))))))
          (reverse component))
-        (setq ret
-              (list
-               (make-composed-keymap l0)
-               (make-composed-keymap l1)
-               (make-composed-keymap l2)
-               l3
-               (make-composed-keymap l4)
-               l5 l6 l7)))
+        (list
+         (make-composed-keymap l0)
+         (make-composed-keymap l1)
+         (make-composed-keymap l2)
+         l3
+         (make-composed-keymap l4)
+         l5 l6 l7))
     (let (fixed-shortcut
           fixed-read
           fixed-shortcut-list
@@ -1141,7 +1139,7 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
                                                        (symbol-name 
component))))
           (only-fixed (string-match ":fixed" (or (and (stringp component) 
component)
                                                  (symbol-name component)))))
-      (when (string-match "::\\([0-9.]+\\)$" true-component)
+      (when (string-match "::\\([0-9.]+\\)\\'" true-component)
         (setq version (match-string 1 true-component))
         (setq true-component (replace-match "" nil nil true-component)))
       (if (not version)
@@ -1179,11 +1177,12 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
             (setq fixed-read (make-sparse-keymap))
             (mapc
              (lambda(x)
-               (when (and (eq 'string (type-of (nth 0 x))))
+               (when (stringp (nth 0 x))
                  (setq trans-key (ergoemacs-get-kbd-translation (nth 0 x)))
                  (setq key (read-kbd-macro trans-key))
-                 (when (string-match "^\\([^ ]+\\) " (nth 0 x))
-                   (add-to-list 'input-keys (match-string 1 (nth 0 x))))
+                 (when (string-match "\\`'\\([^ ]+\\) " (nth 0 x))
+                   (pushnew (match-string 1 (nth 0 x)) input-keys
+                            :test #'equal))
                  (ergoemacs-theme-component--ignore-globally-defined-key key)
                  (setq cmd (nth 1 x))
                  (ergoemacs-theme-component--define-key-in-keymaps fixed 
fixed-shortcut key cmd)))
@@ -1230,10 +1229,11 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
             (setq variable-read (make-sparse-keymap))
             (mapc
              (lambda(x)
-               (when (and (eq 'string (type-of (nth 0 x))))
+               (when (stringp (nth 0 x))
                  (setq key (ergoemacs-kbd (nth 0 x) nil (nth 3 x)))
-                 (when (string-match "^\\([^ ]+\\) " (nth 0 x))
-                   (add-to-list 'input-keys (match-string 1 (nth 0 x))))
+                 (when (string-match "\\`\\([^ ]+\\) " (nth 0 x))
+                   (pushnew (match-string 1 (nth 0 x)) input-keys
+                            :test #'equal))
                  (setq cmd (nth 1 x))
                  (ergoemacs-theme-component--define-key-in-keymaps variable 
variable-shortcut key cmd)))
              (reverse key-list))
@@ -1258,17 +1258,16 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
             (puthash (concat true-component ":" ergoemacs-keyboard-layout 
version ":variable-rm") variable-rm ergoemacs-theme-component-cache)
             (puthash (concat true-component ":" ergoemacs-keyboard-layout 
version ":variable:shortcut:list") variable-shortcut-list
                      ergoemacs-theme-component-cache))))
-      (mapc
-       (lambda(var)
-         (when (equal (symbol-value var) '(keymap))
-           (set var nil)))
-       '(fixed-read
-         fixed-shortcut
-         fixed
-         variable-read
-         variable-shortcut
-         variable
-         unbind))
+      (let* ((empty-map (make-sparse-keymap))
+             (f (lambda (m) (unless (equal m empty-map) m))))
+        ;; Turn empty maps into nil values.
+        (setq fixed-read        (funcall f fixed-read))
+        (setq fixed-shortcut    (funcall f fixed-shortcut))
+        (setq fixed             (funcall f fixed))
+        (setq variable-read     (funcall f variable-read))
+        (setq variable-shortcut (funcall f variable-shortcut))
+        (setq variable          (funcall f variable))
+        (setq unbind            (funcall f unbind)))
       (cond
        ((and variable-rm fixed-rm)
         (setq rm-lst (append variable-rm fixed-rm)))
@@ -1309,12 +1308,12 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
   "Run `ergoemacs-mode' HOOK."
   (let (deactivate-mark
         ;; Emulation variable for map.
-        (emulation-var (if (not (string-match "mode$" (symbol-name hook)))
+        (emulation-var (if (not (string-match "mode\\'" (symbol-name hook)))
                            (intern (concat "ergoemacs--emulation-for-" 
(symbol-name hook)))
                          hook))
         (all-always-p t)
         x)
-    (unless (string-match "mode$" (symbol-name hook))
+    (unless (string-match "mode\\'" (symbol-name hook))
       (unless (boundp hook)
         (set-default hook nil)
         (set hook nil))
@@ -1328,7 +1327,7 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
                (replace (nth 2 x)))
            (cond
             ((or (and (eq hook map-name)
-                      (string-match "mode$" (symbol-name map-name))
+                      (string-match "mode\\'" (symbol-name map-name))
                       (not (member (list hook map-name)
                                    ergoemacs-theme-hook-installed)))
                  (and (eq map-name 't)
@@ -1346,7 +1345,7 @@ Returns list of: read-keymap shortcut-keymap keymap 
shortcut-list unbind-keymap
                  (setq all-always-p nil)
                (push (list hook map-name) ergoemacs-theme-hook-installed)))
             ((not (member (list hook map-name) ergoemacs-theme-hook-installed))
-             (unless (string-match "mode$" (symbol-name map-name))
+             (unless (string-match "mode\\'" (symbol-name map-name))
                (set map-name (copy-keymap replace)))
              (if always-modify-p
                  (setq all-always-p nil)
@@ -1363,112 +1362,116 @@ When REMOVE-P, remove the created ergoemacs-mode hook 
functions
 from the appropriate startup hooks.  Otherwise the hooks are
 added to the appropriate startup hooks.
 "
-  (if (eq (type-of component) 'cons)
-      (mapc
-       (lambda(c)
-         (ergoemacs-theme-component-make-hooks c remove-p))
-       component)
-    (let ((true-component (replace-regexp-in-string 
":\\(fixed\\|variable\\|:[0-9.]+\\)" ""
-                                                    (or (and (stringp 
component) component)
-                                                        (symbol-name 
component)))))
+  (if (consp component)
+      (dolist (c component)
+        (ergoemacs-theme-component-make-hooks c remove-p))
+    (let ((true-component (replace-regexp-in-string
+                           ":\\(fixed\\|variable\\|:[0-9.]+\\)" ""
+                           (or (and (stringp component) component)
+                               (symbol-name component)))))
       (mapc
        (lambda(hook)
-         (when (string-match "hook$" (symbol-name hook))
-           (eval (macroexpand
-                  `(defun ,(intern (concat "ergoemacs-for-" (symbol-name 
hook))) ()
-                     ,(format "Runs `ergoemacs-theme-hook' for `%s'" 
(symbol-name hook))
+         (when (string-match "hook\\'" (symbol-name hook))
+           (let ((fsym (intern (concat "ergoemacs-for-" (symbol-name hook)))))
+             (fset fsym
+                  `(lambda ()
+                     ,(format "Run `ergoemacs-theme-hook' for `%s'"
+                              (symbol-name hook))
                      (ergoemacs-theme-hook ',hook))))
-           (if remove-p
-               (eval
-                (macroexpand
-                 `(remove-hook ',hook ',(intern (concat "ergoemacs-for-" 
(symbol-name hook))))))
-             (eval
-              (macroexpand
-               `(add-hook ',hook ',(intern (concat "ergoemacs-for-" 
(symbol-name hook)))))))))
-       (gethash (concat true-component ":minor-list") 
ergoemacs-theme-component-hash)))))
+           (funcall (if remove-p #'remove-hook #'add-hook) hook fsym)))
+       (gethash (concat true-component ":minor-list")
+                ergoemacs-theme-component-hash)))))
+
+(defun ergoemacs--theme-component (plist body)
+  (let ((name (plist-get plist ':name))
+       (desc (or (plist-get plist ':description) ""))
+       (layout (or (plist-get plist ':layout) "us"))
+       (ergoemacs-variable-reg (or (plist-get plist ':variable-reg)
+                                   (concat "\\(?:^\\|<\\)" (regexp-opt '("M-" 
"<apps>" "<menu>")))))
+       (ergoemacs-just-first-reg (or (plist-get plist ':first-is-variable-reg)
+                                     nil))
+       (versions '())
+       (component-version nil)
+       (ergoemacs-component-version-variable-layout nil)
+       (ergoemacs-component-version-variable-layout-rm nil)
+       (ergoemacs-component-version-fixed-layout nil)
+       (ergoemacs-component-version-fixed-layout-rm nil)
+       (ergoemacs-component-version-redundant-keys nil)
+       (ergoemacs-component-version-minor-mode-layout nil)
+       (ergoemacs-component-version-curr nil)
+       (ergoemacs-component-version-list '())
+       (defined-keys '())
+       (variable-layout '())
+       (variable-layout-rm '())
+       (fixed-layout '())
+       (fixed-layout-rm '())
+       (defined-commands '())
+       (minor-mode-layout '())
+       (minor-mode-hook-list '())
+       (emulation-setup '())
+       (redundant-keys '())
+       (ergoemacs-translation-from ergoemacs-translation-from)
+       (ergoemacs-translation-to ergoemacs-translation-to)
+       (ergoemacs-shifted-assoc ergoemacs-shifted-assoc)
+       (ergoemacs-needs-translation ergoemacs-needs-translation)
+       (ergoemacs-translation-assoc ergoemacs-translation-assoc)
+       (ergoemacs-translation-regexp ergoemacs-translation-regexp)
+       (case-fold-search nil)
+       (ergoemacs-theme-save-variables '()))
+    (when (ad-is-advised 'define-key)
+      ;; FIXME:
+      ;; - AFAICT, this advice is never re-enabled.
+      ;; - ad-disable-advice only marks the advice as disabled, but doesn't
+      ;;   actually disable it yet (we'd need to deactivate+reactivate the
+      ;;   advice for that).
+      (ad-disable-advice 'define-key 'around 'ergoemacs-define-key-advice))
+    (ergoemacs-setup-translation "us" layout) ; Make sure keys are
+                                             ; stored in QWERTY
+                                             ; notation.
+    (funcall body)
+    ;; Finalize version setup
+    (when ergoemacs-component-version-curr
+      (push (list ergoemacs-component-version-curr
+                 ergoemacs-component-version-fixed-layout
+                 ergoemacs-component-version-variable-layout
+                 ergoemacs-component-version-redundant-keys
+                 ergoemacs-component-version-minor-mode-layout
+                 ergoemacs-component-version-fixed-layout-rm
+                 ergoemacs-component-version-variable-layout-rm)
+           ergoemacs-component-version-list))
+    (puthash (concat name ":plist") plist ergoemacs-theme-component-hash)
+    (puthash (concat name ":fixed") fixed-layout 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":fixed-rm") fixed-layout-rm 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":variable") variable-layout 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":variable-rm") variable-layout-rm 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":version") versions ergoemacs-theme-component-hash)
+    (puthash (concat name ":redundant") redundant-keys 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":minor") minor-mode-layout 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":minor-list") minor-mode-hook-list 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":emulation") emulation-setup 
ergoemacs-theme-component-hash)
+    (puthash (concat name ":vars") ergoemacs-theme-save-variables 
ergoemacs-theme-component-hash)
+    (mapc
+     (lambda(x)
+       (let ((ver (nth 0 x))
+            (fixed (nth 1 x))
+            (var (nth 2 x))
+            (red (nth 3 x))
+            (fixed-rm (nth 4 x))
+            (var-rm (nth 5 x)))
+        (puthash (concat name "::" ver ":fixed") fixed 
ergoemacs-theme-component-hash)
+        (puthash (concat name "::" ver ":variable") var 
ergoemacs-theme-component-hash)
+        (puthash (concat name "::" ver ":redundant") var 
ergoemacs-theme-component-hash)
+        (puthash (concat name "::" ver ":fixed-rm") fixed-rm 
ergoemacs-theme-component-hash)
+        (puthash (concat name "::" ver ":variable-rm") var-rm 
ergoemacs-theme-component-hash)))
+     ergoemacs-component-version-list)))
 
 (defmacro ergoemacs-theme-component (&rest body-and-plist)
   "A component of an ergoemacs-theme."
   (declare (doc-string 2)
            (indent 2))
-  (let ((kb (make-symbol "body-and-plist")))
-    (setq kb (ergoemacs--parse-keys-and-body body-and-plist))
-    `(let ((name ,(plist-get (nth 0 kb) ':name))
-           (desc ,(or (plist-get (nth 0 kb) ':description) ""))
-           (layout ,(or (plist-get (nth 0 kb) ':layout) "us"))
-           (ergoemacs-variable-reg ,(or (plist-get (nth 0 kb) ':variable-reg)
-                                        (concat "\\(?:^\\|<\\)" (regexp-opt 
'("M-" "<apps>" "<menu>")))))
-           (ergoemacs-just-first-reg ,(or (plist-get (nth 0 kb) 
':first-is-variable-reg)
-                                          nil))
-           (versions '())
-           (component-version nil)
-           (ergoemacs-component-version-variable-layout nil)
-           (ergoemacs-component-version-variable-layout-rm nil)
-           (ergoemacs-component-version-fixed-layout nil)
-           (ergoemacs-component-version-fixed-layout-rm nil)
-           (ergoemacs-component-version-redundant-keys nil)
-           (ergoemacs-component-version-minor-mode-layout nil)
-           (ergoemacs-component-version-curr nil)
-           (ergoemacs-component-version-list '())
-           (defined-keys '())
-           (variable-layout '())
-           (variable-layout-rm '())
-           (fixed-layout '())
-           (fixed-layout-rm '())
-           (defined-commands '())
-           (minor-mode-layout '())
-           (minor-mode-hook-list '())
-           (emulation-setup '())
-           (redundant-keys '())
-           (ergoemacs-translation-from ergoemacs-translation-from)
-           (ergoemacs-translation-to ergoemacs-translation-to)
-           (ergoemacs-shifted-assoc ergoemacs-shifted-assoc)
-           (ergoemacs-needs-translation ergoemacs-needs-translation)
-           (ergoemacs-translation-assoc ergoemacs-translation-assoc)
-           (ergoemacs-translation-regexp ergoemacs-translation-regexp)
-           (case-fold-search nil)
-           (ergoemacs-theme-save-variables '()))
-       (when (ad-is-advised 'define-key)
-         (ad-disable-advice 'define-key 'around 'ergoemacs-define-key-advice))
-       (ergoemacs-setup-translation "us" layout) ; Make sure keys are
-                                        ; stored in QWERTY
-                                        ; notation.
-       ,@(nth 1 kb)
-       ;; Finalize version setup
-       (when ergoemacs-component-version-curr
-         (push (list ergoemacs-component-version-curr
-                     ergoemacs-component-version-fixed-layout
-                     ergoemacs-component-version-variable-layout
-                     ergoemacs-component-version-redundant-keys
-                     ergoemacs-component-version-minor-mode-layout
-                     ergoemacs-component-version-fixed-layout-rm
-                     ergoemacs-component-version-variable-layout-rm)
-               ergoemacs-component-version-list))
-       (puthash (concat name ":plist") ',(nth 0 kb) 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":fixed") (symbol-value 'fixed-layout) 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":fixed-rm") (symbol-value 'fixed-layout-rm) 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":variable") (symbol-value 'variable-layout) 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":variable-rm") (symbol-value 
'variable-layout-rm) ergoemacs-theme-component-hash)
-       (puthash (concat name ":version") versions 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":redundant") redundant-keys 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":minor") minor-mode-layout 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":minor-list") minor-mode-hook-list 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":emulation") emulation-setup 
ergoemacs-theme-component-hash)
-       (puthash (concat name ":vars") ergoemacs-theme-save-variables 
ergoemacs-theme-component-hash)
-       (mapc
-        (lambda(x)
-          (let ((ver (nth 0 x))
-                (fixed (nth 1 x))
-                (var (nth 2 x))
-                (red (nth 3 x))
-                (fixed-rm (nth 4 x))
-                (var-rm (nth 5 x)))
-            (puthash (concat name "::" ver ":fixed") fixed 
ergoemacs-theme-component-hash)
-            (puthash (concat name "::" ver ":variable") var 
ergoemacs-theme-component-hash)
-            (puthash (concat name "::" ver ":redundant") var 
ergoemacs-theme-component-hash)
-            (puthash (concat name "::" ver ":fixed-rm") fixed-rm 
ergoemacs-theme-component-hash)
-            (puthash (concat name "::" ver ":variable-rm") var-rm 
ergoemacs-theme-component-hash)))
-        ergoemacs-component-version-list))))
+  (let ((kb (ergoemacs--parse-keys-and-body body-and-plist)))
+    `(ergoemacs--theme-component ',(nth 0 kb) (lambda () ,@(nth 1 kb)))))
+
 ;;; Theme functions
 
 (defun ergoemacs-theme-set-version (version)
@@ -1505,18 +1508,18 @@ added to the appropriate startup hooks.
                (or (and (stringp component) component)
                    (symbol-name component))))
              vers)
-         (when (string-match "::\\([0-9.]+\\)$" true-component)
+         (when (string-match "::\\([0-9.]+\\)\\'" true-component)
            (setq true-component (replace-match "" nil nil true-component)))
          (mapc
           (lambda(ver)
-            (add-to-list 'versions ver))
+            (pushnew ver versions :test #'equal))
           (gethash (concat true-component ":version")
                    ergoemacs-theme-component-hash))))
      (append (plist-get theme-plist ':optional-off)
              (plist-get theme-plist ':optional-on)
              (plist-get theme-plist ':components)))
     (setq versions (sort versions 'string<))
-    (symbol-value 'versions)))
+    versions))
 
 (defun ergoemacs-theme-components (theme)
   "Get a list of components used for the current theme.
@@ -1544,7 +1547,7 @@ This respects `ergoemacs-theme-options'."
              (push x components)))))
      (reverse (plist-get theme-plist ':optional-off)))
     (setq components (reverse components))
-    (symbol-value 'components)))
+    components))
 
 (defun ergoemacs-theme-make-hooks (theme &optional remove-p)
   "Creates hooks for THEME.
@@ -1581,7 +1584,7 @@ Uses `ergoemacs-theme-component-keymaps-for-hook' and
     (mapcar
      (lambda(c)
        (if (or (eq (nth 0 c) 't)
-               (and (string-match "mode$" (symbol-name (nth 0 c)))
+               (and (string-match "mode\\'" (symbol-name (nth 0 c)))
                     (eq (nth 0 c) hook)))
            (progn
              (list (nth 0 c) (nth 1 c) (nth 2 c)))
@@ -1662,7 +1665,7 @@ and it dosen't show up on the ergoemacs-mode menu.
 TYPE can also be 'off, where the option will be included in the
 theme, but assumed to be disabled by default.
 "
-  (if (eq (type-of option) 'cons)
+  (if (consp option)
       (mapc
        (lambda(new-option)
          (let (ergoemacs-mode)
@@ -1694,7 +1697,7 @@ theme, but assumed to be disabled by default.
          (setq theme-plist (plist-put theme-plist ':optional-off off))
          (puthash (if (stringp theme) theme (symbol-name theme)) theme-plist
                   ergoemacs-theme-hash)))
-     (or (and theme (or (and (eq (type-of theme) 'cons) theme) (list theme)))
+     (or (and theme (if (consp theme) theme (list theme)))
          (ergoemacs-get-themes)))))
   (ergoemacs-theme-option-on option))
 
@@ -1703,7 +1706,7 @@ theme, but assumed to be disabled by default.
   "Turns OPTION on.
 When OPTION is a list turn on all the options in the list
 If OFF is non-nil, turn off the options instead."
-  (if (eq (type-of option) 'cons)
+  (if (consp option)
       (mapc
        (lambda(new-option)
          (let (ergoemacs-mode)
@@ -1904,7 +1907,7 @@ If OFF is non-nil, turn off the options instead."
        (lambda()
          (interactive)
          (set-default 'ergoemacs-smart-paste 'browse-kill-ring))
-       :enable (condition-case err (interactive-form 'browse-kill-ring)
+       :enable (condition-case nil (interactive-form 'browse-kill-ring)
                  (error nil))
        :button (:radio . (eq ergoemacs-smart-paste 'browse-kill-ring)))))
     (ergoemacs-sep-bash "--")
@@ -1932,7 +1935,7 @@ If OFF is non-nil, turn off the options instead."
              (ergoemacs-menus-on))
          (when (featurep 'ergoemacs-menus)
            (ergoemacs-menus-off))))
-     :button (:radio . (symbol-value 'ergoemacs-use-menus)))
+     :button (:radio . ergoemacs-use-menus))
     (ergoemacs-save
      menu-item "Save Settings for Future Sessions"
      (lambda ()
@@ -2027,18 +2030,18 @@ Uses `ergoemacs-theme-component-keymaps' and 
`ergoemacs-theme-components'"
     (push menu-keymap keys)
     (push 'keymap keys)
     (setq ret`(,@prior ,keys ,@ret))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-theme-restore-maps (&optional no-message)
   "Restore original keymaps.
 When NO-MESSAGE is true, don't tell the user."
   (mapc
    (lambda(x)
-     (when (eq 'cons (type-of x))
+     (when (consp x)
        (let ((hook (nth 0 x))
              (map-name (nth 1 x))
              orig-map)
-         (unless (string-match "-mode$" (symbol-name map-name))
+         (unless (string-match "-mode\\'" (symbol-name map-name))
            (unless (eq map-name 't)
              (setq orig-map
                    (gethash (concat (symbol-name map-name) (symbol-name hook) 
":original-map") ergoemacs-theme-component-cache))
@@ -2097,10 +2100,10 @@ Returns new keymap."
                    map)
                  new-keymap))
           (push 'keymap new-keymap)
-          (symbol-value 'new-keymap))
+          new-keymap)
          (t
           (define-key new-keymap key nil)
-          (symbol-value 'new-keymap))))))
+          new-keymap)))))
 
 (defvar ergoemacs-theme-hook nil)
 (defun ergoemacs-theme-remove-key-list (list &optional no-message dont-install)
@@ -2191,7 +2194,7 @@ This also:
           (mapcar
            (lambda(x)
              (let (val val2)
-               (if (condition-case err (or (= 1 (nth 1 x)) (= -1 (nth 1 x))) 
(error nil))
+               (if (condition-case nil (or (= 1 (nth 1 x)) (= -1 (nth 1 x))) 
(error nil))
                    (progn
                      (funcall (nth 0 x) (nth 1 x))
                      (setq val (if (= (nth 1 x) 1) -1 1)))
@@ -2212,7 +2215,7 @@ This also:
           (mapcar
            (lambda(x)
              (let (val val2)
-               (if (condition-case err (or (= 1 (nth 1 x)) (= -1 (nth 1 x))) 
(error nil))
+               (if (condition-case nil (or (= 1 (nth 1 x)) (= -1 (nth 1 x))) 
(error nil))
                    (progn
                      (funcall (nth 0 x) (nth 1 x))
                      (setq val (if (= 1 (nth 1 x)) -1 1)))
@@ -2329,7 +2332,7 @@ When SILENT is true, also include silent themes"
                     (append (gethash "defined-themes" ergoemacs-theme-hash)
                             (gethash "silent-themes" ergoemacs-theme-hash)))
                (gethash "defined-themes" ergoemacs-theme-hash))))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-get-themes-type (&optional silent)
   "Gets the customization types for `ergoemacs-theme'"
@@ -2374,8 +2377,8 @@ DIFFERENCES are the differences from the layout based on 
the functions.  These a
 `ergoemacs-fixed-key' = defines/replace fixed key with function by 
(ergoemacs-fixed-key KEY FUNCTION DESCRIPTION)
 "
   (declare (indent 1))
-  `(let (silent pl tmp)
-     (setq pl (gethash (or ,based-on "standard") ergoemacs-theme-hash))
+  `(let ((pl (gethash (or ,based-on "standard") ergoemacs-theme-hash))
+        silent tmp)
      (plist-put pl ':name ,(symbol-name name))
      (setq tmp (eval (plist-get pl ':components)))
      (push (intern (concat ,(symbol-name name) "-theme")) tmp)
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 7172419..a13481a 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -36,6 +36,12 @@
 (require 'advice)
 (require 'ergoemacs-theme-engine)
 
+;; (defvar skip-first)
+;; (defvar component-version)
+;; (defvar fixed-layout) (defvar variable-layout)
+;; (defvar fixed-layout-rm) (defvar variable-layout-rm)
+;; (defvar redundant-keys) (defvar defined-keys)
+;; (defvar versions)
 
 (ergoemacs-theme-component standard-vars ()
   "Enabled/changed variables/modes"
diff --git a/ergoemacs-track.el b/ergoemacs-track.el
index 426caa2..32cbf9a 100644
--- a/ergoemacs-track.el
+++ b/ergoemacs-track.el
@@ -215,7 +215,7 @@
                         'home)
                        ((= 4 (nth i ergoemacs-track-row))
                         'bottom))))
-     (symbol-value 'ret))))
+     ret)))
 
 (defvar ergoemacs-key-hash nil
   "Key hash")
@@ -249,7 +249,7 @@ LAST-PLIST is the last property list returned by this 
function or nil if nothing
   (if layout
       (let ((ret (gethash (cons (cons key1 key2) (cons last-plist layout)) 
ergoemacs-key-hash)))
         (if ret
-            (symbol-value 'ret)
+            ret
           (let ((kp1 (gethash (cons layout key1) ergoemacs-key-hash))
                 (kp2 (gethash (cons layout key2) ergoemacs-key-hash))
                 kpl kpl1
@@ -411,7 +411,7 @@ LAST-PLIST is the last property list returned by this 
function or nil if nothing
                              :finger-n ,(plist-get kp2 :finger-n)
                              :key ,key2)))))
           (puthash (cons (cons key1 key2) (cons last-plist layout)) ret 
ergoemacs-key-hash)
-          (symbol-value 'ret)))
+          ret))
     (let (ret)
       (setq ret
             (mapcar
@@ -427,7 +427,7 @@ LAST-PLIST is the last property list returned by this 
function or nil if nothing
                  (puthash lay (+ dist (plist-get ret :d)) 
ergoemacs-distance-hash)
                  `(,lay ,ret)))
              (ergoemacs-get-layouts)))
-      (symbol-value 'ret))))
+      ret)))
 
 (defvar ergoemacs-last-distance-plist nil
   "Last distance plist")
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index 5ce3345..181d6e5 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -80,7 +80,7 @@
           ;; 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))
-          (symbol-value 'ret)))
+          ret))
     (error nil)))
 
 (defvar ergoemacs-use-unicode-char t
@@ -103,7 +103,7 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  When
   (if (not code) ""
     (let (deactivate-mark
           (ret (replace-regexp-in-string
-                " +$" "" (replace-regexp-in-string "^ +" "" code)))
+                " +\\'" "" (replace-regexp-in-string "\\` +" "" code)))
           (case-fold-search nil)) 
       (when ergoemacs-use-ergoemacs-key-descriptions
         (save-match-data
@@ -197,7 +197,7 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  When
               (while (re-search-forward "Ctl[+]" nil t)
                 (replace-match "^")))
             (setq ret (buffer-string)))))
-      (symbol-value 'ret))))
+      ret)))
 
 (defun ergoemacs-pretty-key-rep-internal ()
   (let (case-fold-search)
@@ -227,7 +227,7 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  When
               (insert code)
               (ergoemacs-pretty-key-rep-internal)
               (setq ret (buffer-string)))))
-        (symbol-value 'ret))
+        ret)
     (when ergoemacs-use-ergoemacs-key-descriptions
       (ergoemacs-pretty-key-rep-internal))))
 
@@ -253,7 +253,7 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  When
           ;; 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))
-          (symbol-value 'ret)))
+          ret))
     (error nil)))
 
 ;;; Actual Translations
@@ -365,7 +365,7 @@ This also creates functions:
 
     (eval (macroexpand
            `(defvar ,(intern (concat "ergoemacs-" (symbol-name (plist-get 
arg-plist ':name)) "-modal-map"))
-              ',(symbol-value 'keymap-modal)
+              ',keymap-modal
               ,(concat "Ergoemacs modal override map for "
                       (symbol-name (plist-get arg-plist ':name))
                       " translation.
@@ -373,7 +373,7 @@ This keymap is made in `ergoemacs-translation'"))))
 
     (eval (macroexpand
            `(defvar ,(intern (concat "ergoemacs-" (symbol-name (plist-get 
arg-plist ':name)) "-translation-local-map"))
-              ',(symbol-value 'keymap)
+              ',keymap
               ,(concat "Ergoemacs translation local map for "
                       (symbol-name (plist-get arg-plist ':name))
                       " translation setup.
@@ -609,7 +609,7 @@ Translates C-A into C-S-a."
             (setq ret (concat (match-string 1 ret)
                               (match-string 2 ret)
                               (upcase (match-string 3 ret)))))))
-      (symbol-value 'ret))))
+      ret)))
 
 (defun ergoemacs-shift-translate-install (trans-plist ret-plist)
   "Install shift translation"
@@ -634,7 +634,7 @@ Translates C-A into C-S-a."
       (setq ret (plist-put ret name shift-translated))
       (setq ret (plist-put ret k (read-kbd-macro shift-translated t)))
       (setq ret (plist-put ret p (ergoemacs-pretty-key shift-translated))))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-translation-install (trans-plist orig-key ret-plist)
   "Installs the translation.
@@ -720,7 +720,7 @@ properties are also added:
     (setq ret (plist-put ret key (read-kbd-macro new-key t)))
     (setq ret (plist-put ret pretty (ergoemacs-pretty-key new-key)))
     (setq ret (ergoemacs-shift-translate-install trans-plist ret))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-translate (key)
   "Translates KEY and returns a plist of the translations.
@@ -849,9 +849,9 @@ and `ergoemacs-pretty-key' descriptions.
            (lambda(key plist)
              (setq ret (ergoemacs-translation-install plist orig-key ret)))
            ergoemacs-translations)
-          (puthash orig-key (symbol-value 'ret) ergoemacs-translate-hash)
-          (puthash key (symbol-value 'ret) ergoemacs-translate-hash)
-          (symbol-value 'ret)))))
+          (puthash orig-key ret ergoemacs-translate-hash)
+          (puthash key ret ergoemacs-translate-hash)
+          ret))))
 
 (defun ergoemacs-setup-translation (layout &optional base-layout)
   "Setup translation from BASE-LAYOUT to LAYOUT."
@@ -946,7 +946,7 @@ If JUST-TRANSLATE is non-nil, just return the KBD code, not 
the actual emacs key
       (let ((new-key (gethash `(,key ,just-translate ,only-first 
,ergoemacs-translation-from ,ergoemacs-translation-to)
                               ergoemacs-kbd-hash)))
         (if new-key
-            (symbol-value 'new-key)
+            new-key
           (setq new-key key)
           (cond
            ((eq system-type 'windows-nt)
@@ -990,6 +990,7 @@ If JUST-TRANSLATE is non-nil, just return the KBD code, not 
the actual emacs key
 For example, on dvorak, change C-j to C-c (copy/command)."
   :type 'boolean
   :set 'ergoemacs-set-default
+  :initialize #'custom-initialize-default
   :group 'ergoemacs-mode)
 
 (defun ergoemacs-get-kbd-translation (pre-kbd-code &optional dont-swap)
@@ -998,7 +999,7 @@ For example, on dvorak, change C-j to C-c (copy/command)."
               "[Cc]\\(?:on\\)?tro?l[+-]" "C-"
               (replace-regexp-in-string
                "[Aa]lt[+-]" "M-" pre-kbd-code))))
-    (symbol-value 'ret)))
+    ret))
 
 (defun ergoemacs-key-fn-lookup (function &optional use-apps)
   "Looks up the key binding for FUNCTION based on.
@@ -1017,7 +1018,7 @@ Based on `ergoemacs-with-ergoemacs'"
        (while (and ret (not (eq (elt (nth 0 ret) 0) 'apps)))
          (pop ret)))
      (setq ret (nth 0 ret))
-     (symbol-value 'ret))))
+     ret)))
 
 (provide 'ergoemacs-translate)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el
index bafed3c..b4e339b 100644
--- a/ergoemacs-unbind.el
+++ b/ergoemacs-unbind.el
@@ -30,6 +30,7 @@
 ;;; Code:
 
 (require 'edmacro)
+(eval-when-compile (require 'cl))
 
 (defvar ergoemacs-emacs-default-bindings
   '(
@@ -634,17 +635,22 @@
 (defvar ergoemacs-unbind-keymap (make-sparse-keymap)
   "Keymap for `ergoemacs-unbind-keys'")
 
-(defun ergoemacs-undefined (&optional arg)
+(defvar ergoemacs--last)
+(defvar ergoemacs--fn)
+
+(defvar ergoemacs-shortcut-keymap)
+(defvar ergoemacs-keymap)
+
+(defun ergoemacs-undefined ()
   "Ergoemacs Undefined key, tells where to perform the old action."
-  (interactive "P")
-  (let* ((key-kbd (or ergoemacs-single-command-keys 
(this-single-command-keys)))
+  (interactive)
+  (let* ((key-kbd (or ergoemacs-single-command-keys
+                      (this-single-command-keys)))
          (key (key-description key-kbd))
-         (fn (assoc key ergoemacs-emacs-default-bindings))
+         (ergoemacs--fn (assoc key ergoemacs-emacs-default-bindings))
          tmp
          (local-fn nil)
-         (last (substring key -1))
-         (ergoemacs-where-is-skip t)
-         (curr-fn nil))
+         (ergoemacs--last (substring key -1)))
     ;; Lookup local key, if present and then issue that
     ;; command instead...
     ;;
@@ -658,27 +664,26 @@
           ;; Lookup in ergoemacs-keymap
           (setq local-fn (lookup-key ergoemacs-keymap key-kbd)))
         (functionp local-fn))
-      (ergoemacs-debug "WARNING: The command %s is undefined when if shouldn't 
be..." local-fn)
+      (ergoemacs-debug "WARNING: The command %s is undefined when it shouldn't 
be..." local-fn)
       (ergoemacs-vars-sync) ;; Try to fix issue.
       (setq tmp (key-binding key-kbd))
       (when (and tmp (not (equal tmp 'ergoemacs-undefined)))
         (setq local-fn tmp))
-      (when (featurep 'keyfreq)
-        (when keyfreq-mode
-          (let ((command 'ergoemacs-undefined) count)
-            (setq count (gethash (cons major-mode command) keyfreq-table))
-            (cond
-             ((not count))
-             ((= count 1)
-              (remhash (cons major-mode command) keyfreq-table))
-             (count
-              (puthash (cons major-mode command) (- count 1)
-                       keyfreq-table)))
-            ;; Add local-fn to counter.
-            (setq command local-fn)
-            (setq count (gethash (cons major-mode command) keyfreq-table))
-            (puthash (cons major-mode command) (if count (+ count 1) 1)
-                     keyfreq-table))))
+      (when (and (boundp 'keyfreq-mode) keyfreq-mode (boundp 'keyfreq-table))
+        (let* ((command 'ergoemacs-undefined)
+               (count (gethash (cons major-mode command) keyfreq-table)))
+          (cond
+           ((not count))
+           ((= count 1)
+            (remhash (cons major-mode command) keyfreq-table))
+           (count
+            (puthash (cons major-mode command) (- count 1)
+                     keyfreq-table)))
+          ;; Add local-fn to counter.
+          (setq command local-fn)
+          (setq count (gethash (cons major-mode command) keyfreq-table))
+          (puthash (cons major-mode command) (if count (+ count 1) 1)
+                   keyfreq-table)))
       (setq this-command local-fn)
       (condition-case err
           (call-interactively local-fn)
@@ -688,7 +693,7 @@
         ;; defined there.
         (setq local-fn (get-char-property (point) 'local-map))
         (if (and local-fn
-                 (condition-case err
+                 (condition-case nil
                      (keymapp local-fn)
                    (error nil)))
             (setq local-fn (lookup-key local-fn key-kbd))
@@ -697,22 +702,21 @@
             (setq local-fn nil)))
         (functionp local-fn))
       (setq this-command local-fn) ; Don't record this command.
-      (when (featurep 'keyfreq)
-        (when keyfreq-mode
-          (let ((command 'ergoemacs-undefined) count)
-            (setq count (gethash (cons major-mode command) keyfreq-table))
-            (cond
-             ((not count))
-             ((= count 1)
-              (remhash (cons major-mode command) keyfreq-table))
-             (count
-              (puthash (cons major-mode command) (- count 1)
-                       keyfreq-table)))
-            ;; Add local-fn to counter.
-            (setq command local-fn)
-            (setq count (gethash (cons major-mode command) keyfreq-table))
-            (puthash (cons major-mode command) (if count (+ count 1) 1)
-                     keyfreq-table))))
+      (when (and (boundp 'keyfreq-mode) keyfreq-mode (boundp 'keyfreq-table))
+        (let ((command 'ergoemacs-undefined) count)
+          (setq count (gethash (cons major-mode command) keyfreq-table))
+          (cond
+           ((not count))
+           ((= count 1)
+            (remhash (cons major-mode command) keyfreq-table))
+           (count
+            (puthash (cons major-mode command) (- count 1)
+                     keyfreq-table)))
+          ;; Add local-fn to counter.
+          (setq command local-fn)
+          (setq count (gethash (cons major-mode command) keyfreq-table))
+          (puthash (cons major-mode command) (if count (+ count 1) 1)
+                   keyfreq-table)))
       (condition-case err
           (call-interactively local-fn)
         (error (beep) (message "%s" err))))
@@ -728,17 +732,13 @@
 
 (defun ergoemacs-reset-global-where-is ()
   "Reset `ergoemacs-where-is-global-hash'."
-  (setq ergoemacs-where-is-global-hash (make-hash-table :test 'equal))
-  (mapc
-   (lambda(x)
-     (let ((key (read-kbd-macro (nth 0 x))))
-       (mapc
-        (lambda(fn)
-          (let ((keys (gethash fn ergoemacs-where-is-global-hash)))
-            (add-to-list 'keys key)
-            (puthash fn keys ergoemacs-where-is-global-hash)))
-        (nth 1 x))))
-   ergoemacs-emacs-default-bindings))
+  (clrhash ergoemacs-where-is-global-hash)
+  (dolist (x ergoemacs-emacs-default-bindings)
+    (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)
+          (puthash fn keys ergoemacs-where-is-global-hash))))))
 
 
 ;;;###autoload
@@ -747,15 +747,14 @@
   (setq ergoemacs-emacs-default-bindings
         (mapcar
          (lambda(elt)
-           (let ((first (nth 0  elt))
-                 (last (nth 1 elt))
-                 fn)
-             (setq fn (lookup-key global-map (read-kbd-macro first)))
+           (let* ((first (nth 0  elt))
+                  (last (nth 1 elt))
+                  (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)
+               (pushnew 'last fn)
                `(,first ,last))))
          ergoemacs-emacs-default-bindings))
   (ergoemacs-reset-global-where-is))
@@ -763,12 +762,12 @@
   
 (defun ergoemacs-format-where-is-buffer (&optional include-menu-bar 
include-alias)
   "Format a buffer created from a `where-is' command."
-  (when (and (boundp 'fn)
-             (eq (nth 0 (nth 1 fn)) 'digit-argument))
+  (when (and (boundp 'ergoemacs--fn)
+             (eq (nth 0 (nth 1 ergoemacs--fn)) 'digit-argument))
     (goto-char (point-min))
     (while (re-search-forward "\\<\\([CMS]-\\)+" nil t)
-      (when (and (boundp 'last)
-                 (not (save-match-data (looking-at last))))
+      (when (and (boundp 'ergoemacs--last)
+                 (not (save-match-data (looking-at ergoemacs--last))))
         (replace-match "")
         (delete-char 1)
         (when (looking-at " *, *")
@@ -806,7 +805,7 @@
 (defvar ergoemacs-global-changed-cache '()
   "Cache of global variables that have changed.")
 
-(defun ergoemacs-global-fix-defualt-bindings (kbd-code function)
+(defun ergoemacs-global-fix-default-bindings (kbd-code function)
   "Helper function to fix `ergoemacs-emacs-default-bindings' based on 
currently running emacs."
   (interactive)
   (with-temp-buffer
@@ -829,10 +828,10 @@ This should only be run when no global keys have been set.
 "
   (let* ((key-code
           (cond
-           ((eq (type-of key) 'string)
+           ((stringp key)
             (if is-variable
                 (ergoemacs-kbd key)
-              (condition-case err
+              (condition-case nil
                   (read-kbd-macro key)
                 (error (read-kbd-macro
                         (encode-coding-string
@@ -846,7 +845,7 @@ This should only be run when no global keys have been set.
             (when (or fix complain)
               (let* ((key-function (lookup-key (current-global-map) key-code 
t))
                      (old-bindings (assoc key-kbd 
ergoemacs-emacs-default-bindings))
-                     (trans-function (if (condition-case err
+                     (trans-function (if (condition-case nil
                                              (keymapp key-function)
                                            (error nil))
                                          'prefix
@@ -858,7 +857,7 @@ This should only be run when no global keys have been set.
             nil
           (let* ((key-function (lookup-key (current-global-map) key-code t))
                  (old-bindings (assoc key-kbd 
ergoemacs-emacs-default-bindings))
-                 (trans-function (if (condition-case err
+                 (trans-function (if (condition-case nil
                                          (keymapp key-function)
                                        (error nil))
                                      'prefix
@@ -874,7 +873,7 @@ This should only be run when no global keys have been set.
                 (while (< i trans-function)
                   (aset prefix-vector i (elt key-as-vector i))
                   (setq i (+ 1 i)))
-                (unless (condition-case err ; If it is a prefix vector,
+                (unless (condition-case nil ; If it is a prefix vector,
                                         ; assume not globally
                                         ; changed
                             (keymapp (lookup-key (current-global-map) 
prefix-vector))
@@ -897,29 +896,23 @@ This should only be run when no global keys have been set.
                              trans-function old-bindings)
                     (when fix
                       (unless (integerp trans-function)
-                        (ergoemacs-global-fix-defualt-bindings key-kbd 
trans-function))))
+                        (ergoemacs-global-fix-default-bindings key-kbd 
trans-function))))
                   (add-to-list 'ergoemacs-global-changed-cache key-kbd))
               (add-to-list 'ergoemacs-global-not-changed-cache key-kbd))
-            (symbol-value 'has-changed)))))))
+            has-changed))))))
 
-(defun ergoemacs-warn-globally-changed-keys (&optional fix)
+(defun ergoemacs-warn-globally-changed-keys (&optional fix) ;FIXME: fix unused!
   "Warns about globally changed keys. If FIX is true, fix the ergoemacs-unbind 
file."
   (interactive)
-  (mapc
-   (lambda(x)
-     (ergoemacs-global-changed-p (nth 0 x) nil t t))
-   ergoemacs-emacs-default-bindings)
+  (dolist (x ergoemacs-emacs-default-bindings)
+    (ergoemacs-global-changed-p (nth 0 x) nil t t))
   (message "Ergoemacs Keys warnings for this layout:")
-  (mapc
-   (lambda(x)
-     (and (eq 'string (type-of (nth 0 x)))
-          (ergoemacs-global-changed-p (nth 0 x) nil t t)))
-      (symbol-value (ergoemacs-get-fixed-layout)))
-  (mapc
-   (lambda(x)
-     (and (eq 'string (type-of (nth 0 x)))
-          (ergoemacs-global-changed-p (nth 0 x) t t)))
-   (symbol-value (ergoemacs-get-variable-layout))))
+  (dolist (x (symbol-value (ergoemacs-get-fixed-layout)))
+    (and (stringp (nth 0 x))
+         (ergoemacs-global-changed-p (nth 0 x) nil t t)))
+  (dolist (x (symbol-value (ergoemacs-get-variable-layout)))
+    (and (stringp (nth 0 x))
+         (ergoemacs-global-changed-p (nth 0 x) t t))))
 
 
 



reply via email to

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