(notmuch-intersperse LIST SEP) Return a list with all elements of LIST separated by SEP. Signed-off-by: Damien Cassou <damien.cassou@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