X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-tag.el;h=4fce3a9873a70100d3ef833eb717241529de66d0;hp=0c0fc87583ad3439c04984b8879310d72062c1ed;hb=d273ed6cf1bdaa2d644cec4909cbf415ff4d257b;hpb=97aa3c06593847c0f7b353cf5167d70cc9e53dd3 diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 0c0fc875..4fce3a98 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -140,6 +140,21 @@ notmuch-after-tag-hook will be run." ;; in all cases we return tag-changes as a list tag-changes) +(defun notmuch-tag-change-list (tags &optional reverse) + "Convert TAGS into a list of tag changes. + +Add a \"+\" prefix to any tag in TAGS list that doesn't already +begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all +\"+\" prefixes with \"-\" and vice versa in the result." + (mapcar (lambda (str) + (let ((s (if (string-match "^[+-]" str) str (concat "+" str)))) + (if reverse + (concat (if (= (string-to-char s) ?-) "+" "-") + (substring s 1)) + s))) + tags)) + + ;; (provide 'notmuch-tag)