Re: [PATCH 1/2] contrib: pick: add thread based utility functions
authorDavid Bremner <david@tethera.net>
Sun, 12 May 2013 12:06:44 +0000 (09:06 +2100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:42 +0000 (09:54 -0800)
a9/864bee84df629d8ae81e7ecaef177e98ba8a84 [new file with mode: 0644]

diff --git a/a9/864bee84df629d8ae81e7ecaef177e98ba8a84 b/a9/864bee84df629d8ae81e7ecaef177e98ba8a84
new file mode 100644 (file)
index 0000000..4136f5f
--- /dev/null
@@ -0,0 +1,117 @@
+Return-Path: <david@tethera.net>\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 B21E0431FBC\r
+       for <notmuch@notmuchmail.org>; Sun, 12 May 2013 05:06:59 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[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 dVVtz3OaBkTL for <notmuch@notmuchmail.org>;\r
+       Sun, 12 May 2013 05:06:53 -0700 (PDT)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\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 5A3A1431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 12 May 2013 05:06:53 -0700 (PDT)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+       by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id r4CC6pYY001308;\r
+       Sun, 12 May 2013 09:06:51 -0300\r
+Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+       ([156.34.82.78] helo=zancas.localnet)\r
+       by tesseract.cs.unb.ca with esmtpsa\r
+       (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80)\r
+       (envelope-from <david@tethera.net>)\r
+       id 1UbV3C-0003Sk-JK; Sun, 12 May 2013 09:06:51 -0300\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+       (envelope-from <david@tethera.net>)\r
+       id 1UbV37-00064F-0l; Sun, 12 May 2013 09:06:45 -0300\r
+From: David Bremner <david@tethera.net>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/2] contrib: pick: add thread based utility functions\r
+In-Reply-To: <1354970914-18342-2-git-send-email-markwalters1009@gmail.com>\r
+References: <1354970914-18342-1-git-send-email-markwalters1009@gmail.com>\r
+       <1354970914-18342-2-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.15.2+84~g12d5e4e (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sun, 12 May 2013 09:06:44 -0300\r
+Message-ID: <87fvxswgff.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Content-Transfer-Encoding: 8bit\r
+X-Spam_bar: /\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: Sun, 12 May 2013 12:06:59 -0000\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
+More importantly, in emacs 24.3 I get an infinite loop when trying to\r
+evaluate the update notmuch-pick.el. \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#.\ 6@#\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