* [sup-talk] a few sup newbie questions @ 2008-12-17 21:37 Marianne Promberger 2008-12-17 22:46 ` William Morgan 0 siblings, 1 reply; 6+ messages in thread From: Marianne Promberger @ 2008-12-17 21:37 UTC (permalink / raw) Hi, Thanks for writing such a powerful app! I'm new to sup and am wondering whether any of the following are possible: (1) Automatically apply labels to incoming mail defined on search patterns? I know I can apply labels based on source, but I'd really like some labels based on subject, etc. I figured out I can do a search, then "!!", then tag all and ";" and label. But needless to say, that's cumbersome. Pattern-based labeling when mail arrives would be great. Is it possible? (2) Save search history across sup sessions, so that I can use up-arrow to access terms I searched for last time I read mail in sup? (3) Are there search patterns like the "~P" and "~p" in mutt, that is, matching everything from or to "me", as defined by the alternates in ~/.sup/config.yaml? (4) Is there any way to send several drafts at once? (I'm assuming there is no way to postpone a message other than saving it as a draft?). Tagging them and then "enter" or "y" did not work. Thanks, m. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] a few sup newbie questions 2008-12-17 21:37 [sup-talk] a few sup newbie questions Marianne Promberger @ 2008-12-17 22:46 ` William Morgan 2008-12-29 17:27 ` Marianne 0 siblings, 1 reply; 6+ messages in thread From: William Morgan @ 2008-12-17 22:46 UTC (permalink / raw) Reformatted excerpts from marianne.promberger+sup-talk's message of 2008-12-17: > Thanks for writing such a powerful app! I'm new to sup and am > wondering whether any of the following are possible: Hi and welcome! > (1) Automatically apply labels to incoming mail defined on search > patterns? Stuff like that is handled by Sup's hook system. The plus side is that it's very flexible; the downside is that you have to write Ruby code. In this case, check out the before-add-message hook. ("sup -l" will list all the hooks and some brief documentation.) In my case, I use something like: to_string = message.recipients.map { |t| t.email }.join(" ") case to_string when /\bgit at vger.kernel.org\b/ message.add_label :git message.remove_label :inbox when /\bsup-talk at rubyforge.org\b/ message.add_label :sup # etc... > (2) Save search history across sup sessions, so that I can use > up-arrow to access terms I searched for last time I read mail in sup? Not implemented, but a good idea, and probably pretty easy! > (3) Are there search patterns like the "~P" and "~p" in mutt, that is, > matching everything from or to "me", as defined by the alternates in > ~/.sup/config.yaml? You can search for things like "from:me" or "to:me". That should work with :alternates, but unfortunately doesn't work if you use :regexen. > (4) Is there any way to send several drafts at once? (I'm assuming > there is no way to postpone a message other than saving it as a > draft?). Tagging them and then "enter" or "y" did not work. Not implemented, but a good idea, and definitely easy to do. -- William <wmorgan-sup at masanjin.net> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] a few sup newbie questions 2008-12-17 22:46 ` William Morgan @ 2008-12-29 17:27 ` Marianne 2008-12-29 18:10 ` Marc Hartstein 0 siblings, 1 reply; 6+ messages in thread From: Marianne @ 2008-12-29 17:27 UTC (permalink / raw) Hi, Thanks for the quick reply; sorry for my slow one. Excerpts from William Morgan's message of Wed Dec 17 23:46:15 +0100 2008: > Reformatted excerpts from marianne.promberger+sup-talk's message of 2008-12-17: > > (1) Automatically apply labels to incoming mail defined on search > > patterns? > > Stuff like that is handled by Sup's hook system. Thanks! I found more examples on the wiki. Is there any more documentation on the hook system? I've found /var/lib/gems/1.8/doc/sup-0.6/rdoc/index.html but I have trouble getting anything out of it. Sorry if this is obvious to others, but I am not a programmer and haven't used Ruby before. I cobbled two together, but I'm less than sure that they're correct; they seem to work for me. If someone could give me the go-ahead, I'd post them to the wiki, since I think it would be nice to have some more recipes for others to copy. This one assigns labels according to X-Label header. I'd like to do this since I already add some labels with procmail before mail goes to the maildir that is a source for sup. (Not sure the regex matching the label is exhaustive enough for everyone; it is for me). if message.raw_header =~ /X-Label: / xlabelheader = message.raw_header[/X-Label:.*/] xlabelheader.scan(/ [a-z0-9\-_+]+/) { |x| message.add_label x.lstrip } end The second one assigns labels based on an external file containing a list of e-mail addresses. The external file is one I maintain from mutt; I have a macro set up to quickly add the sender of a message to my "private" group. privatfile = File.open("/home/mpromber/.mutt/privataddr","r") if ! privatfile.grep(/#{message.from.email}/).empty? message.add_label :privat end Another question: If I add a new rule like this to the before-add-message hook, what is the recommended way to get sup to rescan messages to apply this rule to all existing mail? I am currently using "sup-sync -a --discard -e -x -v", but this takes forever (and I can't use regular "sup" in the meantime). (I'm using the -e because "sup-sync" on its own marks all mail as unread, even just running "sup-sync -c".) Is it correct that there is no faster way? > > (2) Save search history across sup sessions, so that I can use > > up-arrow to access terms I searched for last time I read mail in sup? > > Not implemented, but a good idea, and probably pretty easy! I've been thinking about this some more, and maybe even better would be not to save all searches, but to have the possibility to explicitly save some searches. This would turn the saved searches into a list of quickly accessible virtual mail folders. Maybe a shortcut to do this could be added to the buffer-list-mode? To start, it could even just be an external text file that has to be edited manually. Sorry I can't write patches in ruby :) > You can search for things like "from:me" or "to:me". That should work > with :alternates, but unfortunately doesn't work if you use :regexen. Thanks. Another question: Is there a search term like "from:" and "to:" but that stands for "anywhere in "from" or "to" or "cc" (like "a:" in mairix)? In general, is there more documentation about the search capacities, especially on building search terms, and where could I find it? One more question: Is there some way to have more fine-grained control over what the "From" e-mail address is when replying? As far as I understand it, I can have ":accounts:" sections in config.yaml, with different "alternates". Sup will reply from the e-mail address that someone uses as "to:" when e-mailing me. But for example, I'd like to use my "myname+sup-talk at gmail.com" address when replying to this list, but obviously, mail to this list has "sup-talk..." as the "to:" address. And the point of the "accounts" in config.yaml is just picking the right signature, right? I haven't discovered any other effect so far. Thanks, Marianne ^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] a few sup newbie questions 2008-12-29 17:27 ` Marianne @ 2008-12-29 18:10 ` Marc Hartstein 2008-12-30 9:53 ` Marianne 0 siblings, 1 reply; 6+ messages in thread From: Marc Hartstein @ 2008-12-29 18:10 UTC (permalink / raw) Excerpts from marianne.promberger+sup-talk's message of Mon Dec 29 12:27:19 -0500 2008: > > One more question: Is there some way to have more fine-grained control > over what the "From" e-mail address is when replying? As far as I Check out the reply-from hook; it's passed the message you're replying to so you can do any processing you want on it and return a default from address. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20081229/66eb91a1/attachment.bin> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] a few sup newbie questions 2008-12-29 18:10 ` Marc Hartstein @ 2008-12-30 9:53 ` Marianne 2009-01-02 12:53 ` William Morgan 0 siblings, 1 reply; 6+ messages in thread From: Marianne @ 2008-12-30 9:53 UTC (permalink / raw) Excerpts from Marc Hartstein's message of Mon Dec 29 19:10:48 +0100 2008: > Excerpts from marianne.promberger+sup-talk's message of Mon Dec 29 12:27:19 -0500 2008: > > > > One more question: Is there some way to have more fine-grained control > > over what the "From" e-mail address is when replying? As far as I > > Check out the reply-from hook; it's passed the message you're replying > to so you can do any processing you want on it and return a default > from address. Thanks. Any chance you could give me a pointer on how I can get it to "return a person"? I've tried stuff like ... (in ~/.sup/hook/reply-from.rb) if message.to =~ /rubyforge/ hook_reply_from = "My Name <email at domain.com>" end if message.recipient_email =~ /rubyforge/ return "My name <email at domain.com>" end ... with different variations of patterns I'm testing for and with different returned strings. Any pointers appreciated! (Including general information where I could RTFM .. I looked at "sup -l" but that's pretty brief. Marianne ^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] a few sup newbie questions 2008-12-30 9:53 ` Marianne @ 2009-01-02 12:53 ` William Morgan 0 siblings, 0 replies; 6+ messages in thread From: William Morgan @ 2009-01-02 12:53 UTC (permalink / raw) Reformatted excerpts from marianne.promberger+sup-talk's message of 2008-12-30: > Thanks. Any chance you could give me a pointer on how I can get it to > "return a person"? > > I've tried stuff like ... (in ~/.sup/hook/reply-from.rb) > > if message.to =~ /rubyforge/ > hook_reply_from = "My Name <email at domain.com>" > end > > if message.recipient_email =~ /rubyforge/ > return "My name <email at domain.com>" > end > > ... with different variations of patterns I'm testing for and with > different returned strings. You can create a person from a string by using this method: PersonManager.person_for "My name <email at domain.com>" You can give it any valid email address, and it takes care of returning the same Person object for duplicate addresses. Brief Ruby aside: If you're going to be doing a lot of such comparisons, you can structure the hook like: PersonManager.person_for case when message.to =~ /rubyforge/ "My name <email at email1.org>" when message.recipient_email =~ /rubyforge/ "My name <email at email2.org>" else "My name <default at default.org>" end Note that the return statement isn't required (the final value of the hook is used), and multiple if-then's can be collapsed into a case statement. > Any pointers appreciated! (Including general information where I could > RTFM .. I looked at "sup -l" but that's pretty brief. Sadly, there's no good documentation for this right now beyond asking on the mailing list. (Well besides learning Ruby and looking at the code.) I'm sorry about that. -- William <wmorgan-sup at masanjin.net> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-01-02 12:53 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-12-17 21:37 [sup-talk] a few sup newbie questions Marianne Promberger 2008-12-17 22:46 ` William Morgan 2008-12-29 17:27 ` Marianne 2008-12-29 18:10 ` Marc Hartstein 2008-12-30 9:53 ` Marianne 2009-01-02 12:53 ` William Morgan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox