branch: externals/ergoemacs-mode commit 78bd8cf2b65c0ba4b3b09d1b764012b5b0d79410 Author: Walter Landry <wlan...@caltech.edu> Commit: Walter Landry <wlan...@caltech.edu>
Remove component stuff --- ergoemacs-component.el | 94 -------------------------------- ergoemacs-macros.el | 142 ------------------------------------------------- 2 files changed, 236 deletions(-) diff --git a/ergoemacs-component.el b/ergoemacs-component.el index 1bd1d6f..b6cd7b6 100644 --- a/ergoemacs-component.el +++ b/ergoemacs-component.el @@ -139,100 +139,6 @@ It also passes ARGS if any are specified." (cdr elt)) args))))))) -(defun ergoemacs-component-struct--handle-bind-1 (kbd-str def keymap) - "Tell `ergoemacs-mode' to bind KBD-STR to DEF in KEYMAP." - (ergoemacs-component-struct--define-key keymap (read-kbd-macro kbd-str) def)) - -(defun ergoemacs-component-struct--handle-bind (bind &optional keymap) - "Handle :bind and related properties. - -BIND is the property list from the component definition. - -KEYMAP is the symbol of a bound keymap. If unspecified, the -binding assumes KEYMAP is `global-map'." - (let ((keymap (or keymap 'global-map))) - (ergoemacs-component-struct--parse-list - bind #'ergoemacs-component-struct--handle-bind-1 keymap))) - -(defun ergoemacs-component-struct--create-component (plist body file) - "Create ergoemacs component. - -PLIST is the component properties - -BODY is the body of function. - -FILE is the file name where the component was created." - (ergoemacs-timing (intern (format "create-component-%s" (plist-get plist :name))) - (unwind-protect - (progn - (setq ergoemacs-component-struct--define-key-current - (make-ergoemacs-component-struct - :name (plist-get plist :name) - :plist (plist-put plist :file file) - :just-first-keys (or (plist-get plist :just-first-keys) nil) - :variable-modifiers (or (plist-get plist :variable-modifiers) '(meta)) - :variable-prefixes (or (plist-get plist :variable-prefixes) '([apps] [menu] [27])) - :package-name (plist-get plist :package-name) - :layout (or (plist-get plist :layout) "us") - :defer (plist-get plist :defer))) - (let* ((tmp (plist-get plist :bind-keymap)) - (package-name (plist-get plist :package-name)) - (demand (plist-get plist :demand)) - (defer (if demand nil (plist-get plist :defer))) - (defer-present-p (or demand defer (memq :defer plist)))) - - ;; Handle :bind-keymap commands - (when (and tmp (not defer-present-p) (not defer)) - (setq defer-present-p t defer t) - (setf (ergoemacs-component-struct-defer ergoemacs-component-struct--define-key-current) t)) - (ergoemacs-component-struct--handle-bind tmp) - - ;; Handle :bind-keymap* commands - (setq tmp (plist-get plist :bind-keymap*)) - (when (and tmp (not defer-present-p) (not defer)) - (setq defer-present-p t defer t) - (setf (ergoemacs-component-struct-defer ergoemacs-component-struct--define-key-current) t)) - (ergoemacs-component-struct--handle-bind tmp 'ergoemacs-override-keymap) - - ;; Handle :bind keys - (setq tmp (plist-get plist :bind)) - (when (and tmp (not defer-present-p) (not defer)) - (setq defer-present-p t defer t) - (setf (ergoemacs-component-struct-defer ergoemacs-component-struct--define-key-current) t)) - (ergoemacs-component-struct--handle-bind tmp) - - ;; Handle :bind* commands - (setq tmp (plist-get plist :bind*)) - (when (and tmp (not defer-present-p) (not defer)) - (setq defer-present-p t defer t) - (setf (ergoemacs-component-struct-defer ergoemacs-component-struct--define-key-current) t)) - (ergoemacs-component-struct--handle-bind tmp 'ergoemacs-override-keymap) - - ;; Handle :commands - (setq tmp (plist-get plist :commands)) - (when (and tmp (not defer-present-p) (not defer)) - (setq defer-present-p t defer t) - (setf (ergoemacs-component-struct-defer ergoemacs-component-struct--define-key-current) t)) - (when package-name - (cond - ((and tmp (symbolp tmp)) - (autoload tmp (format "%s" package-name) nil t) - (push (cons tmp package-name) (ergoemacs-component-struct-autoloads ergoemacs-component-struct--define-key-current))) - ((consp tmp) - (dolist (f tmp) - (when (and f (symbolp f)) - (autoload f (format "%s" package-name) nil t) - (push (cons f package-name) (ergoemacs-component-struct-autoloads ergoemacs-component-struct--define-key-current)))))))) - (funcall body) - (setf (ergoemacs-component-struct-variables ergoemacs-component-struct--define-key-current) - (reverse (ergoemacs-component-struct-variables ergoemacs-component-struct--define-key-current)))) - - (puthash (concat (ergoemacs-component-struct-name ergoemacs-component-struct--define-key-current) - (and (ergoemacs-component-struct-version ergoemacs-component-struct--define-key-current) - (concat "::" (ergoemacs-component-struct-version ergoemacs-component-struct--define-key-current)))) - ergoemacs-component-struct--define-key-current ergoemacs-component-hash) - (setq ergoemacs-component-struct--define-key-current nil)))) - (defun ergoemacs-component-struct--with-hook (when-condition plist body &optional object) "How the (when...) conditions in an ergoemacs-mode theme are handled. WHEN-CONDITION is the when condition that is defined in a theme. diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el index 946c2db..c5a1996 100644 --- a/ergoemacs-macros.el +++ b/ergoemacs-macros.el @@ -253,148 +253,6 @@ distinguish from the ASCII equivalents: :variable-prefixes :layout) "List of ergoemacs-theme-component properties.") -;;;###autoload -(defmacro ergoemacs-theme-component (&rest body-and-plist) - "A component of an ergoemacs-theme. - -This macro parses BODY-AND-PLIST to Emacs code to generate an -`erogemacs-mode' theme component. - -This accepts the following keywords: - -:bind -- What keys to bind. This is compatible with use-package - definitions. That is it can take a command like: - - :bind (\"C-.\" . ace-jump-mode) - - or list of commands - - :bind ((\"M-o l\" . highlight-lines-matching-regexp) - (\"M-o r\" . highlight-regexp) - (\"M-o w\" . highlight-phrase)) - - This list of commands can just be a list without the extra - parentheses for each command: - - :bind (\"M-o l\" . highlight-lines-matching-regexp - \"M-o r\" . highlight-regexp - \"M-o w\" . highlight-phrase) - - - Note that these keys may change based on keyboard layouts, - and also these keys can accept special ergoemacs-commands and - keymaps (unlike use-package). - - When package-name is non-nil, create autoloads for undefined commands. - - Default: nil - -:bind-keymap -- A keymap to bind. Similar to :bind but used for - keymaps. This is processed before :bind keywords. While - this is necessary for use-package, it is not necessary for - `ergoemacs-mode'. However, this keyword is provided for convenience. - - Default: nil - -:bind* -- Keys to bind above minor modes (in - `ergoemacs-override-keymap'). - - Default: nil - -:bind-keymap* -- Keymap to bind above minor modes (in - `ergoemacs-override-keymap'). - - Default: nil - -:commands -- List of commands to create autoloads for. This can - take a command like: - - :commands ace-jump-mode - - Or - - :commands (isearch-moccur isearch-all) - - When :package-name is non-nil, this will create autoloads for - the commands. - -:defer -- Should this package's loading be deferred? - When using :commands :bind :bind* :bind-keymap :bind-keymap* - or :interperter, defer is implied. When :package-name - is nil, this dosen't do anything. - -:demand -- Prevent deferred loading in all cases - -Borrowed from `use-package'. - -:package-name -- Name of package to load. When non-nil any key -defition to a single command will create an autoload for that -command. - -Default: nil - -:no-load / :no-require -- Don't load/require the package-name. - -:ergoemacs-require -- when non-nil, this ergoemacs-component is -required with `ergoemacs-require'. By default this is disabled - -:just-first-keys -- Keys where a fixed amount of the key is based -on variable keyboard placement, then the rest of the key is -based on letter. For example with the apps component, the -just first keys are defined to be [apps ?h], which means the -[apps h] will be defined based on finger placement, but the -keys afterward would be based on letter. - -By default this is defined as nil, meaning no special keys -like this occur. - -:just-first-keys (list [apps ?h] [menu ?h]) -Defaults to nil - -:variable-modifiers -- Modifiers that are considierd variable. -These modifiers have keys change among various keyboard -layouts. That is keys are bound based on finger placement -among various keyboard layouts. - -Defaults to '(meta) - -:variable-prefixes -- Keyboard prefixes that are considiered -variable. After these keys are pressed, the keyboard layout -dictates the keys. That is, keys are bound based on finger -placement among various keyboard layouts. - -Defaults to '([apps] [menu] [27]) - -:layout -- Layout that the key bindings are based on. - -Defaults to us (QWERTY) - -Please do not use the following tags, since they are parsed based -on the definition: - -:name -- Component Name - -:description -- Component Description - -:file -- File where the component was defined." - (declare (doc-string 2) - (indent 2)) - (let ((kb (make-symbol "body-and-plist"))) - (setq kb (ergoemacs-theme-component--parse body-and-plist)) - `(let ((plist ',(nth 0 kb)) - (fun '(lambda () ,@(nth 1 kb)))) - (unless (boundp 'ergoemacs-component-hash) - (defvar ergoemacs-component-hash (make-hash-table :test 'equal) - "Hash of ergoemacs theme components")) - (defvar ergoemacs-mode-reset) - (setq ergoemacs-mode-reset t) - (puthash ,(plist-get (nth 0 kb) :name) - `(lambda() ,(plist-get plist :description) - (ergoemacs-component-struct--create-component - ',plist ',fun ,(or load-file-name buffer-file-name))) - ergoemacs-component-hash) - ,(when (plist-get (nth 0 kb) :ergoemacs-require) - `(ergoemacs-require ',(intern (plist-get (nth 0 kb) :name))))))) (defvar ergoemacs-theme-components--modified-plist nil "Modified plist.")