Re: [PATCH v2 4/5] emacs: Use the new JSON reply format.

Subject: Re: [PATCH v2 4/5] emacs: Use the new JSON reply format.

Date: Wed, 18 Jan 2012 06:54:34 +0000

To: Adam Wolfe Gordon, notmuch

Cc:

From: David Edmondson


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.

> +(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).
part-000.sig (application/pgp-signature)

Thread: