]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values): Use cl-loop.
authorTino Calancha <tino.calancha@gmail.com>
Sat, 26 Nov 2016 03:03:25 +0000 (12:03 +0900)
committerTino Calancha <tino.calancha@gmail.com>
Sat, 26 Nov 2016 03:03:25 +0000 (12:03 +0900)
lisp/emacs-lisp/subr-x.el

index 173cd11fba49df9d8100d8714cdb732e21bae420..7d1e1c9237a5c7594030485d37da1529b0443b06 100644 (file)
@@ -33,6 +33,7 @@
 ;;; Code:
 
 (require 'pcase)
+(eval-when-compile (require 'cl-lib))
 
 
 (defmacro internal--thread-argument (first? &rest forms)
@@ -146,15 +147,11 @@ to bind a single value, BINDINGS can just be a plain tuple."
 
 (defsubst hash-table-keys (hash-table)
   "Return a list of keys in HASH-TABLE."
-  (let ((keys '()))
-    (maphash (lambda (k _v) (push k keys)) hash-table)
-    keys))
+  (cl-loop for k being the hash-keys of hash-table collect k))
 
 (defsubst hash-table-values (hash-table)
   "Return a list of values in HASH-TABLE."
-  (let ((values '()))
-    (maphash (lambda (_k v) (push v values)) hash-table)
-    values))
+  (cl-loop for v being the hash-values of hash-table collect v))
 
 (defsubst string-empty-p (string)
   "Check whether STRING is empty."