unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>
To: David Edmondson <dme@dme.org>
Cc: notmuch <notmuch@notmuchmail.org>
Subject: Re: [PATCH v2 4/5] emacs: Use the new JSON reply format.
Date: Wed, 18 Jan 2012 09:29:08 -0700	[thread overview]
Message-ID: <CAMoJFUtzGVTpAf6L3TovcXvtc=E8g+EoJj9iu7QHgga5=o3N7A@mail.gmail.com> (raw)
In-Reply-To: <cunty3to5zp.fsf@hotblack-desiato.hh.sledj.net>

On Tue, Jan 17, 2012 at 23:54, David Edmondson <dme@dme.org> wrote:
> On Tue, 17 Jan 2012 15:53:37 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
>> +(defun notmuch-parts-filter-by-type (parts type)
>> +  "Return a list of message parts with the given type"
>> +  (let (result)
>> +    (dolist (part (append parts nil) result)
>> +      (if (string= (cdr (assq 'content-type part)) type)
>> +       (setq result (append result (list (cdr (assq 'content part)))))))
>> +    result))
>
> I still think that `loop' is easier to read :-) But no objection to this
> code.

I couldn't find the loop construct initially, but after the discussion
of common lisp on IRC yesterday I found the cl package and figured out
how your example worked.  With loop and collect figured out, it is
easier to read.

>> +(defun notmuch-mua-insert-part-quoted (part)
>> +  (let ((start (point))
>> +     limit)
>> +    (insert part)
>> +    (setq limit (point))
>> +    (goto-char start)
>> +    (while (re-search-forward "\\(^\\)[^$]" limit 0)
>> +      (replace-match "> " nil nil nil 1)
>> +      ;; We have added two characters to the quotable region
>> +      (setq limit (+ limit 2)))
>> +    (set-buffer-modified-p nil)))
>
> You could use a marker for the limit, as it would then move along
> automagically (sorry for not noticing this last time).

Aha!  Another trick I didn't know about.

New patch forthcoming.

  reply	other threads:[~2012-01-18 16:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 18:13 [PATCH v2 0/4] Quoting HTML Emails in Reply Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 1/4] test: Add broken test for the new JSON reply format Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 2/4] reply: Add a " Adam Wolfe Gordon
2012-01-18 23:07   ` Jani Nikula
2012-01-18 23:29     ` Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 3/4] man: Update notmuch-reply man page for JSON format Adam Wolfe Gordon
2012-01-16 18:13 ` [PATCH v2 4/4] emacs: Use the new JSON reply format Adam Wolfe Gordon
2012-01-17  9:04   ` David Edmondson
2012-01-17 16:18     ` Adam Wolfe Gordon
2012-01-17 22:53     ` [PATCH v2 4/5] " Adam Wolfe Gordon
2012-01-17 22:53       ` [PATCH v2 5/5] emacs: Use message-citation-line-format in reply Adam Wolfe Gordon
2012-01-18  6:54       ` [PATCH v2 4/5] emacs: Use the new JSON reply format David Edmondson
2012-01-18 16:29         ` Adam Wolfe Gordon [this message]
2012-01-18 16:32         ` Adam Wolfe Gordon
2012-01-18 16:41           ` David Edmondson
2012-01-18 17:08             ` Adam Wolfe Gordon
2012-01-17  1:18 ` [PATCH v2 5/4] emacs: Add customization for the first line of quotes Adam Wolfe Gordon
2012-01-17  7:17   ` how about message-citation-line-format (was: Re: [PATCH v2 5/4] emacs: Add customization for the first line of quotes.) Gregor Zattler
2012-01-17  9:05     ` David Edmondson
2012-01-17 16:20     ` Adam Wolfe Gordon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMoJFUtzGVTpAf6L3TovcXvtc=E8g+EoJj9iu7QHgga5=o3N7A@mail.gmail.com' \
    --to=awg+notmuch@xvx.ca \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).