emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master fe5ba92: * lisp/let-alist.el (let-alist--deep-dot-s


From: Artur Malabarba
Subject: [Emacs-diffs] master fe5ba92: * lisp/let-alist.el (let-alist--deep-dot-search): Fix cons
Date: Thu, 11 Jun 2015 14:10:01 +0000

branch: master
commit fe5ba924027b46462a7f528b10dfa9890093d477
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * lisp/let-alist.el (let-alist--deep-dot-search): Fix cons
    
    * test/automated/let-alist.el (let-alist-cons): Test it.
---
 lisp/let-alist.el           |    8 ++++----
 test/automated/let-alist.el |   13 +++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lisp/let-alist.el b/lisp/let-alist.el
index 80b72d3..ca7a904 100644
--- a/lisp/let-alist.el
+++ b/lisp/let-alist.el
@@ -4,7 +4,7 @@
 
 ;; Author: Artur Malabarba <address@hidden>
 ;; Maintainer: Artur Malabarba <address@hidden>
-;; 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."
diff --git a/test/automated/let-alist.el b/test/automated/let-alist.el
index c436d89..65727dc 100644
--- a/test/automated/let-alist.el
+++ b/test/automated/let-alist.el
@@ -48,6 +48,19 @@
               ..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.")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]