]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: make sure tagging on an empty query is harmless
authorMark Walters <markwalters1009@gmail.com>
Wed, 21 May 2014 09:58:50 +0000 (10:58 +0100)
committerDavid Bremner <david@tethera.net>
Tue, 27 May 2014 23:40:04 +0000 (20:40 -0300)
Currently notmuch-tag throws a "wrong-type-argument stringp nil" if
passed a nil query-string. Catch this and provide a more useful error
message. This fixes a case in notmuch-tree (if you try to tag when at
the end of the buffer).

Secondly, as pointed out by David (dme)
`notmuch-search-find-stable-query-region' can return the query string
() if there are no messages in the region. This gets passed to notmuch
tag, and due to interactions in the optimize_query code in
notmuch-tag.c becomes, in the case tag-change is -inbox, "( () ) and
(tag:inbox)". This query matches some strange collection of messages
which then get archived. This should probably be fixed, but in any
case make `notmuch-search-find-stable-query-region' return a nil
query-string in this case.

This avoids data-loss (random tag removal) in this case.


No differences found