[Top][All Lists]

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

[debbugs-tracker] bug#33309: closed (Add flatten-list?)

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#33309: closed (Add flatten-list?)
Date: Mon, 17 Dec 2018 11:35:03 +0000

Your message dated Mon, 17 Dec 2018 12:33:58 +0100
with message-id <address@hidden>
and subject line Re: bug#33309: [PATCH] flatten-list
has caused the debbugs.gnu.org bug report #33309,
regarding Add flatten-list?
to be marked as done.

(If you believe you have received this mail in error, please contact

33309: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33309
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Add flatten-list? Date: Wed, 07 Nov 2018 13:46:29 -0600 User-agent: mu4e 1.1.0; emacs 27.0.50
Could we add a new function `flatten-list'? There seems to be a need for
it. Inside Emacs itself, I see at least four implementations of the same
basic thing:

- eshell-flatten-list
- message-flatten-list
- lpr-flatten-list
- js--flatten-list

And there are many more in the various 3rd-party packages.

I was thinking of putting it in subr.el. What do you think?


diff --git a/lisp/subr.el b/lisp/subr.el
index 41dc9aa45f..3ea75ddf56 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -5447,5 +5447,14 @@ This function is called from lisp/Makefile and 
     (setq file (concat (substring file 1 2) ":" (substring file 2))))

+(defun flatten-list (list)
+  "Take LIST and \"flatten\" it.
+The result will be a list containing all the elements of LIST.
+\(flatten-list \\='(1 (2 3 (4 5 (6))) 7))
+=> (1 2 3 4 5 6 7)"
+  (cond ((null list) nil)
+        ((consp list) (append (flatten-list (car list))
+                             (flatten-list (cdr list))))
+        (t (list list))))

 ;;; subr.el ends here

Attachment: signature.asc
Description: PGP signature

--- End Message ---
--- Begin Message --- Subject: Re: bug#33309: [PATCH] flatten-list Date: Mon, 17 Dec 2018 12:33:58 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Version: 27.1

Alex Branham <address@hidden> writes:

Hi Alex,

> Thanks, changed. Updated patch attached.

There haven't been further comments, so I have pushed your patch to
master. Tramp is also adapted. Closing the bug.

> Alex

Best regards, Michael.

--- End Message ---

reply via email to

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