emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/async bd68cc1 58/60: Handle dotted lists as well


From: Stefan Monnier
Subject: [elpa] externals/async bd68cc1 58/60: Handle dotted lists as well
Date: Tue, 8 Oct 2019 10:11:37 -0400 (EDT)

branch: externals/async
commit bd68cc1ab1ac6af890e250bdaa12ffb1cb9649be
Author: Thierry Volpiatto <address@hidden>
Commit: Thierry Volpiatto <address@hidden>

    Handle dotted lists as well
    
    This is limited though to dotted lists like (x . y)
    and not (x . (x . y)).
    
    * async.el (async--purecopy): Do it.
---
 async.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/async.el b/async.el
index e20e373..d616b11 100644
--- a/async.el
+++ b/async.el
@@ -61,12 +61,28 @@ is returned unmodified."
          (substring-no-properties object))
         ((consp object)
          (cl-loop for elm in object
+                  ;; A string.
                   if (stringp elm)
                   collect (substring-no-properties elm)
                   else
+                  ;; Proper lists.
                   if (and (consp elm) (null (cdr (last elm))))
                   collect (async--purecopy elm)
                   else
+                  ;; Dotted lists.
+                  ;; We handle here only dotted list where car and cdr
+                  ;; are atoms i.e. (x . y) and not (x . (x . y)) or
+                  ;; (x . (x y)) which should fit most cases.
+                  if (and (consp elm) (cdr (last elm)))
+                  collect (let ((key (car elm))
+                                (val (cdr elm)))
+                            (cons (if (stringp key)
+                                      (substring-no-properties key)
+                                    key)
+                                  (if (stringp val)
+                                      (substring-no-properties val)
+                                    val)))
+                  else
                   collect elm))
         (t object)))
 



reply via email to

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