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

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

[elpa] externals/async 373b32a 55/60: Remove props recursively when inje


From: Stefan Monnier
Subject: [elpa] externals/async 373b32a 55/60: Remove props recursively when injecting vars with NOPROPS
Date: Tue, 8 Oct 2019 10:11:36 -0400 (EDT)

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

    Remove props recursively when injecting vars with NOPROPS
    
    * async.el (async-variables-noprops-function): Update to new name.
    (async--purecopy): Renamed from async-variables-noprops, now recursive.
---
 async.el | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/async.el b/async.el
index 771e641..cf46c38 100644
--- a/async.el
+++ b/async.el
@@ -37,7 +37,7 @@
   "Simple asynchronous processing in Emacs"
   :group 'emacs)
 
-(defcustom async-variables-noprops-function #'async-variables-noprops
+(defcustom async-variables-noprops-function #'async--purecopy
   "Default function to remove text properties in variables."
   :group 'async
   :type 'function)
@@ -52,23 +52,23 @@
 (defvar async-current-process nil)
 (defvar async--procvar nil)
 
-(defun async-variables-noprops (sequence)
-  "Remove text properties in SEQUENCE.
+(defun async--purecopy (object)
+  "Remove text properties in OBJECT.
 
-Argument SEQUENCE may be a list or a string, if anything else it
-is returned unmodified.
-
-Note that this is a naive function that doesn't remove text properties
-in SEQUENCE recursively, only at the first level which suffice in most
-cases."
-  (cond ((stringp sequence)
-         (substring-no-properties sequence))
-        ((listp sequence)
-         (cl-loop for elm in sequence
+Argument OBJECT may be a list or a string, if anything else it
+is returned unmodified."
+  (cond ((stringp object)
+         (substring-no-properties object))
+        ((listp object)
+         (cl-loop for elm in object
                   if (stringp elm)
                   collect (substring-no-properties elm)
-                  else collect elm))
-        (t sequence)))
+                  else
+                  if (and (listp elm) (null (cdr (last elm))))
+                  collect (async--purecopy elm)
+                  else
+                  collect elm))
+        (t object)))
 
 (defun async-inject-variables
   (include-regexp &optional predicate exclude-regexp noprops)



reply via email to

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