Alex Bennée <
alex....@linaro.org> writes:
> Hi,
>
> In my continuing quest for improving my patch application work-flow I've
> been wondering if it is possible to access marks in a programatic way.
> To recap I have a custom marker to select patches:
<snip>
>
> (defun my-mu4e-apply-marked-mbox-patches ()
OK this is a slightly hacked up version but uses the internal symbol mu4e~headers-goto-docid:
(defun my-mu4e-apply-marked-mbox-patches ()
"Apply patches in order."
(interactive)
(let ((applied-or-skipped
(--take-while
(let ((docid (plist-get it :docid)))
(if (mu4e-mark-docid-marked-p docid)
(if (= 0 (mu4e-action-git-apply-mbox it))
(when (mu4e~headers-goto-docid docid)
(mu4e-mark-set 'unmark) t)
; failed to apply, stop
nil)
; not marked, skip
t))
(--sort
(string<
(mu4e-message-field-raw it :subject)
(mu4e-message-field-raw other :subject))
(-difference my-mu4e-patches
my-mu4e-applied-patches)))))
(setq my-mu4e-applied-patches
(-union my-mu4e-applied-patches applied-or-skipped))
(message (format "Applied %d (%d)/%d patches"
(length applied-or-skipped)
(length my-mu4e-applied-patches)
(length my-mu4e-patches)))))
--
Alex Bennée