[PATCH 1/4] emacs: Add notmuch-intersperse to notmuch-lib/

Damien Cassou damien.cassou at gmail.com
Fri Jan 18 08:03:55 PST 2013


(notmuch-intersperse LIST SEP)

Return a list with all elements of LIST separated by SEP.

Signed-off-by: Damien Cassou <damien.cassou at gmail.com>
---
 emacs/notmuch-lib.el |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index d78bcf8..3566126 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -716,8 +716,15 @@ left it."
     ;; Clear out what we've parsed
     (delete-region (point-min) (point))))
 
-
-
+(defun notmuch-intersperse (list sep)
+  "Return a list with all elements of LIST separated by SEP."
+  (let ((first t)
+        (res nil))
+    (dolist (elt list (nreverse res))
+      (unless first
+        (push sep res))
+      (setq first nil)
+      (push elt res))))
 
 (provide 'notmuch-lib)
 
-- 
1.7.10.4



More information about the notmuch mailing list