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