Re: [PATCH v2 4/7] emacs: Use result text properties for search result iteration
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 14 Jul 2012 19:31:45 +0000 (12:31 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:18 +0000 (09:48 -0800)
71/971f1a6ae8dffe842b51641f13391aa4309bb5 [new file with mode: 0644]

diff --git a/71/971f1a6ae8dffe842b51641f13391aa4309bb5 b/71/971f1a6ae8dffe842b51641f13391aa4309bb5
new file mode 100644 (file)
index 0000000..4d2016b
--- /dev/null
@@ -0,0 +1,127 @@
+Return-Path: <jrollins@finestructure.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 5F155431FD7\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 12:31:52 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.29\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] 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 j5dQuSuBn-OL for <notmuch@notmuchmail.org>;\r
+       Sat, 14 Jul 2012 12:31:52 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id E924C431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 12:31:51 -0700 (PDT)\r
+Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by earth-doxen-postvirus (Postfix) with ESMTP id 9AF1566E00D3;\r
+       Sat, 14 Jul 2012 12:31:51 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+       (Authenticated sender: jrollins)\r
+       by earth-doxen-submit (Postfix) with ESMTP id C0E4966E00AE;\r
+       Sat, 14 Jul 2012 12:31:48 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 5CFFD73E; Sat, 14 Jul 2012 12:31:48 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 4/7] emacs: Use result text properties for search\r
+       result iteration\r
+In-Reply-To: <1342237406-32507-5-git-send-email-amdragon@mit.edu>\r
+References: <1342140319-19859-1-git-send-email-amdragon@mit.edu>\r
+       <1342237406-32507-1-git-send-email-amdragon@mit.edu>\r
+       <1342237406-32507-5-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.13.2+82~gd0a8b58 (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sat, 14 Jul 2012 12:31:45 -0700\r
+Message-ID: <87d33yf8bi.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha256; protocol="application/pgp-signature"\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: Sat, 14 Jul 2012 19:31:52 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Fri, Jul 13 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> Coincidentally, this also essentially enables multi-line search result\r
+> formats; the only remaining non-multi-line-capable functions are\r
+> notmuch-search-{next,previous}-thread, which are only used\r
+> interactively.\r
+\r
+So I tried to experiment with multi-line search results with this patch\r
+series, but it didn't work.  I tried adding a '\n' in one of the\r
+formatter fields, but I got a series of errors for each result insertion\r
+in the buffer.  What's the way to get multi-line to work?\r
+\r
+> +(defmacro notmuch-search-do-results (beg end pos-sym &rest body)\r
+> +  "Invoke BODY for each result between BEG and END.\r
+> +\r
+> +POS-SYM will be bound to the point at the beginning of the\r
+> +current result."\r
+> +  (declare (indent 3))\r
+> +  (let ((end-sym (make-symbol "end"))\r
+> +    (first-sym (make-symbol "first")))\r
+> +    `(let ((,pos-sym (notmuch-search-result-beginning ,beg))\r
+> +       ;; End must be a marker in case body changes the text\r
+> +       (,end-sym (copy-marker ,end))\r
+> +       ;; Make sure we examine one result, even if (=3D beg end)\r
+> +       (,first-sym t))\r
+> +       ;; We have to be careful if the region extends beyond the\r
+> +       ;; results.  In this case, pos could be null or there could be\r
+> +       ;; no result at pos.\r
+> +       (while (and ,pos-sym (or (< ,pos-sym ,end-sym) ,first-sym))\r
+> +     (when (notmuch-search-get-result ,pos-sym)\r
+> +       ,@body)\r
+> +     (setq ,pos-sym (notmuch-search-result-end ,pos-sym)\r
+> +           ,first-sym nil)))))\r
+\r
+Austin, can you explain why you use a defmacro here?  I'm honestly have\r
+a hard time parsing what's going on here.  I understand in principle how\r
+elisp macros work, but I don't see why it's needed here.\r
+\r
+I'm also trying to understand what the commas are doing\r
+(e.g. ",pos-sym").  Are they doing some sort of escaping?=20=20\r
+\r
+Some sophisticated elisp here!\r
+\r
+jamie.\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.12 (GNU/Linux)\r
+\r
+iQIcBAEBCAAGBQJQAckiAAoJEO00zqvie6q8npUP/0BHgS9V1uRn9POipVtZM6CQ\r
+eR4Y3QTJf7gn1JGcvAnrWtbVrobWu3sW3eKdsZaNdxQ+BWZPhuoSihjDSOAgK157\r
+Mr7dj9s5Qj7FctvS4TNKWhcpr6L7NECngKQnulPIqK51tyVKqgueeBko0+x/xC5o\r
+JKtDWEeONdBpvEV7FlPR9kDvpIv6CFLlllTrRokmsFS2t11ueOP3iSyAD7vxtRUG\r
+WSs0uBtr0v2CXcKtJW1FT/KcW3r4k6/AOM0Zp10AUfQVkz+yt8+AqdY1eD/Py06o\r
+tyUdmtmuMqWhUxuw4dQEUKMJvxzmoj8uq9Y+a60FQJKD3VyhZgkJs3WDylMokUjE\r
+CbhdBehaEa5fFqFhI9pWixQ8EeSVYgVAID2XVuITUeWYQ/KZlEArQgksqyMOx8BM\r
+lzmyT8kvJ9qD78D131v9HFe98stzoqz88q67xTGww+1ySd2vyI8DoaIIMS74PlR8\r
+bn6+FE2C0PDuvhJYqdmf+vVV0HaPENc+KI+hzsBm+KcVEcUqjouiSXCM3ocVmgPJ\r
+zhvGOE7Uw9W8vb+eG+by+NMkZ1vyto3tKzZTlYDdUWGfE1OlU6ch1V6SXLiCciLZ\r
+se4QDQy2xw+ZVUHVShxsvDl5npRnMImxTDli+9A7eELfyy2Ae9arcFo9DxBjM1pJ\r
+2QsFRFnNIs3y0FIcPG5M\r
+=JQX1\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r