[notmuch] [PATCH 3/3] notmuch.el: Select tag names with completion.

2009-11-27 Thread Carl Worth
On Fri, 27 Nov 2009 12:30:38 +0100, Jan Janak  wrote:
> Oh, that's great, my first bigger contribution to nutmuch is in the
> repository, thanks so much! 

You're quite welcome.

> I was just thinking about giving you some time to catch up and review all the
> patches, but now I have a reason to send more again ;-).

Yes, please don't slow down. Like Keith recently mentioned to me---one
drawback with notmuch is that it makes it so easy and fun to get
through mail that you quickly end up without any mail and don't get to
play with notmuch anymore.

> Thanks for starting notmuch! I've been working on converting my 4GB mailbox
> with about a hundred tags from gmail to notmuch and while I am not there yet,
> I've made some good progress recently. That makes me really optimistic; I
> tried various other mail indexing tools before and never got that far.

Good luck with that! I know that the period of transitioning from one
mail system to another can be extremely painful. I hope you get through
it alright and end up better for it.

Happy hacking,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[notmuch] [PATCH 3/3] notmuch.el: Select tag names with completion.

2009-11-27 Thread Jan Janak
Hi Carl,

On 26-11 07:15, Carl Worth wrote:
> On Mon, 23 Nov 2009 01:10:56 +0100, Jan Janak  wrote:
> > Several commands ask the user for a tag name. With this feature the
> > user can just press tab and Emacs automatically retrieves the list of
> > all existing tags from notmuch database with 'notmuch search-tags' and
> > presents a completion buffer to the user.
> > 
> > This feature is very useful for users who have a large number of tags
> > because it saves typing and minimizes the risk of typos.
> 
> Jan,
> 
> This feature is incredibly useful. Thanks so much for coding it!

You are welcome!

> I've had a bunch of messages that were effectively "lost" to me since
> switching from sup. I had been experimenting with different tag
> schemes, renaming tags, etc. within sup. But in sup there was no
> global-search-based tag manipulation command, so no easy way to update
> the tag names for messages tagged under the old scheme.
> 
> I'd been aware of the problem and knew I could just code something up to
> search for those old tags. But now I get to see the full list every time
> I hit TAB in emacs. So thanks!
> 
> I do still want to unify search, search-messages, search-tags, count,
> etc. But I've gone ahead and merged this whole series as-is to get the
> functionality out there for now.

Oh, that's great, my first bigger contribution to nutmuch is in the
repository, thanks so much! 

I was just thinking about giving you some time to catch up and review all the
patches, but now I have a reason to send more again ;-).

> I assume that everyone is aware that I'm reserving the right to change
> the library and command-line interface as much as I want right now.

Yeah, I personally have no problem with that. In fact I like it.

I think that not having the user interface fixed is a good thing at this early
stage. This is what makes notmuch so hackable :-), contributors like me don't
have to worry about breaking things (at least not too much).

>From my point of view, notmuch is still missing some important features. Also,
there is a bunch of people writing front-ends and they'll probably ask for
more, too. Personally, I think it would make sense to add what is missing and,
once you feel that notuch is reasonably feature-complete, you can design nice
and intuitive user interface for it.

I'd be happy to help you update the code that I contributed once you decide to
change the command-line interface.

> If you've got code or scripts that depend on these interfaces, I highly
> recommend that you get them contributed to the notmuch repository so
> that we can fix them up as we rework the library and command line.

Yeah, I will.

> (So, Bart, I'll merge the vim stuff which is using "notmuch count"
> before I change that, so I can fixup the vim stuff at the same time.)
> 
> Thanks again, Jan! Well done.

Thanks for starting notmuch! I've been working on converting my 4GB mailbox
with about a hundred tags from gmail to notmuch and while I am not there yet,
I've made some good progress recently. That makes me really optimistic; I
tried various other mail indexing tools before and never got that far.

-Jan


[notmuch] [PATCH 3/3] notmuch.el: Select tag names with completion.

2009-11-26 Thread Carl Worth
On Mon, 23 Nov 2009 01:10:56 +0100, Jan Janak  wrote:
> Several commands ask the user for a tag name. With this feature the
> user can just press tab and Emacs automatically retrieves the list of
> all existing tags from notmuch database with 'notmuch search-tags' and
> presents a completion buffer to the user.
> 
> This feature is very useful for users who have a large number of tags
> because it saves typing and minimizes the risk of typos.

