]> code.delx.au - gnu-emacs/commitdiff
* lisp/let-alist.el (let-alist--deep-dot-search): Fix cons
authorArtur Malabarba <bruce.connor.am@gmail.com>
Thu, 11 Jun 2015 14:08:32 +0000 (15:08 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Thu, 11 Jun 2015 14:08:32 +0000 (15:08 +0100)
* test/automated/let-alist.el (let-alist-cons): Test it.

lisp/let-alist.el
test/automated/let-alist.el

index 80b72d37ac980530fe55fe4a670ec7f88c136cbe..ca7a904a08766439e956b854dfaf35593f5d70d2 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
 ;; Maintainer: Artur Malabarba <bruce.connor.am@gmail.com>
-;; Version: 1.0.3
+;; Version: 1.0.4
 ;; Keywords: extensions lisp
 ;; Prefix: let-alist
 ;; Separator: -
@@ -72,9 +72,9 @@ symbol, and each cdr is the same symbol without the `.'."
         ;; Return the cons cell inside a list, so it can be appended
         ;; with other results in the clause below.
         (list (cons data (intern (replace-match "" nil nil name)))))))
-   ((not (listp data)) nil)
-   (t (apply #'append
-        (mapcar #'let-alist--deep-dot-search data)))))
+   ((not (consp data)) nil)
+   (t (append (let-alist--deep-dot-search (car data))
+              (let-alist--deep-dot-search (cdr data))))))
 
 (defun let-alist--access-sexp (symbol variable)
   "Return a sexp used to access SYMBOL inside VARIABLE."
index c436d89ca1f6870e6d1d4bca35211b09aa39fdae..65727dc3af56ddbc6f440e5bb6d1007173bf26ee 100644 (file)
               ..external ..external.too)))
     (list nil 0 1 2 3 "ext" "et"))))
 
+(ert-deftest let-alist-cons ()
+  (should
+   (equal
+    (let ((.external "ext")
+          (.external.too "et"))
+      (let-alist '((test-two . 0)
+                   (test-three . 1)
+                   (sublist . ((foo . 2)
+                               (bar . 3))))
+        (list `(, .test-one . , .test-two)
+              .sublist.bar ..external)))
+    (list '(nil . 0) 3 "ext"))))
+
 (defvar let-alist--test-counter 0
   "Used to count number of times a function is called.")