diff options
author | Dmitry Kurochkin <dmitry.kurochkin@gmail.com> | 2012-02-05 11:13:42 +0400 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-02-08 11:08:09 -0400 |
commit | 0adf05f57848d1fa190d2a6d33eeba2c0d992b51 (patch) | |
tree | 2edcb141629b255b6819c483d55e01f0989fac54 /emacs | |
parent | cc3756aabed5d6e50a481a5d38a5859754206be2 (diff) |
emacs: move tag format validation to `notmuch-tag' function
Before the change, tag format validation was done in
`notmuch-search-operate-all' function only. The patch moves it down
to `notmuch-tag', so that all users of that function get input
validation.
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/notmuch.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el index cd04ffda..19206db5 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -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))) @@ -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) |