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

David Edmondson dme at dme.org
Tue Jan 17 22:54:34 PST 2012


On Tue, 17 Jan 2012 15:53:37 -0700, Adam Wolfe Gordon <awg+notmuch at 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).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120118/261935f8/attachment.pgp>


More information about the notmuch mailing list