diff --git a/test/test-helper.el b/test/test-helper.el index c400d48..b63296b 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -114,23 +114,6 @@ Set the value of this variable at the beginning of each test that uses it.") -(unless (fboundp 'hash-table-keys) - (defun hash-table-keys (hash-table) - "Return a list of keys in HASH-TABLE." - (let (result) - (maphash (lambda (key value) - (setq result (append (list key) result))) - hash-table) - result)) - - (defun hash-table-values (hash-table) - "Return a list of values in HASH-TABLE." - (let (result) - (maphash (lambda (key value) - (setq result (append (list value) result))) - hash-table) - result))) - (defmacro purpose-with-empty-config (&rest body) (declare (indent defun) (debug body)) `(let ((purpose--user-mode-purposes (make-hash-table)) diff --git a/window-purpose-core.el b/window-purpose-core.el index c4cca1f..84aee97 100644 --- a/window-purpose-core.el +++ b/window-purpose-core.el @@ -80,8 +80,7 @@ mode and MODE-CONF. MODE-CONF is a hash table mapping modes to purposes." (when (get-buffer buffer-or-name) ; check if buffer exists (let* ((major-mode (purpose--buffer-major-mode buffer-or-name)) - (derived-modes (purpose--iter-hash (lambda (mode &optional _) mode) - mode-conf)) + (derived-modes (hash-table-keys mode-conf)) (derived-mode (apply #'derived-mode-p derived-modes))) (when derived-mode (gethash derived-mode mode-conf))))) diff --git a/window-purpose-utils.el b/window-purpose-utils.el index 752027a..8c9e0dc 100644 --- a/window-purpose-utils.el +++ b/window-purpose-utils.el @@ -100,15 +100,6 @@ Example: -(defun purpose--iter-hash (function table) - "Like `maphash', but return a list the results of calling FUNCTION -for each entry in hash-table TABLE." - (let (results) - (maphash (lambda (key value) - (push (funcall function key value) results)) - table) - results)) - ;; taken from http://emacs.stackexchange.com/a/7405/6533, credit to Jordon Biondo (defun purpose--call-stack () "Return the current call stack frames."