X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-tag.el;h=0c9a32ac4856a9d78167751da4ebf48e9b7c74db;hp=a553dfd9aeedd4292ac4b9b12f0509f61b4958ad;hb=16b2db0986ce0ed7c420a69d0a98bb41e9ca4bd8;hpb=1bbbde4a0c3153f6caa30724bd173397be43144f diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index a553dfd9..0c9a32ac 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -454,8 +454,9 @@ present or a \"-\" to indicate that the tag should be removed from TAGS if present." (let ((result-tags (copy-sequence tags))) (dolist (tag-change tag-changes) - (let ((op (string-to-char tag-change)) - (tag (unless (string= tag-change "") (substring tag-change 1)))) + (let ((op (aref tag-change 0)) + (tag (and (not (string= tag-change "")) + (substring tag-change 1)))) (cl-case op (?+ (unless (member tag result-tags) (push tag result-tags))) @@ -482,13 +483,12 @@ messages instead of running (notmuch-call-notmuch-process \"tag\" ..) directly, so that hooks specified in notmuch-before-tag-hook and notmuch-after-tag-hook will be run." ;; Perform some validation - (mapc (lambda (tag-change) - (unless (string-match-p "^[-+]\\S-+$" tag-change) - (error "Tag must be of the form `+this_tag' or `-that_tag'"))) - tag-changes) + (dolist (tag-change tag-changes) + (unless (string-match-p "^[-+]\\S-+$" tag-change) + (error "Tag must be of the form `+this_tag' or `-that_tag'"))) (unless query (error "Nothing to tag!")) - (unless (null tag-changes) + (when tag-changes (run-hooks 'notmuch-before-tag-hook) (if (<= (length query) notmuch-tag-argument-limit) (apply 'notmuch-call-notmuch-process "tag"