mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit ed867caee2b1af8be77663c9bd8d605da00d9d15 Author: Matthew L. Fidler <[email protected]> Date: Tue Jun 17 23:49:48 2014 +0800 Fix byte-compile files --- ergoemacs-advices.el | 16 +++- ergoemacs-extras.el | 183 +++++++++++++++++++++++---------------------- ergoemacs-functions.el | 12 ++- ergoemacs-layouts.el | 6 +- ergoemacs-macros.el | 133 ++++++++++++++++++++++++++++++++- ergoemacs-mode.el | 6 ++ ergoemacs-theme-engine.el | 131 +------------------------------- ergoemacs-themes.el | 31 +++++++- ergoemacs-translate.el | 10 ++- ergoemacs-unbind.el | 3 - 10 files changed, 291 insertions(+), 240 deletions(-) diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el index c337638..b1eb398 100644 --- a/ergoemacs-advices.el +++ b/ergoemacs-advices.el @@ -28,8 +28,14 @@ ;;; Code: -(eval-when-compile (require 'cl)) - +(eval-when-compile + (require 'cl) + (require 'ergoemacs-macros + (expand-file-name "ergoemacs-macros" + (file-name-directory (or + load-file-name + (buffer-file-name) + default-directory))))) (defvar ergoemacs-advices '() "List of advices to enable and disable when ergoemacs is running.") @@ -175,8 +181,7 @@ This assumes any key defined while running a hook is a user-defined hook." (let ((ergoemacs-run-mode-hooks t)) ad-do-it)) -(declare-function ergoemacs-with-global - "ergoemacs-shortcuts.el") + (defadvice turn-on-undo-tree-mode (around ergoemacs-undo-tree-mode activate) "Make `ergoemacs-mode' and undo-tree compatible." (ergoemacs-with-global @@ -189,6 +194,9 @@ This assumes any key defined while running a hook is a user-defined hook." (defvar ergoemacs-original-keys-to-shortcut-keys-regexp) (defvar ergoemacs-original-keys-to-shortcut-keys) (declare-function ergoemacs-pretty-key "ergoemacs-translate.el") +(defvar ergoemacs-mode) +(declare-function ergoemacs-emulations "ergoemacs-mode.el") +(declare-function ergoemacs-remove-shortcuts "ergoemacs-shortcuts.el") (defun ergoemacs-substitute-command (string &optional map) "Substitutes command STRING will add MAP to substitution." diff --git a/ergoemacs-extras.el b/ergoemacs-extras.el index d406fa2..ae06336 100644 --- a/ergoemacs-extras.el +++ b/ergoemacs-extras.el @@ -391,40 +391,41 @@ (ergoemacs-mode 1) t)) -(defvar ergoemacs-fixed-layout) -(declare-function ergoemacs-pretty-key "ergoemacs-translate.el") -(defun ergoemacs-ghpages-standard-keys () - "Generate org-mode table for standard keys." - (with-temp-buffer - (insert (mapconcat - #'(lambda(var) - (let* ((key (ergoemacs-pretty-key (nth 0 var))) - (command (condition-case nil - (symbol-name (nth 1 var)) - (error ""))) - (desc (nth 2 var)) - emacs-key) - (setq desc - (replace-regexp-in-string "[+]" "\\\\+" desc)) - (setq emacs-key (condition-case nil - (key-description - (where-is-internal - (nth 1 var) - (current-global-map) t)) - (error "NA"))) - (if (string= emacs-key "") - (setq emacs-key "NA") - (setq emacs-key (ergoemacs-pretty-key emacs-key))) - (concat "| " desc " | " key " | " - emacs-key " | =" command "= |"))) - (remove-if #'(lambda(x) (not (nth 2 x))) - ergoemacs-fixed-layout) "\n")) - (sort-lines nil (point-min) (point-max)) - (goto-char (point-min)) - (insert "|-\n| Standard Name | Ergoemacs Key | Emacs Key | Emacs Command Name |\n|-") - (goto-char (point-max)) - (insert "\n|-\n") - (buffer-string))) +;; (defvar ergoemacs-fixed-layout) +;; (declare-function ergoemacs-pretty-key "ergoemacs-translate.el") +;; (defun ergoemacs-ghpages-standard-keys () +;; "Generate org-mode table for standard keys." +;; (require 'cl) +;; (with-temp-buffer +;; (insert (mapconcat +;; #'(lambda(var) +;; (let* ((key (ergoemacs-pretty-key (nth 0 var))) +;; (command (condition-case nil +;; (symbol-name (nth 1 var)) +;; (error ""))) +;; (desc (nth 2 var)) +;; emacs-key) +;; (setq desc +;; (replace-regexp-in-string "[+]" "\\\\+" desc)) +;; (setq emacs-key (condition-case nil +;; (key-description +;; (where-is-internal +;; (nth 1 var) +;; (current-global-map) t)) +;; (error "NA"))) +;; (if (string= emacs-key "") +;; (setq emacs-key "NA") +;; (setq emacs-key (ergoemacs-pretty-key emacs-key))) +;; (concat "| " desc " | " key " | " +;; emacs-key " | =" command "= |"))) +;; (remove-if #'(lambda(x) (not (nth 2 x))) +;; ergoemacs-fixed-layout) "\n")) +;; (sort-lines nil (point-min) (point-max)) +;; (goto-char (point-min)) +;; (insert "|-\n| Standard Name | Ergoemacs Key | Emacs Key | Emacs Command Name |\n|-") +;; (goto-char (point-max)) +;; (insert "\n|-\n") +;; (buffer-string))) (defvar ergoemacs-dir) ;;;###autoload @@ -1693,62 +1694,64 @@ IS-PREFIX tell ergoemacs if this is a prefix diagram." (ergoemacs-set-default 'ergoemacs-theme saved-theme)) lay))) -(require 'json nil t) - -(defun ergoemacs-layouts-json () - "Fixed layouts json string." - (concat "kbd_layout = " - (json-encode - (mapcar - (lambda(layout) - `(,layout ,@(symbol-value (intern (concat "ergoemacs-layout-" layout))))) - (ergoemacs-get-layouts))) ";")) - -(defun ergoemacs-fixed-themes-json () - "Fixed themes json string." - (concat "fixed_layouts = " - (json-encode - (mapcar - (lambda(theme) - `(,theme . - ,(mapcar - (lambda(x) - `(,(with-temp-buffer - (insert (ergoemacs-kbd (nth 0 x) t (nth 3 x))) - (goto-char (point-min)) - (while (re-search-forward "S-\\(.\\)\\>" nil t) - (replace-match (upcase (match-string 1)))) - (buffer-string)) . ,(nth 2 x))) - (remove-if (lambda(x) (not (nth 2 x))) - (symbol-value - (if (string= "" theme) - (intern "ergoemacs-fixed-layout") - (intern (concat "ergoemacs-fixed-layout-" theme)))))))) - `("" ,@(ergoemacs-get-themes)))) - ";")) - -(defun ergoemacs-variable-themes-json () - "Variable themes json string." - (concat "var_layouts = " - (json-encode - (mapcar - (lambda(theme) - `(,theme . - ,(mapcar - (lambda(x) - `(,(with-temp-buffer - (insert (ergoemacs-kbd (nth 0 x) t (nth 3 x))) - (goto-char (point-min)) - (while (re-search-forward "S-\\(.\\)\\>" nil t) - (replace-match (upcase (match-string 1)))) - (buffer-string)) . ,(nth 2 x))) - (remove-if (lambda(x) (not (nth 2 x))) - (symbol-value - (if (string= "" theme) - (intern "ergoemacs-variable-layout") - (intern (concat "ergoemacs-variable-layout-" theme)))))))) - `("" ,@(ergoemacs-get-themes)))) - ";")) +;; (require 'json nil t) + +;; (defun ergoemacs-layouts-json () +;; "Fixed layouts json string." +;; (concat "kbd_layout = " +;; (json-encode +;; (mapcar +;; (lambda(layout) +;; `(,layout ,@(symbol-value (intern (concat "ergoemacs-layout-" layout))))) +;; (ergoemacs-get-layouts))) ";")) + +;; (defun ergoemacs-fixed-themes-json () +;; "Fixed themes json string." +;; (require 'cl) +;; (concat "fixed_layouts = " +;; (json-encode +;; (mapcar +;; (lambda(theme) +;; `(,theme . +;; ,(mapcar +;; (lambda(x) +;; `(,(with-temp-buffer +;; (insert (ergoemacs-kbd (nth 0 x) t (nth 3 x))) +;; (goto-char (point-min)) +;; (while (re-search-forward "S-\\(.\\)\\>" nil t) +;; (replace-match (upcase (match-string 1)))) +;; (buffer-string)) . ,(nth 2 x))) +;; (remove-if (lambda(x) (not (nth 2 x))) +;; (symbol-value +;; (if (string= "" theme) +;; (intern "ergoemacs-fixed-layout") +;; (intern (concat "ergoemacs-fixed-layout-" theme)))))))) +;; `("" ,@(ergoemacs-get-themes)))) +;; ";")) + +;; (defun ergoemacs-variable-themes-json () +;; "Variable themes json string." +;; (require 'cl) +;; (concat "var_layouts = " +;; (json-encode +;; (mapcar +;; (lambda(theme) +;; `(,theme . +;; ,(mapcar +;; (lambda(x) +;; `(,(with-temp-buffer +;; (insert (ergoemacs-kbd (nth 0 x) t (nth 3 x))) +;; (goto-char (point-min)) +;; (while (re-search-forward "S-\\(.\\)\\>" nil t) +;; (replace-match (upcase (match-string 1)))) +;; (buffer-string)) . ,(nth 2 x))) +;; (remove-if (lambda(x) (not (nth 2 x))) +;; (symbol-value +;; (if (string= "" theme) +;; (intern "ergoemacs-variable-layout") +;; (intern (concat "ergoemacs-variable-layout-" theme)))))))) +;; `("" ,@(ergoemacs-get-themes)))) +;; ";")) (provide 'ergoemacs-extras) diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el index fa9bc76..758c49a 100644 --- a/ergoemacs-functions.el +++ b/ergoemacs-functions.el @@ -29,9 +29,14 @@ ;; ;;; Code: -(eval-when-compile (require 'cl)) -(eval-when-compile - (require 'ergoemacs-macros (expand-file-name "ergoemacs-macros" default-directory))) +(eval-when-compile + (require 'cl) + (require 'ergoemacs-macros + (expand-file-name "ergoemacs-macros" + (file-name-directory (or + load-file-name + (buffer-file-name) + default-directory))))) (require 'redo "redo.elc" t) ; for redo shortcut @@ -1220,6 +1225,7 @@ Emacs buffers are those whose name starts with *." ;; This custome kill buffer is close-current-buffer. (declare-function dired-get-marked-files "dired.el") +;;;(declare-function w32-shell-execute ...) (defun ergoemacs-open-in-external-app (&optional file) "Open the current file or dired marked files in external app." (interactive) diff --git a/ergoemacs-layouts.el b/ergoemacs-layouts.el index 45d91ce..16e71a2 100644 --- a/ergoemacs-layouts.el +++ b/ergoemacs-layouts.el @@ -303,6 +303,7 @@ `(const :tag ,elt :value ,elt)) (sort (ergoemacs-get-layouts t) 'string<)))) +(declare-function ergoemacs-set-default "ergoemacs-mode.el") (defun ergoemacs-set-layout (layout) "Set the ergoemacs layout to LAYOUT." (ergoemacs-set-default 'ergoemacs-keyboard-layout layout)) @@ -349,6 +350,8 @@ (concat "\"" lay "\" (" doc ")" (if is-alias ", alias" "")))) lays "\n"))) +(defvar ergoemacs-get-layouts-no-aliases nil) +(defvar ergoemacs-get-layouts-aliases nil) (defun ergoemacs-reset-layouts () "Reset Layout information." @@ -356,9 +359,6 @@ (setq ergoemacs-get-layouts-no-aliases nil) (setq ergoemacs-get-layouts-aliases nil)) -(defvar ergoemacs-get-layouts-no-aliases nil) -(defvar ergoemacs-get-layouts-aliases nil) - (defun ergoemacs-get-layouts (&optional aliases ob) "Get the list of all known layouts." (if (and ergoemacs-get-layouts-no-aliases diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el index b79aa2a..662f77b 100644 --- a/ergoemacs-macros.el +++ b/ergoemacs-macros.el @@ -120,7 +120,86 @@ installing the original keymap above the ergoemacs-mode installed keymap. (when ergoemacs-mode (ergoemacs-emulations))))) -(declare-function ergoemacs-theme-component--parse "ergoemacs-theme-engine.el") +;; This shouldn't be called at run-time; This fixes the byte-compile warning. +(fset 'ergoemacs-theme-component--parse + #'(lambda(keys-and-body &optional skip-first) + "Parse KEYS-AND-BODY, optionally skipping the name and +documentation with SKIP-FIRST. + +Uses `ergoemacs-theme-component--parse-keys-and-body' and + `ergoemacs-theme-component--parse-remaining'." + (ergoemacs-theme-component--parse-keys-and-body + keys-and-body + 'ergoemacs-theme-component--parse-remaining + skip-first))) + +;;;###autoload +(defun ergoemacs-theme-component--parse-remaining (remaining) + "In parsing, this function converts +- `define-key' is converted to `ergoemacs-define-key' and keymaps are quoted +- `global-set-key' is converted to `ergoemacs-define-key' with keymap equal to `global-map' +- `global-unset-key' is converted to `ergoemacs-define-key' with keymap equal to `global-map' and function definition is `nil' +- `global-reset-key' is converted `ergoemacs-define-key' +- `setq' and `set' is converted to `ergoemacs-set' +- Mode initialization like (delete-selection-mode 1) + or (delete-selection) is converted to + `ergoemacs-set' +- Allows :version statement expansion +- Adds with-hook syntax or (when -hook) or (when -mode) +" + (let* ((last-was-version nil) + (remaining + (mapcar + (lambda(elt) + (cond + (last-was-version + (setq last-was-version nil) + (if (stringp elt) + `(ergoemacs-theme-component--version ,elt) + `(ergoemacs-theme-component--version ,(symbol-name elt)))) + ((ignore-errors (eq elt ':version)) + (setq last-was-version t) + nil) + ((ignore-errors (eq (nth 0 elt) 'global-reset-key)) + `(ergoemacs-define-key 'global-map ,(nth 1 elt) nil)) + ((ignore-errors (eq (nth 0 elt) 'global-unset-key)) + `(ergoemacs-define-key 'global-map ,(nth 1 elt) nil)) + ((ignore-errors (eq (nth 0 elt) 'set)) + ;; Currently doesn't support (setq a b c d ), but it should. + `(ergoemacs-set ,(nth 1 elt) '(lambda() ,(nth 2 elt)))) + ((ignore-errors (eq (nth 0 elt) 'setq)) + (let ((tmp-elt elt) + (ret '())) + (pop tmp-elt) + (while (and (= 0 (mod (length tmp-elt) 2)) (< 0 (length tmp-elt))) + (push `(ergoemacs-set (quote ,(pop tmp-elt)) '(lambda() ,(pop tmp-elt))) ret)) + (push 'progn ret) + ret)) + ((ignore-errors (string-match "-mode$" (symbol-name (nth 0 elt)))) + `(ergoemacs-set (quote ,(nth 0 elt)) '(lambda() ,(nth 1 elt)))) + ((ignore-errors (eq (nth 0 elt) 'global-set-key)) + (if (ignore-errors (keymapp (symbol-value (nth 2 elt)))) + `(ergoemacs-define-key 'global-map ,(nth 1 elt) (quote ,(nth 2 elt))) + `(ergoemacs-define-key 'global-map ,(nth 1 elt) ,(nth 2 elt)))) + ((ignore-errors (eq (nth 0 elt) 'define-key)) + (if (equal (nth 1 elt) '(current-global-map)) + (if (ignore-errors (keymapp (symbol-value (nth 3 elt)))) + `(ergoemacs-define-key 'global-map ,(nth 2 elt) (quote ,(nth 3 elt))) + `(ergoemacs-define-key 'global-map ,(nth 2 elt) ,(nth 3 elt))) + (if (ignore-errors (keymapp (symbol-value (nth 3 elt)))) + `(ergoemacs-define-key (quote ,(nth 1 elt)) ,(nth 2 elt) (quote ,(nth 3 elt))) + `(ergoemacs-define-key (quote ,(nth 1 elt)) ,(nth 2 elt) ,(nth 3 elt))))) + ((or (ignore-errors (eq (nth 0 elt) 'with-hook)) + (and (ignore-errors (eq (nth 0 elt) 'when)) + (ignore-errors (string-match "-\\(hook\\|mode\\)$" (symbol-name (nth 1 elt)))))) + (let ((tmp (ergoemacs-theme-component--parse (cdr (cdr elt)) t))) + `(ergoemacs-theme-component--with-hook + ',(nth 1 elt) ',(nth 0 tmp) + '(lambda () ,@(nth 1 tmp))))) + (t elt))) + remaining))) + remaining)) + ;;;###autoload (defmacro ergoemacs-theme-component (&rest body-and-plist) "A component of an ergoemacs-theme." @@ -134,7 +213,57 @@ installing the original keymap above the ergoemacs-mode installed keymap. ',(nth 0 kb) '(lambda () ,@(nth 1 kb)))) ergoemacs-theme-comp-hash))) -(declare-function ergoemacs-theme-component--parse-keys-and-body "ergoemacs-theme-engine.el") +;;;###autoload +(fset 'ergoemacs-theme-component--parse-keys-and-body + #'(lambda (keys-and-body &optional parse-function skip-first) + "Split KEYS-AND-BODY into keyword-and-value pairs and the remaining body. + +KEYS-AND-BODY should have the form of a property list, with the +exception that only keywords are permitted as keys and that the +tail -- the body -- is a list of forms that does not start with a +keyword. + +Returns a two-element list containing the keys-and-values plist +and the body. + +This has been stolen directly from ert by Christian Ohler <[email protected]> + +Afterward it was modified for use with `ergoemacs-mode' to use +additional parsing routines defined by PARSE-FUNCTION." + (let ((extracted-key-accu '()) + last-was-version + plist + (remaining keys-and-body)) + ;; Allow + ;; (component name) + (unless (or (keywordp (first remaining)) 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)) + (pop remaining)) + (when (stringp (first remaining)) + (push `(:description . ,(pop remaining)) extracted-key-accu))) + (while (and (consp remaining) (keywordp (first remaining))) + (let ((keyword (pop remaining))) + (unless (consp remaining) + (error "Value expected after keyword %S in %S" + keyword keys-and-body)) + (when (assoc keyword extracted-key-accu) + (warn "Keyword %S appears more than once in %S" keyword + keys-and-body)) + (push (cons keyword (pop remaining)) extracted-key-accu))) + (setq extracted-key-accu (nreverse extracted-key-accu)) + (when parse-function + (setq remaining + (funcall parse-function remaining))) + (setq plist (loop for (key . value) in extracted-key-accu + collect key + collect value)) + (list plist remaining)))) + ;;;###autoload (defmacro ergoemacs-theme (&rest body-and-plist) "Define an ergoemacs-theme. diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el index 4fa8653..0dcd5ba 100644 --- a/ergoemacs-mode.el +++ b/ergoemacs-mode.el @@ -264,6 +264,12 @@ Valid values are: (defvar ergoemacs-unbind-keys nil) (defvar ergoemacs-read-input-keys nil) +(unless (featurep 'ergoemacs-theme-engine) + (load "ergoemacs-theme-engine")) + +(defvar ergoemacs-theme-comp-hash (make-hash-table :test 'equal) + "Hash of ergoemacs theme components") + (unless (featurep 'ergoemacs-themes) (load "ergoemacs-themes")) (unless (featurep 'ergoemacs-unbind) diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el index 8bb3856..5d8ab6b 100644 --- a/ergoemacs-theme-engine.el +++ b/ergoemacs-theme-engine.el @@ -902,9 +902,7 @@ Assumes maps are orthogonal." (oset obj init (ergoemacs-copy-list init)) (oset obj maps newmaps)))) -(defvar ergoemacs-theme-comp-hash (make-hash-table :test 'equal) - "Hash of ergoemacs theme components") - +(defvar ergoemacs-theme-comp-hash) (defmethod ergoemacs-theme-component-maps--save-hash ((obj ergoemacs-theme-component-maps)) (with-slots (object-name version) obj (puthash (object-name-string obj) @@ -1585,132 +1583,7 @@ The actual keymap changes are included in `ergoemacs-emulation-mode-map-alist'." (plist-get plist ':always))) (funcall body))) -(defun ergoemacs-theme-component--parse-remaining (remaining) - "In parsing, this function converts -- `define-key' is converted to `ergoemacs-define-key' and keymaps are quoted -- `global-set-key' is converted to `ergoemacs-define-key' with keymap equal to `global-map' -- `global-unset-key' is converted to `ergoemacs-define-key' with keymap equal to `global-map' and function definition is `nil' -- `global-reset-key' is converted `ergoemacs-define-key' -- `setq' and `set' is converted to `ergoemacs-set' -- Mode initialization like (delete-selection-mode 1) - or (delete-selection) is converted to - `ergoemacs-set' -- Allows :version statement expansion -- Adds with-hook syntax or (when -hook) or (when -mode) -" - (let* ((last-was-version nil) - (remaining - (mapcar - (lambda(elt) - (cond - (last-was-version - (setq last-was-version nil) - (if (stringp elt) - `(ergoemacs-theme-component--version ,elt) - `(ergoemacs-theme-component--version ,(symbol-name elt)))) - ((ignore-errors (eq elt ':version)) - (setq last-was-version t) - nil) - ((ignore-errors (eq (nth 0 elt) 'global-reset-key)) - `(ergoemacs-define-key 'global-map ,(nth 1 elt) nil)) - ((ignore-errors (eq (nth 0 elt) 'global-unset-key)) - `(ergoemacs-define-key 'global-map ,(nth 1 elt) nil)) - ((ignore-errors (eq (nth 0 elt) 'set)) - ;; Currently doesn't support (setq a b c d ), but it should. - `(ergoemacs-set ,(nth 1 elt) '(lambda() ,(nth 2 elt)))) - ((ignore-errors (eq (nth 0 elt) 'setq)) - (let ((tmp-elt elt) - (ret '())) - (pop tmp-elt) - (while (and (= 0 (mod (length tmp-elt) 2)) (< 0 (length tmp-elt))) - (push `(ergoemacs-set (quote ,(pop tmp-elt)) '(lambda() ,(pop tmp-elt))) ret)) - (push 'progn ret) - ret)) - ((ignore-errors (string-match "-mode$" (symbol-name (nth 0 elt)))) - `(ergoemacs-set (quote ,(nth 0 elt)) '(lambda() ,(nth 1 elt)))) - ((ignore-errors (eq (nth 0 elt) 'global-set-key)) - (if (ignore-errors (keymapp (symbol-value (nth 2 elt)))) - `(ergoemacs-define-key 'global-map ,(nth 1 elt) (quote ,(nth 2 elt))) - `(ergoemacs-define-key 'global-map ,(nth 1 elt) ,(nth 2 elt)))) - ((ignore-errors (eq (nth 0 elt) 'define-key)) - (if (equal (nth 1 elt) '(current-global-map)) - (if (ignore-errors (keymapp (symbol-value (nth 3 elt)))) - `(ergoemacs-define-key 'global-map ,(nth 2 elt) (quote ,(nth 3 elt))) - `(ergoemacs-define-key 'global-map ,(nth 2 elt) ,(nth 3 elt))) - (if (ignore-errors (keymapp (symbol-value (nth 3 elt)))) - `(ergoemacs-define-key (quote ,(nth 1 elt)) ,(nth 2 elt) (quote ,(nth 3 elt))) - `(ergoemacs-define-key (quote ,(nth 1 elt)) ,(nth 2 elt) ,(nth 3 elt))))) - ((or (ignore-errors (eq (nth 0 elt) 'with-hook)) - (and (ignore-errors (eq (nth 0 elt) 'when)) - (ignore-errors (string-match "-\\(hook\\|mode\\)$" (symbol-name (nth 1 elt)))))) - (let ((tmp (ergoemacs-theme-component--parse (cdr (cdr elt)) t))) - `(ergoemacs-theme-component--with-hook - ',(nth 1 elt) ',(nth 0 tmp) - '(lambda () ,@(nth 1 tmp))))) - (t elt))) - remaining))) - remaining)) - -(defun ergoemacs-theme-component--parse (keys-and-body &optional skip-first) - "Parse KEYS-AND-BODY, optionally skipping the name and -documentation with SKIP-FIRST. - -Uses `ergoemacs-theme-component--parse-keys-and-body' and - `ergoemacs-theme-component--parse-remaining'." - (ergoemacs-theme-component--parse-keys-and-body - keys-and-body - 'ergoemacs-theme-component--parse-remaining - skip-first)) - -(defun ergoemacs-theme-component--parse-keys-and-body (keys-and-body &optional parse-function skip-first) - "Split KEYS-AND-BODY into keyword-and-value pairs and the remaining body. - -KEYS-AND-BODY should have the form of a property list, with the -exception that only keywords are permitted as keys and that the -tail -- the body -- is a list of forms that does not start with a -keyword. - -Returns a two-element list containing the keys-and-values plist -and the body. - -This has been stolen directly from ert by Christian Ohler <[email protected]> - -Afterward it was modified for use with `ergoemacs-mode' to use -additional parsing routines defined by PARSE-FUNCTION." - (let ((extracted-key-accu '()) - last-was-version - plist - (remaining keys-and-body)) - ;; Allow - ;; (component name) - (unless (or (keywordp (first remaining)) 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)) - (pop remaining)) - (when (stringp (first remaining)) - (push `(:description . ,(pop remaining)) extracted-key-accu))) - (while (and (consp remaining) (keywordp (first remaining))) - (let ((keyword (pop remaining))) - (unless (consp remaining) - (error "Value expected after keyword %S in %S" - keyword keys-and-body)) - (when (assoc keyword extracted-key-accu) - (warn "Keyword %S appears more than once in %S" keyword - keys-and-body)) - (push (cons keyword (pop remaining)) extracted-key-accu))) - (setq extracted-key-accu (nreverse extracted-key-accu)) - (when parse-function - (setq remaining - (funcall parse-function remaining))) - (setq plist (loop for (key . value) in extracted-key-accu - collect key - collect value)) - (list plist remaining))) - +;;;###autoload (defun ergoemacs-theme-component--create-component (plist body) ;; Reset variables. (let* ((ergoemacs-theme-component-maps--versions '()) diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el index 8f93546..029feca 100644 --- a/ergoemacs-themes.el +++ b/ergoemacs-themes.el @@ -27,15 +27,24 @@ ;; ;;; Code: +(eval-when-compile + (require 'cl) + (require 'ergoemacs-macros + (expand-file-name "ergoemacs-macros" + (file-name-directory (or + load-file-name + (buffer-file-name) + default-directory))))) + (autoload 'dired-jump "dired-x" "ergoemacs-autoload." t) (autoload 'wdired-change-to-wdired-mode "wdired" "ergoemacs-autoload." t) (autoload 'wdired-exit "wdired" "ergoemacs-autoload." t) -(require 'ergoemacs-unbind) -(require 'ergoemacs-translate) (require 'advice) -(require 'ergoemacs-theme-engine) +(defvar ergoemacs-theme-comp-hash) +(defvar ergoemacs-theme-hash) +(declare-function ergoemacs-theme-component--create-component "ergoemacs-theme-engine.el") (ergoemacs-theme-component standard-vars () "Enabled/changed variables/modes" @@ -46,7 +55,21 @@ (setq set-mark-command-repeat-pop t) (setq org-special-ctrl-a/e t) (setq ido-vertical-define-keys 'C-n-C-p-up-down-left-right) - (setq scroll-error-top-bottom t)) + (setq scroll-error-top-bottom t) + ;; (setq cua--rectangle-modifier-key ergoemacs-cua-rect-modifier) + ;; (setq cua--rectangle-keymap (make-sparse-keymap)) + ;; (setq cua--rectangle-initialized nil) + ;; (setq cua--keymap-alist + ;; (progn + ;; (cua--init-rectangles) + ;; `((cua--ena-prefix-override-keymap . ,cua--prefix-override-keymap) + ;; (cua--ena-prefix-repeat-keymap . ,cua--prefix-repeat-keymap) + ;; (cua--ena-cua-keys-keymap . ,cua--cua-keys-keymap) + ;; (cua--ena-global-mark-keymap . ,cua--global-mark-keymap) + ;; (cua--rectangle . ,cua--rectangle-keymap) + ;; (cua--ena-region-keymap . ,cua--region-keymap) + ;; (cua-mode . ,cua-global-keymap)))) + ) ;;; Fixed components (ergoemacs-theme-component standard-fixed () diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el index 832e484..40740dc 100644 --- a/ergoemacs-translate.el +++ b/ergoemacs-translate.el @@ -50,8 +50,14 @@ ;; ;;; Code: -(eval-when-compile (require 'cl)) -(eval-when-compile (require 'ergoemacs-macros (expand-file-name "ergoemacs-macros" default-directory))) +(eval-when-compile + (require 'cl) + (require 'ergoemacs-macros + (expand-file-name "ergoemacs-macros" + (file-name-directory (or + load-file-name + (buffer-file-name) + default-directory))))) ;;; ergoemacs pretty keys diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el index 1b610d8..85f5d7a 100644 --- a/ergoemacs-unbind.el +++ b/ergoemacs-unbind.el @@ -631,9 +631,6 @@ ("RET" (newline))) "Default Emacs Key Bindings") -(defvar ergoemacs-unbind-keymap (make-sparse-keymap) - "Keymap for `ergoemacs-unbind-keys'") - (defun ergoemacs-undefined (&optional arg) "Ergoemacs Undefined key, tells where to perform the old action." (interactive "P")
