Re: [PATCH v2 4/4] emacs: Use the new JSON reply format.
authorDavid Edmondson <dme@dme.org>
Tue, 17 Jan 2012 09:04:39 +0000 (09:04 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:23 +0000 (09:42 -0800)
e7/849dde01279fcb67e8948ebe13452e8d46b50a [new file with mode: 0644]

diff --git a/e7/849dde01279fcb67e8948ebe13452e8d46b50a b/e7/849dde01279fcb67e8948ebe13452e8d46b50a
new file mode 100644 (file)
index 0000000..8df904a
--- /dev/null
@@ -0,0 +1,169 @@
+Return-Path: <dme@dme.org>\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 3F16B429E35\r
+       for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 01:04:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 47NGKq4RDcL6 for <notmuch@notmuchmail.org>;\r
+       Tue, 17 Jan 2012 01:04:47 -0800 (PST)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A8D6E429E2F\r
+       for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 01:04:47 -0800 (PST)\r
+Received: by werp13 with SMTP id p13so133006wer.26\r
+       for <notmuch@notmuchmail.org>; Tue, 17 Jan 2012 01:04:46 -0800 (PST)\r
+Received: by 10.216.132.8 with SMTP id n8mr5298642wei.35.1326791086394;\r
+       Tue, 17 Jan 2012 01:04:46 -0800 (PST)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+       (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
+       by mx.google.com with ESMTPS id em13sm15537205wid.7.2012.01.17.01.04.44\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 17 Jan 2012 01:04:45 -0800 (PST)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+       id ED75CA0048; Tue, 17 Jan 2012 09:04:42 +0000 (GMT)\r
+To: Adam Wolfe Gordon <awg+notmuch@xvx.ca>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 4/4] emacs: Use the new JSON reply format.\r
+In-Reply-To: <1326737603-21166-5-git-send-email-awg+notmuch@xvx.ca>\r
+References: <1326737603-21166-1-git-send-email-awg+notmuch@xvx.ca>\r
+       <1326737603-21166-5-git-send-email-awg+notmuch@xvx.ca>\r
+User-Agent: Notmuch/0.11+64~g42e8f66 (http://notmuchmail.org) Emacs/24.0.92.1\r
+       (x86_64-pc-linux-gnu)\r
+From: David Edmondson <dme@dme.org>\r
+Date: Tue, 17 Jan 2012 09:04:39 +0000\r
+Message-ID: <cuny5t6r97c.fsf@hotblack-desiato.hh.sledj.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; 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: Tue, 17 Jan 2012 09:04:51 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Much nicer now that it uses the mm stuff.\r
+\r
+On Mon, 16 Jan 2012 11:13:23 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> =\r
+wrote:\r
+> +(defun find-parts (parts type)\r
+\r
+Sorry for being a nuisance - this needs a name that indicates that it\r
+relates to notmuch. How about `notmuch-parts-filter-by-type'?\r
+\r
+> +  "Return a list of message parts with the given type"\r
+> +  (delq nil (mapcar (lambda (part)\r
+> +                  (if (string=3D (cdr (assq 'content-type part)) type)\r
+> +                      (cdr (assq 'content part))))\r
+> +                parts)))\r
+\r
+'(delq nil ...)' can more readably be implemented using something like:\r
+\r
+       (loop for part in parts\r
+             if (string=3D (cdr (assq 'content-type part)) type)\r
+             collect (cdr (assq 'content part)))\r
+\r
+(untested).\r
+\r
+> +(defun notmuch-mua-insert-part-quoted (part)\r
+> +  (save-restriction\r
+> +    (narrow-to-region (point) (point))\r
+> +    (insert part)\r
+> +    (goto-char (point-min))\r
+> +    (perform-replace "^" "> " nil t nil)\r
+\r
+Narrowing to '(point) (point)' seems a bit weird and using\r
+`perform-replace' is discouraged in programs. It would be more normal to\r
+use a loop of `re-search-forward' and `replace-match' with a limit after\r
+the insertion. Something like:\r
+\r
+  (let ((start (point))\r
+       limit)\r
+    (insert part)\r
+    (setq limit (point))\r
+    (goto-char start)\r
+    (while (re-search-forward "^" limit t)\r
+      (replace-match "> "))\r
+\r
+    ...\r
+\r
+(untested).\r
+\r
+> +    (insert "\n")\r
+> +    (set-buffer-modified-p nil)))\r
+=20=20=20=20=20=20\r
+Is this newline always required? Is it the cause of the spurious blank\r
+line down below?\r
+\r
+> +(defun notmuch-mua-parse-html-part (part)\r
+> +  (with-temp-buffer\r
+> +    (insert part)\r
+> +    (let ((handle (mm-make-handle (current-buffer) (list "text/html")))\r
+> +      (end-of-orig (point-max)))\r
+> +      (mm-display-part handle)\r
+> +      (kill-region (point-min) end-of-orig)\r
+> +      (fill-region (point-min) (point-max))\r
+> +      (buffer-substring (point-min) (point-max)))))\r
+\r
+`kill-region' will save content in the kill ring. Was that intended?\r
+(Maybe `delete-region' instead?)\r
+\r
+>  (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
+> ...\r
+> +      (insert (format "On %s, %s wrote:\n"\r
+> +                  (cdr (assq 'date original-headers))\r
+> +                  (cdr (assq 'from original-headers))))\r
+\r
+I wonder whether emacs should be regenerating this or not. I'm okay with\r
+it, but previous discussion was that it should remain the responsibility\r
+of the CLI.\r
+\r
+> +      (if (null plain-parts)\r
+> +      (mapc (lambda (part) (notmuch-mua-insert-part-quoted (notmuch-mua-par=\r
+se-html-part part))) html-parts)\r
+> +    (mapc (lambda (part) (notmuch-mua-insert-part-quoted part)) plain-parts=\r
+))\r
+\r
+Flip the 'then' and 'else' clauses to get rid of the `null'?\r
+\r
+> --- a/test/emacs\r
+> +++ b/test/emacs\r
+> @@ -270,6 +270,7 @@ Fcc: $(pwd)/mail/sent\r
+>  --text follows this line--\r
+>  On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmai=\r
+l.org> wrote:\r
+>  > This is a test that messages are sent via SMTP\r
+> +>=20\r
+\r
+It would be good if you could get rid of this trailing blank line.\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.11 (GNU/Linux)\r
+\r
+iEYEARECAAYFAk8VOacACgkQaezQq/BJZRYbiQCfTfm/+mG4f3fm13Xii+EMUStQ\r
+HMgAn3Q8rXn1eqAhp2T731Yr+H5xHDND\r
+=GKQS\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r