]> git.cworth.org Git - notmuch/blobdiff - emacs/notmuch.el
emacs: remove text properties from `notmuch-search-get-tags' result
[notmuch] / emacs / notmuch.el
index cd04ffdafcc4d46d36fa43248016c4270e157a5c..5980feae4a4477893d57a5f294f0d8ba0a880cdf 100644 (file)
@@ -516,6 +516,12 @@ Note: Other code should always use this function alter tags of
 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
+  (when (null tags) (error "No tags given"))
+  (mapc (lambda (tag)
+         (unless (string-match-p "^[-+][-+_.[:word:]]+$" tag)
+           (error "Tag must be of the form `+this_tag' or `-that_tag'")))
+       tags)
   (run-hooks 'notmuch-before-tag-hook)
   (apply 'notmuch-call-notmuch-process
         (append (list "tag") tags (list "--" query)))
@@ -565,7 +571,7 @@ the messages that were tagged"
     (let ((beg (+ (point) 1)))
       (re-search-forward ")")
       (let ((end (- (point) 1)))
-       (split-string (buffer-substring beg end))))))
+       (split-string (buffer-substring-no-properties beg end))))))
 
 (defun notmuch-search-get-tags-region (beg end)
   (save-excursion
@@ -883,12 +889,6 @@ characters as well as `_.+-'.
   (interactive (notmuch-select-tags-with-completion
                "Operations (+add -drop): notmuch tag "
                '("+" "-")))
-  ;; Perform some validation
-  (when (null actions) (error "No operations given"))
-  (mapc (lambda (action)
-         (unless (string-match-p "^[-+][-+_.[:word:]]+$" action)
-           (error "Action must be of the form `+this_tag' or `-that_tag'")))
-       actions)
   (apply 'notmuch-tag notmuch-search-query-string actions))
 
 (defun notmuch-search-buffer-title (query)