[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 118/287: Move macros from ergoemacs-theme-engine
From: |
Matthew Fidler |
Subject: |
[elpa] 118/287: Move macros from ergoemacs-theme-engine |
Date: |
Wed, 02 Jul 2014 14:45:11 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit d3c40e0bc5b90dac856ddef1c2cd8014b589fb93
Author: Matthew L. Fidler <address@hidden>
Date: Tue Jun 17 15:13:13 2014 -0500
Move macros from ergoemacs-theme-engine
---
ergoemacs-macros.el | 87 ++++++++++++++++++++++++++++++--
ergoemacs-theme-engine.el | 122 +++------------------------------------------
2 files changed, 91 insertions(+), 118 deletions(-)
diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el
index 4ac7df7..9752c08 100644
--- a/ergoemacs-macros.el
+++ b/ergoemacs-macros.el
@@ -30,9 +30,7 @@
;; These should only be called when byte compiled
-(defvar ergoemacs-mode)
-(declare-function ergoemacs-emulations "ergoemacs-mode.el")
-(declare-function ergoemacs-remove-shortcuts "ergoemacs-shortcuts.el")
+;;;###autoload
(defmacro ergoemacs-with-ergoemacs (&rest body)
"With basic `ergoemacs-mode' mode keys.
major-mode, minor-mode, and global keys are ignored."
@@ -59,6 +57,7 @@ major-mode, minor-mode, and global keys are ignored."
(use-global-map old-global-map)
(use-local-map old-local-map))))t
+;;;###autoload
(defmacro ergoemacs-with-overrides (&rest body)
"With the `ergoemacs-mode' mode overrides.
The global map is ignored, but major/minor modes keymaps are included."
@@ -75,13 +74,14 @@ The global map is ignored, but major/minor modes keymaps
are included."
,@body)
(use-global-map old-global-map))))
-
+;;;###autoload
(defmacro ergoemacs-with-global (&rest body)
"With global keymap, not ergoemacs keymaps."
`(ergoemacs-without-emulation
(let (ergoemacs-mode ergoemacs-unbind-keys)
,@body)))
+;;;###autoload
(defmacro ergoemacs-with-major-and-minor-modes (&rest body)
"Without global keymaps and ergoemacs keymaps."
`(let ((old-global-map (current-global-map))
@@ -93,6 +93,7 @@ The global map is ignored, but major/minor modes keymaps are
included."
,@body))
(use-global-map old-global-map))))
+;;;###autoload
(defmacro ergoemacs-without-emulation (&rest body)
"Without keys defined at `emulation-mode-map-alists'.
@@ -119,6 +120,84 @@ installing the original keymap above the ergoemacs-mode
installed keymap.
(when ergoemacs-mode
(ergoemacs-emulations)))))
+;;;###autoload
+(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-theme-component--parse body-and-plist))
+ `(puthash ,(plist-get (nth 0 kb) ':name)
+ (lambda() ,(plist-get (nth 0 kb) ':description)
+ (ergoemacs-theme-component--create-component
+ ',(nth 0 kb)
+ '(lambda () ,@(nth 1 kb)))) ergoemacs-theme-comp-hash)))
+
+;;;###autoload
+(defmacro ergoemacs-theme (&rest body-and-plist)
+ "Define an ergoemacs-theme.
+:components -- list of components that this theme uses. These can't be seen or
toggled
+:optional-on -- list of components that are optional and are on by default
+:optional-off -- list of components that are optional and off by default
+:options-menu -- Menu options list
+:silent -- If this theme is \"silent\", i.e. doesn't show up in the Themes
menu.
+
+The rest of the body is an `ergoemacs-theme-component' named THEME-NAME-theme
+"
+ (declare (doc-string 2)
+ (indent 2))
+ (let ((kb (make-symbol "body-and-plist"))
+ (tmp (make-symbol "tmp")))
+ (setq kb (ergoemacs-theme-component--parse-keys-and-body body-and-plist))
+ (setq tmp (eval (plist-get (nth 0 kb) ':components)))
+ (push (intern (concat (plist-get (nth 0 kb) ':name) "-theme")) tmp)
+ (setq tmp (plist-put (nth 0 kb) ':components tmp))
+ (mapc
+ (lambda(comp)
+ (setq tmp (plist-put (nth 0 kb) comp
+ (eval (plist-get (nth 0 kb) comp)))))
+ '(:optional-on :optional-off :options-menu))
+
+ `(let (themes silent)
+ (setq themes (gethash "defined-themes" ergoemacs-theme-hash)
+ silent (gethash "silent-themes" ergoemacs-theme-hash))
+ (push ,(plist-get (nth 0 kb) ':name) themes)
+ (push ,(plist-get (nth 0 kb) ':name) silent)
+ (puthash ,(plist-get (nth 0 kb) ':name) ',tmp ergoemacs-theme-hash)
+ (if ,(plist-get (nth 0 kb) ':silent)
+ (puthash "silent-themes" silent ergoemacs-theme-hash)
+ (puthash "defined-themes" themes ergoemacs-theme-hash))
+ (ergoemacs-theme-component ,(intern (concat (plist-get (nth 0 kb)
':name) "-theme")) ()
+ ,(format "Generated theme component for %s theme" (concat (plist-get
(nth 0 kb) ':name) "-theme"))
+ ,@(nth 1 kb)))))
+
+;;;###autoload
+(defmacro ergoemacs-deftheme (name desc based-on &rest differences)
+ "Creates a theme layout for Ergoemacs keybindings -- Compatability layer.
+
+NAME is the theme name.
+DESC is the theme description
+BASED-ON is the base name theme that the new theme is based on.
+
+DIFFERENCES are the differences from the layout based on the functions. These
are based on the following functions:
+
+`ergoemacs-key' = defines/replaces variable key with function by
(ergoemacs-key QWERTY-KEY FUNCTION DESCRIPTION ONLY-FIRST)
+`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))
+ (plist-put pl ':name ,(symbol-name name))
+ (setq tmp (plist-get pl ':components))
+ (push (intern (concat ,(symbol-name name) "-theme")) tmp)
+ (setq tmp (plist-put pl ':components tmp))
+ (setq silent (gethash "silent-themes" ergoemacs-theme-hash))
+ (push ,(symbol-name name) silent)
+ (puthash "silent-themes" silent ergoemacs-theme-hash)
+ (puthash ,(symbol-name name) tmp ergoemacs-theme-hash)
+ (ergoemacs-theme-component ,(intern (concat (symbol-name name) "-theme"))
()
+ ,(format "Generated theme component for %s theme" (symbol-name name))
+ ,@differences)))
(provide 'ergoemacs-macros)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-macros.el ends here
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 1ad4db7..d90cd89 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -51,8 +51,14 @@
;;
;;; Code:
-(eval-when-compile (require 'cl))
-(require 'ergoemacs-advices)
+(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)))))
(defgroup ergoemacs-themes nil
"Default Ergoemacs Layout"
@@ -1705,56 +1711,6 @@ additional parsing routines defined by PARSE-FUNCTION."
(defvar ergoemacs-theme-comp-hash (make-hash-table :test 'equal)
"Hash of ergoemacs theme components")
-(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-theme-component--parse body-and-plist))
- `(puthash ,(plist-get (nth 0 kb) ':name)
- (lambda() ,(plist-get (nth 0 kb) ':description)
- (ergoemacs-theme-component--create-component
- ',(nth 0 kb)
- '(lambda () ,@(nth 1 kb)))) ergoemacs-theme-comp-hash)))
-
-(defmacro ergoemacs-theme (&rest body-and-plist)
- "Define an ergoemacs-theme.
-:components -- list of components that this theme uses. These can't be seen or
toggled
-:optional-on -- list of components that are optional and are on by default
-:optional-off -- list of components that are optional and off by default
-:options-menu -- Menu options list
-:silent -- If this theme is \"silent\", i.e. doesn't show up in the Themes
menu.
-
-The rest of the body is an `ergoemacs-theme-component' named THEME-NAME-theme
-"
- (declare (doc-string 2)
- (indent 2))
- (let ((kb (make-symbol "body-and-plist"))
- (tmp (make-symbol "tmp")))
- (setq kb (ergoemacs-theme-component--parse-keys-and-body
- body-and-plist
- 'ergoemacs-theme-component--parse-remaining))
- (setq tmp (eval (plist-get (nth 0 kb) ':components)))
- (push (intern (concat (plist-get (nth 0 kb) ':name) "-theme")) tmp)
- (setq tmp (plist-put (nth 0 kb) ':components tmp))
- (mapc
- (lambda(comp)
- (setq tmp (plist-put (nth 0 kb) comp
- (eval (plist-get (nth 0 kb) comp)))))
- '(:optional-on :optional-off :options-menu))
-
- `(let (themes silent)
- (setq themes (gethash "defined-themes" ergoemacs-theme-hash)
- silent (gethash "silent-themes" ergoemacs-theme-hash))
- (push ,(plist-get (nth 0 kb) ':name) themes)
- (push ,(plist-get (nth 0 kb) ':name) silent)
- (puthash ,(plist-get (nth 0 kb) ':name) ',tmp ergoemacs-theme-hash)
- (if ,(plist-get (nth 0 kb) ':silent)
- (puthash "silent-themes" silent ergoemacs-theme-hash)
- (puthash "defined-themes" themes ergoemacs-theme-hash))
- (ergoemacs-theme-comp ,(intern (concat (plist-get (nth 0 kb) ':name)
"-theme")) ()
- ,(format "Generated theme component for %s theme" (concat (plist-get
(nth 0 kb) ':name) "-theme"))
- ,@(nth 1 kb)))))
(defun ergoemacs-theme-component-get-closest-version (version version-list)
"Return the closest version to VERSION in VERSION-LIST.
@@ -2425,42 +2381,7 @@ Returns new keymap."
:set 'ergoemacs-set-default
:group 'ergoemacs-mode))))
-(defmacro ergoemacs-theme (&rest body-and-plist)
- "Define an ergoemacs-theme.
-:components -- list of components that this theme uses. These can't be seen or
toggled
-:optional-on -- list of components that are optional and are on by default
-:optional-off -- list of components that are optional and off by default
-:options-menu -- Menu options list
-:silent -- If this theme is \"silent\", i.e. doesn't show up in the Themes
menu.
-The rest of the body is an `ergoemacs-theme-component' named THEME-NAME-theme
-"
- (declare (doc-string 2)
- (indent 2))
- (let ((kb (make-symbol "body-and-plist"))
- (tmp (make-symbol "tmp")))
- (setq kb (ergoemacs-theme-component--parse-keys-and-body body-and-plist))
- (setq tmp (eval (plist-get (nth 0 kb) ':components)))
- (push (intern (concat (plist-get (nth 0 kb) ':name) "-theme")) tmp)
- (setq tmp (plist-put (nth 0 kb) ':components tmp))
- (mapc
- (lambda(comp)
- (setq tmp (plist-put (nth 0 kb) comp
- (eval (plist-get (nth 0 kb) comp)))))
- '(:optional-on :optional-off :options-menu))
-
- `(let (themes silent)
- (setq themes (gethash "defined-themes" ergoemacs-theme-hash)
- silent (gethash "silent-themes" ergoemacs-theme-hash))
- (push ,(plist-get (nth 0 kb) ':name) themes)
- (push ,(plist-get (nth 0 kb) ':name) silent)
- (puthash ,(plist-get (nth 0 kb) ':name) ',tmp ergoemacs-theme-hash)
- (if ,(plist-get (nth 0 kb) ':silent)
- (puthash "silent-themes" silent ergoemacs-theme-hash)
- (puthash "defined-themes" themes ergoemacs-theme-hash))
- (ergoemacs-theme-component ,(intern (concat (plist-get (nth 0 kb)
':name) "-theme")) ()
- ,(format "Generated theme component for %s theme" (concat (plist-get
(nth 0 kb) ':name) "-theme"))
- ,@(nth 1 kb)))))
(make-obsolete-variable 'ergoemacs-variant 'ergoemacs-theme
"ergoemacs-mode 5.8.0.1")
@@ -2521,33 +2442,6 @@ DESC is ignored, as is FIXED-KEY."
(ergoemacs-force-variable-reg nil))
(ergoemacs-theme-component--global-set-key key function)))
-(defmacro ergoemacs-deftheme (name desc based-on &rest differences)
- "Creates a theme layout for Ergoemacs keybindings -- Compatability layer.
-
-NAME is the theme name.
-DESC is the theme description
-BASED-ON is the base name theme that the new theme is based on.
-
-DIFFERENCES are the differences from the layout based on the functions. These
are based on the following functions:
-
-`ergoemacs-key' = defines/replaces variable key with function by
(ergoemacs-key QWERTY-KEY FUNCTION DESCRIPTION ONLY-FIRST)
-`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))
- (plist-put pl ':name ,(symbol-name name))
- (setq tmp (plist-get pl ':components))
- (push (intern (concat ,(symbol-name name) "-theme")) tmp)
- (setq tmp (plist-put pl ':components tmp))
- (setq silent (gethash "silent-themes" ergoemacs-theme-hash))
- (push ,(symbol-name name) silent)
- (puthash "silent-themes" silent ergoemacs-theme-hash)
- (puthash ,(symbol-name name) tmp ergoemacs-theme-hash)
- (ergoemacs-theme-component ,(intern (concat (symbol-name name) "-theme"))
()
- ,(format "Generated theme component for %s theme" (symbol-name name))
- ,@differences)))
-
(provide 'ergoemacs-theme-engine)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-theme-engine.el ends here
- [elpa] 136/287: Fix Makefile to have test-dir, (continued)
- [elpa] 136/287: Fix Makefile to have test-dir, Matthew Fidler, 2014/07/02
- [elpa] 102/287: Require the libraries that may be needed..., Matthew Fidler, 2014/07/02
- [elpa] 128/287: Fix byte compile issues and remove gaia., Matthew Fidler, 2014/07/02
- [elpa] 139/287: Make TEST_DIR first, Matthew Fidler, 2014/07/02
- [elpa] 204/287: Allow ergoemacs-key to work outside of themes again, Matthew Fidler, 2014/07/02
- [elpa] 141/287: Add back ergoemacs-fixed-key and ergoemacs-key compatability., Matthew Fidler, 2014/07/02
- [elpa] 200/287: Declare undo-tree, Matthew Fidler, 2014/07/02
- [elpa] 111/287: No compiler warnings for ergoemacs-menus.el, Matthew Fidler, 2014/07/02
- [elpa] 112/287: Fix last compiler issue for ergoemacs-menus.el, Matthew Fidler, 2014/07/02
- [elpa] 91/287: All tests pass; ido-vertical doesn't have right keys, Matthew Fidler, 2014/07/02
- [elpa] 118/287: Move macros from ergoemacs-theme-engine,
Matthew Fidler <=
- [elpa] 124/287: Refactor ergoemacs-open-in-external-app, Matthew Fidler, 2014/07/02
- [elpa] 138/287: Make the test directory., Matthew Fidler, 2014/07/02
- [elpa] 109/287: Add ergoemacs-macros for all macros., Matthew Fidler, 2014/07/02
- [elpa] 121/287: Remove cl dependence for ergoemacs-theme-engine.el, Matthew Fidler, 2014/07/02
- [elpa] 107/287: Remove save-variable-state, Matthew Fidler, 2014/07/02
- [elpa] 197/287: Merge branch 'master' of github.com:ergoemacs/ergoemacs-mode, Matthew Fidler, 2014/07/02
- [elpa] 106/287: Fix many byte-compile warnings in ergoemacs-extras.el, Matthew Fidler, 2014/07/02
- [elpa] 95/287: Revert "Fixed shortcut keys.", Matthew Fidler, 2014/07/02
- [elpa] 90/287: Allow unset keys to work too, Matthew Fidler, 2014/07/02
- [elpa] 115/287: Take away warnings from ergoemacs-mode.el, Matthew Fidler, 2014/07/02