Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 01329431FC7 for ; Fri, 18 Jan 2013 08:04:20 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H7pGzymxmc5A for ; Fri, 18 Jan 2013 08:04:19 -0800 (PST) Received: from mail-we0-f174.google.com (mail-we0-f174.google.com [74.125.82.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id DC08B431FC9 for ; Fri, 18 Jan 2013 08:04:15 -0800 (PST) Received: by mail-we0-f174.google.com with SMTP id x10so927149wey.33 for ; Fri, 18 Jan 2013 08:04:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=M/GivEDbX31/dubUPZ6r2mJBN+oyTXrUV/ASJLmDQt4=; b=cggiB0qKPPnFI4pXmuRJ0wyHC1sfLJ1hWitcV3w/nzr1Fgw26os3bRl0Brcqyfg94q MXAOB/jycgTHkpWBgUjC9ZWALPtXodg2RWBbfUAxW2NHn40VoDnA8IQgNCsbO27dch8H RiuBDkxP9djTVd1EX1CRg8hNLdPfPAym/YdB65uk/vtpffsl6dw7cceucjgusOgosfis FqLzkzJbvrFNTnXRFmZgQyZphK9YoXO+kcoGYQy7TFiBr86d8+z2WdN/oCZgROMHhSzS FF1pqbI75mBzBEdxKBfXf3eS3UpiqxkIFhgSayEn66Z4stU6g+PC9aktMM3zKTk/P8vu OWXA== X-Received: by 10.180.88.40 with SMTP id bd8mr4442132wib.33.1358525053367; Fri, 18 Jan 2013 08:04:13 -0800 (PST) Received: from luz3.lille.inria.fr ([193.51.236.44]) by mx.google.com with ESMTPS id i2sm4073866wiw.3.2013.01.18.08.04.11 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jan 2013 08:04:12 -0800 (PST) From: Damien Cassou To: notmuch mailing list Subject: [PATCH 1/4] emacs: Add notmuch-intersperse to notmuch-lib/ Date: Fri, 18 Jan 2013 17:03:55 +0100 Message-Id: <1358525039-13569-2-git-send-email-damien.cassou@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358525039-13569-1-git-send-email-damien.cassou@gmail.com> References: <1358525039-13569-1-git-send-email-damien.cassou@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2013 16:04:20 -0000 (notmuch-intersperse LIST SEP) Return a list with all elements of LIST separated by SEP. Signed-off-by: Damien Cassou --- 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