Subject: [sup-talk] [PATCH] Added --search option to sup

From: [email-masked] (Marcus Williams)
Date: Tue, 16 Oct 2007 12:03:52 +0100

Hi -

Attached is a simple patch to sup to add a command line option to jump
straight into a search from the command line. This doesnt do the feature
request of mine from yesterday as I'm implementing that in a sup-cli
script separately. I thought it was useful enough though - apols for any
ruby nooby code ;)

So you can do something like:

sup --search "from:sup-talk* subject:PATCH"

Marcus
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sup.diff
Url: http://rubyforge.org/pipermail/sup-talk/attachments/20071016/d583276d/attachment.pl

---

From: [email-masked] (William Morgan)
Date: Fri, 02 Nov 2007 12:07:37 -0700

Excerpts from Marcus Williams's message of Tue Oct 16 04:03:52 -0700 2007:
> straight into a search from the command line.

Interesting idea! What's your usage case: that you do the search, maybe
read some resulting messages, and then quit Sup? Or do you continue to
use Sup as normal? I.e. should we bother to even load the inbox?

-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Marcus Williams)
Date: Sat, 03 Nov 2007 20:20:48 +0000

[resubscribing under a different address, not sure if this will thread
properly]

> use Sup as normal? I.e. should we bother to even load the inbox?

I use my email for all sorts, but one thing I do often is use it as a
todo list. So I have a set of current todos (labeled todo). Its good
to be able to bring up sup, with the todos only. Sometimes I'll stay
in sup, sometimes not. 

Anyone who is into gtd could use this for contexts, my "todo" label
is like a context. I can enter sup and deal with this and not get 
distracted by other stuff.

It also means I can alias "todo" in my shell to "sup --search
'label:todo'" or something.

In some cases I dont need the inbox at all like you say. I tried to 
add a --no-inbox flag to sup, but I couldnt get it to work. I think
the buffer sizes screwed up somehow when I stopped the inbox mode from
spawning. I must have missed something.

I spotted that the inbox is actually a search result whilst trawling
the code so my idea is now that instead of a --no-inbox what you
actually do is have another search argument --inbox that takes a
search term This would set the search term for the inbox mode. That
way you could go into sup and have your inbox mode permanently in
whatever search term you entered.

This would mean you could go in via --search and keep your inbox as
normal. Or via --inbox and have a specialised inbox. 

Marcus

---

From: [email-masked] (William Morgan)
Date: Sat, 03 Nov 2007 14:17:27 -0700

> to be able to bring up sup, with the todos only. Sometimes I'll stay

Very nice. One of the items on the TODO for quite a while has been to
add "notes" as a first-class object, which will be treated more or less
as draft emails are now, except they'll have no from/to/cc/etc, only a
body, and obviously can't be sent, just created, edited, and deleted.

These can be used as general notes, as todo items, and can be "attached"
to emails or other notes via the threading system. And of course the
full-text search and labeling can be used as normal.

Then all I have to do is add a web browser mode and a partial
implementation of lisp and sup will be feature complete!

> whatever search term you entered.

The problem is that inbox-mode per se has some special functionality
that doesn't quite make sense unless it's applied to the search with
"label:inbox". We could force that to be prepended to any search phrase
passed in from the command line, I suppose.

For the time being, I'll apply the patch as is.

---

From: [email-masked] (Marcus Williams)
Date: Sat, 03 Nov 2007 21:35:55 +0000

> body, and obviously can't be sent, just created, edited, and deleted.

Yeah, I noticed that on the todo list. That would be very nice -
something that has always bothered me about email is that I cant just
add notes to them (in most clients). And not having to actually send
myself a message to "add" a note would be less work! 

> implementation of lisp and sup will be feature complete!

I've been trying to figure out if a web browser mode would be possible
in the current mode system. I couldnt figure out if the mode stuff was
reliant on ncurses or just happened to be modes that used ncurses.

> passed in from the command line, I suppose.

To be honest I probably wouldnt use the --inbox flag that often, it
just struck me as nicer way to implement no having an inbox. I use the
search flag quite a lot though so good to see it got in :)

Marcus

---

From: [email-masked] (William Morgan)
Date: Sat, 03 Nov 2007 15:12:07 -0700

> reliant on ncurses or just happened to be modes that used ncurses.

That was actually a sick joke about writing my own ncurses-based browser
from within Sup. But to answer what I think was a serious question about
a web version of sup itself, a couple people have expressed a desire to
write this, which I think is a little ironic, but which I'm certainly
not opposed to.

The mode system (in contrast with the buffer system) is not *explicitly*
tied to ncurses but probably has all sorts of implicit ties. I.e. it
might be possible to come up with some explicit mapping of modes to web
pages and commands to web form buttons, but my personal suspicion is
that the paradigms are so radically different that that level of
integration will be impossible.

But certainly searching the index and pulling up threads, messages, etc
all is done through nice programmatic interfaces, and I've started
documenting this on the wiki, mostly from that email I sent you about
sup-cli.

> search flag quite a lot though so good to see it got in :)

Just added --search to SVN. Thanks!