[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 62/287: Playing with object more.
From: |
Matthew Fidler |
Subject: |
[elpa] 62/287: Playing with object more. |
Date: |
Wed, 02 Jul 2014 14:44:38 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 9113ffae487cb59e4ea2ff23f1f1752046f78d6c
Author: Matthew L. Fidler <address@hidden>
Date: Fri Jun 6 13:30:07 2014 -0500
Playing with object more.
---
ergoemacs-theme-engine.el | 83 ++++++++++++++++++++++++++------------------
ergoemacs-themes.el | 3 +-
2 files changed, 51 insertions(+), 35 deletions(-)
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 5f301fe..1246e5a 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -998,8 +998,11 @@ FULL-SHORTCUT-MAP-P "
(defvar ergoemacs-deferred-maps '()
"List of keymaps that should be modified, but haven't been loaded.")
+(defvar ergoemacs-deferred-keys '()
+ "List of keys that have deferred bindings.")
+
(defmethod ergoemacs-emulation-alists ((obj
ergoemacs-theme-component-map-list) &optional remove-p)
- ;; First call 8 sec; Second call 2 sec.
+ ;; First call 8 sec; Second call 2 sec.. Need to speed up?
(with-slots (read-map
map
shortcut-map
@@ -1008,20 +1011,21 @@ FULL-SHORTCUT-MAP-P "
shortcut-list
rm-keys) (ergoemacs-get-fixed-map obj)
(let ((hook-map-list '())
+ (i 0)
ergoemacs-emulation-mode-map-alist
ergoemacs-read-emulation-mode-map-alist)
(setq ergoemacs-read-emulation-mode-map-alist
`((ergoemacs-read-input-keys ,@(or read-map
(make-sparse-keymap)))))
(dolist (hook (ergoemacs-get-hooks obj))
(let ((emulation-var (intern (concat "ergoemacs--for-" (symbol-name
hook))))
- (tmp '()) o-map n-map)
+ (tmp '()) o-map n-map
+ (defer '()))
(dolist (map-name (ergoemacs-get-keymaps-for-hook obj hook))
-
(with-slots (map
modify-map
full-map
- always) (ergoemacs-get-fixed-map obj map-name)
-
+ always
+ deferred-keys) (ergoemacs-get-fixed-map obj map-name)
(cond
((and modify-map always)
;; Maps that are always modified.
@@ -1029,7 +1033,7 @@ FULL-SHORTCUT-MAP-P "
(fset fn-name
`(lambda() ,(format "Turn on `ergoemacs-mode' for `%s'
during the hook `%s'."
(symbol-name map-name) (symbol-name
hook))
- (let ((new-map (copy-keymap ,map)))
+ (let ((new-map (copy-keymap (quote ,map))))
(set ',map-name
(copy-keymap
(make-composed-keymap
@@ -1038,48 +1042,59 @@ FULL-SHORTCUT-MAP-P "
(funcall (if remove-p #'remove-hook #'add-hook) hook
emulation-var)))
((and modify-map (not (boundp map-name)))
- (pushnew (list map-name full-map map) ergoemacs-deferred-maps))
+ (pushnew (list map-name full-map map deferred-keys)
ergoemacs-deferred-maps))
((and modify-map (boundp map-name))
;; Maps that are modified once (modify NOW if bound);
- ;; no need for hooks.
- (setq o-map (gethash map-name ergoemacs-original-map-hash))
- (if remove-p
- (progn
- (message "Restore %s" map-name)
- (when o-map
- (set map-name (copy-keymap o-map))))
- (message "Modify %s" map-name)
- (unless o-map
- (setq o-map (copy-keymap (symbol-value map-name)))
- (puthash map-name o-map ergoemacs-original-map-hash))
- (setq n-map (copy-keymap map))
- (set map-name (copy-keymap
- (make-composed-keymap
- (ergoemacs-theme--install-shortcuts-list
- shortcut-list n-map o-map full-map)
- o-map)))))
+ ;; no need for hooks?
+ ;; (setq defer (append defer (cons map-name deferred-keys)))
+ ;; (setq o-map (gethash map-name ergoemacs-original-map-hash))
+ ;; (if remove-p
+ ;; (when o-map
+ ;; (message "Restore %s" map-name)
+ ;; (set map-name (copy-keymap o-map)))
+ ;; (message "Modify %s" map-name)
+ ;; (unless o-map
+ ;; (setq o-map (copy-keymap (symbol-value map-name)))
+ ;; (puthash map-name o-map ergoemacs-original-map-hash))
+ ;; (setq n-map (copy-keymap map))
+ ;; (set map-name (copy-keymap
+ ;; (make-composed-keymap
+ ;; (ergoemacs-theme--install-shortcuts-list
+ ;; shortcut-list n-map o-map full-map)
+ ;; o-map))))
+ )
(t ;; Maps that are not modified.
(unless remove-p
(message "Setup %s" hook)
- (unless (fboundp emulation-var)
- (set-default emulation-var nil)
- (fset emulation-var
- `(lambda() ,(format "Turn on `ergoemacs-mode'
keymaps for `%s'.
+ (fset emulation-var
+ `(lambda() ,(format "Turn on `ergoemacs-mode' keymaps
for `%s'.
This is done by locally setting `ergoemacs--for-%s' to be non-nil.
The actual keymap changes are included in
`ergoemacs-emulation-mode-map-alist'." (symbol-name hook) (symbol-name hook))
- (set (make-local-variable ,emulation-var) t))))
+ (set (make-local-variable #',emulation-var) t)))
+ (set emulation-var nil)
+ (set-default emulation-var nil)
(push map tmp))
(funcall (if remove-p #'remove-hook #'add-hook) hook
emulation-var)))))
(unless (equal tmp '())
+ (unless (eq defer '())
+ (push (cons i defer) ergoemacs-deferred-keys))
+ (setq i (+ i 1))
(push (cons emulation-var (ergoemacs-get-fixed-map--composite tmp))
hook-map-list))))
(setq ergoemacs-emulation-mode-map-alist
- `(,@hook-map-list
- ,@(mapcar
- (lambda(remap)
- (cons remap (oref (ergoemacs-get-fixed-map obj remap) map)))
- (ergoemacs-get-hooks obj "-mode\\'"))
+ `(,@(reverse
+ (append
+ hook-map-list
+ (mapcar
+ (lambda(remap)
+ (with-slots (map
+ deferred-keys) (ergoemacs-get-fixed-map obj
remap)
+ (when deferred-keys
+ (push (cons i (cons remap deferred-keys))
ergoemacs-deferred-keys))
+ (setq i (+ i 1))
+ (cons remap map)))
+ (ergoemacs-get-hooks obj "-mode\\'"))))
(ergoemacs-shortcut-keys ,@(or shortcut-map
(make-sparse-keymap)))))
ergoemacs-emulation-mode-map-alist)))
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 6aa6224..9a81500 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -851,7 +851,8 @@
(ergoemacs-theme-component ido-remaps ()
"Remaps for ido-mode"
(when ido-mode
- (global-set-key [remap execute-extended-command] 'smex)))
+ (global-set-key [remap execute-extended-command] 'smex))
+ (setq smex-prompt-string (substitute-command-keys
"\\[execute-extended-command] ")))
(ergoemacs-theme-component ergoemacs-remaps ()
"Remaps for ergoemacs-mode"
- [elpa] 51/287: more substitute-command-keys fixes, (continued)
- [elpa] 51/287: more substitute-command-keys fixes, Matthew Fidler, 2014/07/02
- [elpa] 58/287: Fix misplaced paren, Matthew Fidler, 2014/07/02
- [elpa] 57/287: Added basic variable/mode initialization routines., Matthew Fidler, 2014/07/02
- [elpa] 54/287: Maps seem correct now, Matthew Fidler, 2014/07/02
- [elpa] 48/287: Unstage the incompatible, Matthew Fidler, 2014/07/02
- [elpa] 55/287: Nicer theme debugging display, Matthew Fidler, 2014/07/02
- [elpa] 56/287: Better key replacements., Matthew Fidler, 2014/07/02
- [elpa] 64/287: Replace either M-x or <execute> with M-x code., Matthew Fidler, 2014/07/02
- [elpa] 63/287: Fixed mapvar issues., Matthew Fidler, 2014/07/02
- [elpa] 47/287: Stage some components, Matthew Fidler, 2014/07/02
- [elpa] 62/287: Playing with object more.,
Matthew Fidler <=
- [elpa] 53/287: Better debug and modify keymaps fix bugs, Matthew Fidler, 2014/07/02
- [elpa] 59/287: Fix typo, Matthew Fidler, 2014/07/02
- [elpa] 61/287: Ergoemacs-mode setup with object almost complete., Matthew Fidler, 2014/07/02
- [elpa] 66/287: Make ergoemacs-clean toggle debug on error, Matthew Fidler, 2014/07/02
- [elpa] 71/287: Fix isearch issues., Matthew Fidler, 2014/07/02
- [elpa] 60/287: Ensure the object-name is a string. EIEIO seems to prefer this., Matthew Fidler, 2014/07/02
- [elpa] 69/287: Install shortcut-layer appropriately for keymaps., Matthew Fidler, 2014/07/02
- [elpa] 73/287: use remove-duplicates instead, Matthew Fidler, 2014/07/02
- [elpa] 70/287: Fix most global-set-key after issues, Matthew Fidler, 2014/07/02
- [elpa] 65/287: Add more emulation alists. Less list manipulation, Matthew Fidler, 2014/07/02