[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 73/287: use remove-duplicates instead
From: |
Matthew Fidler |
Subject: |
[elpa] 73/287: use remove-duplicates instead |
Date: |
Wed, 02 Jul 2014 14:44:44 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 0eefbbe34510f0177ed156b3ecae328f4714d422
Author: Matthew L. Fidler <address@hidden>
Date: Thu Jun 12 09:00:43 2014 -0500
use remove-duplicates instead
---
ergoemacs-theme-engine.el | 62 +++++++++++++++++++++++++++-----------------
1 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 6b20600..913f6eb 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -846,6 +846,9 @@ Assumes maps are orthogonal."
(fixed-maps :initarg :fixed-maps
:initform (make-hash-table)
:type hash-table)
+ (hooks :initarg :hooks
+ :initform (make-hash-table :test 'equal)
+ :type hash-table)
(init :initarg :init
:initform ()
:type list)
@@ -871,13 +874,12 @@ Assumes maps are orthogonal."
maps)
(oset obj global global)
(oset obj fixed-maps (make-hash-table))
+ (oset obj hooks (make-hash-table :test 'equal))
(oset obj init (copy-list init))
(oset obj maps newmaps))))
(defmethod ergoemacs-theme-component-maps--save-hash ((obj
ergoemacs-theme-component-maps))
(with-slots (object-name version) obj
- (when (not (string= version ""))
- (message "Save %s" (object-name-string obj)))
(puthash (object-name-string obj)
obj ergoemacs-theme-comp-hash)))
@@ -962,18 +964,23 @@ Assumes maps are orthogonal."
(defmethod ergoemacs-get-hooks ((obj ergoemacs-theme-component-maps) &optional
match ret keymaps)
(ergoemacs-theme-component-maps--ini obj)
- (let ((ret (or ret '()))
- (match (or match "-hook\\'")))
- (with-slots (maps) obj
- (maphash
- (lambda (ignore-key map-obj)
- (when (and (slot-boundp map-obj 'hook)
- (string-match-p match (symbol-name (oref map-obj hook))))
- (if keymaps
- (pushnew (oref map-obj object-symbol) ret)
- (pushnew (oref map-obj hook) ret))))
- maps))
- ret))
+ (with-slots (maps hooks) obj
+ (let* ((ret (or ret '()))
+ (match (or match "-hook\\'"))
+ (append-ret (gethash (list match ret) hooks)))
+ (unless append-ret
+ (maphash
+ (lambda (ignore-key map-obj)
+ (when (and (slot-boundp map-obj 'hook)
+ (string-match-p match (symbol-name (oref map-obj hook))))
+ (if keymaps
+ (push (oref map-obj object-symbol) append-ret)
+ (push (oref map-obj hook) append-ret))))
+ maps)
+ (puthash (list match ret) append-ret hooks)
+ (oset obj hooks hooks))
+ (setq ret (append append-ret ret))
+ ret)))
(defvar ergoemacs-theme-component-map-list-fixed-hash (make-hash-table :test
'equal))
(defclass ergoemacs-theme-component-map-list (ergoemacs-named)
@@ -982,7 +989,10 @@ Assumes maps are orthogonal."
:type list)
(components :initarg :components
:initform ()
- :type list))
+ :type list)
+ (hooks :initarg :hooks
+ :initform (make-hash-table :test 'equal)
+ :type hash-table))
"`ergoemacs-mode' theme-component maps")
(defmethod ergoemacs-get-versions ((obj ergoemacs-theme-component-map-list) )
@@ -995,13 +1005,17 @@ Assumes maps are orthogonal."
(pushnew ver ret :test 'equal)))))
(sort ret 'string<))))
-(defmethod ergoemacs-get-hooks ((obj ergoemacs-theme-component-map-list)
&optional match ret keymaps)
- (with-slots (map-list) obj
- (let ((ret (or ret '())))
- (dolist (map map-list)
- (when (ergoemacs-theme-component-maps-p map)
- (setq ret (ergoemacs-get-hooks map match ret keymaps))))
- ret)))
+(defmethod ergoemacs-get-hooks ((obj ergoemacs-theme-component-map-list)
&optional match keymaps)
+ (with-slots (map-list hooks) obj
+ (let* ((final (gethash (list match keymaps) hooks))
+ ret test)
+ (unless final
+ (dolist (map map-list)
+ (when (ergoemacs-theme-component-maps-p map)
+ (setq ret (ergoemacs-get-hooks map match ret keymaps))))
+ (setq final (remove-duplicates ret))
+ (puthash (list match keymaps) final hooks))
+ final)))
(defgeneric ergoemacs-get-keymaps-for-hook (obj hook &optional ret)
"Gets the keymaps that will be modified for HOOK.
@@ -1009,8 +1023,8 @@ Assumes maps are orthogonal."
Call:
ergoemacs-get-keymaps-for-hook OBJ HOOK")
-(defmethod ergoemacs-get-keymaps-for-hook ((obj
ergoemacs-theme-component-map-list) hook &optional ret)
- (ergoemacs-get-hooks obj (concat "\\`" (regexp-quote (symbol-name hook))
"\\'") ret t))
+(defmethod ergoemacs-get-keymaps-for-hook ((obj
ergoemacs-theme-component-map-list) hook)
+ (ergoemacs-get-hooks obj (concat "\\`" (regexp-quote (symbol-name hook))
"\\'") t))
(defmethod ergoemacs-get-inits ((obj ergoemacs-theme-component-map-list))
(let (ret '())
- [elpa] 63/287: Fixed mapvar issues., (continued)
- [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, 2014/07/02
- [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 <=
- [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
- [elpa] 74/287: Fix <apps> e t bug with object interface., Matthew Fidler, 2014/07/02
- [elpa] 75/287: Only put in shortcut-hash if not removed from keymap., Matthew Fidler, 2014/07/02
- [elpa] 68/287: Make the caching more robust, Matthew Fidler, 2014/07/02
- [elpa] 72/287: Fix copy objects to allow keymap versions., Matthew Fidler, 2014/07/02
- [elpa] 79/287: Fix final map to be a composed keymap that works with ergoemacs-rm-key, Matthew Fidler, 2014/07/02
- [elpa] 76/287: Only Issue 86 still persists., Matthew Fidler, 2014/07/02
- [elpa] 77/287: Ensure ergoemacs-global-override-rm-keys is a list of vectors, Matthew Fidler, 2014/07/02
- [elpa] 80/287: Reverse order to allow <apps> h z processing., Matthew Fidler, 2014/07/02