Re: [notmuch] [PATCH v2] notmuch.el: add functionality in notmuch search mode to add or remove tags by region

Subject: Re: [notmuch] [PATCH v2] notmuch.el: add functionality in notmuch search mode to add or remove tags by region

Date: Fri, 09 Apr 2010 10:11:00 -0400

To: Carl Worth, notmuch@notmuchmail.org

Cc:

From: Jesse Rosenthal


On Wed, 07 Apr 2010 14:10:38 -0700, Carl Worth <cworth@cworth.org> wrote:
> On Tue, 16 Feb 2010 19:07:40 -0500, Jesse Rosenthal <jrosenthal@jhu.edu> wrote:
> I think this feature is very useful, and that the region is definitely
> an appropriate way to implement it, (doing region-based operations is
> very natural for emacs users). Mutt-style marking could be implemented
> as well, but that would be separate I think.

Great -- never sure if my intuitive use corresponds with that of others.

> I also don't like the duplication of code in
> notmuch-search-add-tag-thread and notmuch-search-add-tag-region, (and
> the same in the remove case). Fortunately, I think this easy to avoid by
> simply making notmuch-search-add-tag-thread call:
> 
>        (notmuch-search-add-tag-region tag (point) (point))
> 
> and the same in the remove case.

Good idea.

> 
> But I haven't pushed this patch yet for a flaw in the case of selecting
> beyond the last thread, (such as selecting to the line that includes the
> "End of search results). If I try an operation on that line, it will act
> like it works, (it displays the new tags by all threads), but then a
> refresh makes them all disappear again. Presumably the "notmuch tag"
> command is failing, this isn't being noticed, and the code marches on to
> update the representation of the tags.

Good point, and shouldn't be too hard to fix. It seems like it could be
done either (a) at the lisp level (filtering out the blank entries), or
(b) at the literal buffer level (having a step that sets point-max for
the region appropriately). The choice (a) seems clearer in an abstract
way, but has the downside of needing to be repeated twice (both for
database tagging, and for rewriting the tags on the screen). I'll play
with both and see which is clearer.

Best,
Jesse

Thread: