On Tue, 17 Jan 2012 15:53:37 -0700, Adam Wolfe Gordon 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).