--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1881F431FD7\r
+ for <notmuch@notmuchmail.org>; Mon, 27 May 2013 00:35:32 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 0pPOMqxPcs9Z for <notmuch@notmuchmail.org>;\r
+ Mon, 27 May 2013 00:35:23 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 81915431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 27 May 2013 00:35:23 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Ugrxh-0007Bp-D5; Mon, 27 May 2013 08:35:22 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Ugrxh-0002la-26; Mon, 27 May 2013 08:35:21 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/2] contrib: pick: add thread based utility functions\r
+In-Reply-To: <87fvxswgff.fsf@zancas.localnet>\r
+References: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com>\r
+ <1354970914-18342-2-git-send-email-markwalters1009@gmail.com>\r
+ <87fvxswgff.fsf@zancas.localnet>\r
+User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
+ (i486-pc-linux-gnu)\r
+Date: Mon, 27 May 2013 08:35:18 +0100\r
+Message-ID: <878v30kh8p.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: cb557fcb22de4c19ba253139540d261a (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 27 May 2013 07:35:32 -0000\r
+\r
+\r
+Hi\r
+\r
+David Bremner <david@tethera.net> writes:\r
+\r
+> Mark Walters <markwalters1009@gmail.com> writes:\r
+>\r
+>> Previously notmuch-pick had no thread based functionality. This adds a\r
+>> macro to iterate through all messages in a thread. To simplify this it\r
+>> adds a text-property marker to the first message of each thread.\r
+>\r
+>\r
+>> +(defun notmuch-pick-get-messages-ids-thread ()\r
+>> + "Return all id: queries of messages in the current thread."\r
+>> + (let ((message-ids))\r
+>> + (notmuch-pick-thread-mapc\r
+>> + (lambda () (push (notmuch-pick-get-message-id) message-ids)))\r
+>> + message-ids))\r
+>\r
+> As a style thing, it seems more idiomatic to me to have a map macro\r
+> which returns a sequence, rather than faking it with mapc and push. But\r
+> maybe that's a typical common lisp style, I don't know.\r
+\r
+I think I agree: this is very closely copied from notmuch-show\r
+(notmuch-show-mapc and notmuch-show-get-messages-id) so it is probably\r
+worth staying the same.\r
+\r
+> More importantly, in emacs 24.3 I get an infinite loop when trying to\r
+> evaluate the update notmuch-pick.el. \r
+\r
+I think this is just stupidity on my part: it should be a defun rather\r
+than a defmacro. Would you be able to test that (or I can send a new\r
+version if you prefer)?\r
+\r
+Also, how are you loading notmuch-pick? In my set up the macro and\r
+function work interchangeably.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+>\r
+> The backtrace is below. I'm not a macro expert, but seems like too much\r
+> is happening at compile/eval time.\r
+>\r
+> ----------------------------------------------------------------------\r
+>\r
+> Debugger entered--Lisp error: (quit)\r
+> (save-excursion (beginning-of-line) (get-text-property (point) :notmuch-message-properties))\r
+> notmuch-pick-get-message-properties()\r
+> (or props (notmuch-pick-get-message-properties))\r
+> (let ((props (or props (notmuch-pick-get-message-properties)))) (plist-get props prop))\r
+> notmuch-pick-get-prop(:first)\r
+> (not (notmuch-pick-get-prop :first))\r
+> (while (not (notmuch-pick-get-prop :first)) (forward-line -1))\r
+> notmuch-pick-thread-top()\r
+> (save-excursion (notmuch-pick-thread-top) (progn (while (progn (progn (funcall function) (forward-line)) (and (notmuch-pick-get-message-properties) (not (notmuch-pick-get-prop :first))))) nil))\r
+> (lambda (function) "Iterate through all messages in the current thread\n and call FUNCTION for side effects." (save-excursion (notmuch-pick-thread-top) (progn (while (progn (progn (funcall function) (forward-line)) (and (notmuch-pick-get-message-properties) (not (notmuch-pick-get-prop :first))))) nil)))((lambda nil (push (notmuch-pick-get-message-id) message-ids)))\r
+> macroexpand((notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) nil)\r
+> macroexp--expand-all((notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))))\r
+> macroexp--all-forms(((notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids))\r
+> #[1028 "\300.\300\301.\302\"\303.\a!.\b@A#..@#\207" [macroexp--cons macroexp--all-clauses 1 macroexp--all-forms] 10 "\n\n(fn FORM BODY BINDINGS FUN)"](((let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)) ((notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids) ((message-ids)) let)\r
+> macroexp--expand-all((let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids))\r
+> macroexp--all-forms((lambda nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)) 2)\r
+> macroexp--expand-all((function (lambda nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids))))\r
+> macroexp--all-forms((defalias (quote notmuch-pick-get-messages-ids-thread) (function (lambda nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)))) 1)\r
+> #[514 "\300.\301\"\211\204.\r
+> macroexp--expand-all((defun notmuch-pick-get-messages-ids-thread nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)))\r
+> macroexpand-all((defun notmuch-pick-get-messages-ids-thread nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)))\r
+> #[0 " \nB.\303\300!)\207" [(defun notmuch-pick-get-messages-ids-thread nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)) load-file-name macroexp--pending-eager-loads macroexpand-all] 2 "\n\n(fn)"]()\r
+> funcall(#[0 " \nB.\303\300!)\207" [(defun notmuch-pick-get-messages-ids-thread nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)) load-file-name macroexp--pending-eager-loads macroexpand-all] 2 "\n\n(fn)"])\r
+> internal-macroexpand-for-load((defun notmuch-pick-get-messages-ids-thread nil "Return all id: queries of messages in the current thread." (let ((message-ids)) (notmuch-pick-thread-mapc (lambda nil (push (notmuch-pick-get-message-id) message-ids))) message-ids)))\r
+> eval-current-buffer()\r
+> call-interactively(eval-current-buffer record nil)\r
+> command-execute(eval-current-buffer record)\r
+> execute-extended-command(nil "eval-current-buffer")\r
+> call-interactively(execute-extended-command nil nil)\r