Jan,

This feature is incredibly useful. Thanks so much for coding it!

I've had a bunch of messages that were effectively "lost" to me since
switching from sup. I had been experimenting with different tag
schemes, renaming tags, etc. within sup. But in sup there was no
global-search-based tag manipulation command, so no easy way to update
the tag names for messages tagged under the old scheme.

I'd been aware of the problem and knew I could just code something up to
search for those old tags. But now I get to see the full list every time
I hit TAB in emacs. So thanks!

I do still want to unify search, search-messages, search-tags, count,
etc. But I've gone ahead and merged this whole series as-is to get the
functionality out there for now.

I assume that everyone is aware that I'm reserving the right to change
the library and command-line interface as much as I want right now.

If you've got code or scripts that depend on these interfaces, I highly
recommend that you get them contributed to the notmuch repository so
that we can fix them up as we rework the library and command line.

(So, Bart, I'll merge the vim stuff which is using "notmuch count"
before I change that, so I can fixup the vim stuff at the same time.)

Thanks again, Jan! Well done.

-Carl


[notmuch] [PATCH 3/3] notmuch.el: Select tag names with completion.

2009-11-23 Thread Jan Janak
Several commands ask the user for a tag name. With this feature the
user can just press tab and Emacs automatically retrieves the list of
all existing tags from notmuch database with 'notmuch search-tags' and
presents a completion buffer to the user.

This feature is very useful for users who have a large number of tags
because it saves typing and minimizes the risk of typos.

Signed-off-by: Jan Janak 
---
 notmuch.el |   22 +-
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 5927737..b6be395 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -139,6 +139,13 @@ within the current window."
   (or (memq prop buffer-invisibility-spec)
  (assq prop buffer-invisibility-spec)

+(defun notmuch-select-tag-with-completion (prompt)
+  (let ((tag-list
+(with-output-to-string
+  (with-current-buffer standard-output
+(call-process notmuch-command nil t nil "search-tags")
+(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
+
 (defun notmuch-show-next-line ()
   "Like builtin `next-line' but ensuring we end on a visible character.

@@ -202,7 +209,8 @@ Unlike builtin `next-line' this version accepts no 
arguments."

 (defun notmuch-show-add-tag ( toadd)
   "Add a tag to the current message."
-  (interactive "sTag to add: ")
+  (interactive
+   (list (notmuch-select-tag-with-completion "Tag to add: ")))
   (apply 'notmuch-call-notmuch-process
 (append (cons "tag"
   (mapcar (lambda (s) (concat "+" s)) toadd))
@@ -211,7 +219,8 @@ Unlike builtin `next-line' this version accepts no 
arguments."

 (defun notmuch-show-remove-tag ( toremove)
   "Remove a tag from the current message."
-  (interactive "sTag to remove: ")
+  (interactive
+   (list (notmuch-select-tag-with-completion "Tag to remove: ")))
   (let ((tags (notmuch-show-get-tags)))
 (if (intersection tags toremove :test 'string=)
(progn
@@ -970,12 +979,14 @@ and will also appear in a buffer named \"*Notmuch 
errors*\"."
(split-string (buffer-substring beg end))

 (defun notmuch-search-add-tag (tag)
-  (interactive "sTag to add: ")
+  (interactive
+   (list (notmuch-select-tag-with-completion "Tag to add: ")))
   (notmuch-call-notmuch-process "tag" (concat "+" tag) 
(notmuch-search-find-thread-id))
   (notmuch-search-set-tags (delete-dups (sort (cons tag 
(notmuch-search-get-tags)) 'string<

 (defun notmuch-search-remove-tag (tag)
-  (interactive "sTag to remove: ")
+  (interactive
+   (list (notmuch-select-tag-with-completion "Tag to remove: ")))
   (notmuch-call-notmuch-process "tag" (concat "-" tag) 
(notmuch-search-find-thread-id))
   (notmuch-search-set-tags (delete tag (notmuch-search-get-tags

@@ -1061,7 +1072,8 @@ current search results AND the additional query string 
provided."

 Runs a new search matching only messages that match both the
 current search results AND that are tagged with the given tag."
-  (interactive "sFilter by tag: ")
+  (interactive
+   (list (notmuch-select-tag-with-completion "Filter by tag: ")))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag) 
notmuch-search-oldest-first))

 (defun notmuch ()
-- 
1.6.3.3