[sup-talk] Programmatically removing tags (:inbox)

18 views
Skip to first unread message

Alexander Klink

unread,
Apr 23, 2014, 11:42:40 AM4/23/14
to sup-talk
Hi all,

I am trying to archive all my existing mails in order to make a nicer
workflow for myself (sort of a GTD thing with reading mails, either
acting directly or tagging them with 'todo' or 'hold' depending on whether I
have to do something or am waiting for someone to reply).

For this, I want to remove the :inbox tag from all mails in my index.
As a start I looked at https://github.com/sup-heliotrope/sup/issues/225
and tried to reproduce what gauteh did in the console (with one single mail
which I gave a testfoo tag in sup):

| q = Index.parse_query('label:testfoo')
| a = []
| Index.each_message(q) { |x| a.push x }
| puts a # this should only contain one message if you only have one marked as draft
| m = a[0] # get the first message or find the problematic one
| m.labels.delete :testfoo
| m.sync_back
| exit

Unluckily, both in sup and programmatically the mail still has the
testfoo tag. I also tried adding an Index.save_index before the exit,
but that didn't help either.

Any ideas on how to achieve that goal (I am on 0.17.0 if that helps)?

Cheers,
Alex
_______________________________________________
sup-talk mailing list
sup-...@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

MaDhAt2r

unread,
Apr 23, 2014, 12:24:11 PM4/23/14
to sup-talk
Hey Alex,

Try this: https://github.com/sup-heliotrope/sup/issues/272

Just use :inbox instead of :draft



Excerpts from Alexander Klink's message of 2014-04-23 10:42:40 -0500:

Matthieu Rakotojaona

unread,
Apr 23, 2014, 2:11:28 PM4/23/14
to sup-talk
Excerpts from Alexander Klink's message of 2014-04-23 17:42:40 +0200:
> Hi all,
>
> I am trying to archive all my existing mails in order to make a nicer
> workflow for myself (sort of a GTD thing with reading mails, either
> acting directly or tagging them with 'todo' or 'hold' depending on whether I
> have to do something or am waiting for someone to reply).

bin/sup-tweak-labels was made for this :)

--
Matthieu Rakotojaona
signature.asc

Alexander Klink

unread,
Apr 24, 2014, 4:55:05 AM4/24/14
to sup-talk
Hi MadHat2r,

Excerpts from MaDhAt2r's message of 2014-04-23 18:24:11 +0200:
> Try this: https://github.com/sup-heliotrope/sup/issues/272
>
> Just use :inbox instead of :draft

Unfortunately, that is very similar to the description below (basically
just a different way to find the message) and doesn't work for me either
:(

Alexander Klink

unread,
Apr 24, 2014, 9:17:56 AM4/24/14
to sup-talk
Hi Matthieu,

Excerpts from Matthieu Rakotojaona's message of 2014-04-23 20:11:28 +0200:
> Excerpts from Alexander Klink's message of 2014-04-23 17:42:40 +0200:
> > I am trying to archive all my existing mails in order to make a nicer
> > workflow for myself (sort of a GTD thing with reading mails, either
> > acting directly or tagging them with 'todo' or 'hold' depending on whether I
> > have to do something or am waiting for someone to reply).
>
> bin/sup-tweak-labels was made for this :)

Unfortunately, that fails completely for me:

$ sup-tweak-labels -r inbox -v --all-sources
[2014-04-24 15:15:50 +0200] WARNING: can't find character set by using locale, defaulting to utf-8
Found 149439 documents across 453 sources. Scanning...
1-773309-5rG...@example.com: {inbox,unread,spam} => {unread,spam}
[2014-04-24 15:15:50 +0200] Flushing Xapian updates to disk. This may take a while...
/home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/lib/sup/index.rb:141:in `update_message_state': undefined method `[]' for #<Redwood::Message:0x000000029ebf68> (NoMethodError)
from /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/bin/sup-tweak-labels:109:in `block in <top (required)>'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/lib/sup/index.rb:288:in `block in each_id'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/lib/sup/index.rb:288:in `each'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/lib/sup/index.rb:288:in `each_id'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/bin/sup-tweak-labels:95:in `each'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/bin/sup-tweak-labels:95:in `<top (required)>'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/bin/sup-tweak-labels:19:in `load'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/bin/sup-tweak-labels:19:in `<main>'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
from /home/alech/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

Any ideas?

Devon Gleeson

unread,
Apr 24, 2014, 2:00:16 PM4/24/14
to Alexander Klink, sup-talk
I had this problem too when I first started using Sup. I think what I
ended up having to do was force sup to load all messages into memory
with !!, then tag all with T, then removed inbox. I took a long time for
sup to churn through all of that, but it did work eventually.

IDK, this does seem like a barrier to entry for new folks trying to
adopt sup.

--
Devon Gleeson
Software Engineer
TRIPWIRE | CONFIDENCE:SECURED
www.tripwire.com

Gaute Hope

unread,
Apr 25, 2014, 6:53:38 AM4/25/14
to sup-talk
Excerpts from Alexander Klink's message of 2014-04-24 15:17:56 +0200:
> Hi Matthieu,
>
> Excerpts from Matthieu Rakotojaona's message of 2014-04-23 20:11:28 +0200:
> > Excerpts from Alexander Klink's message of 2014-04-23 17:42:40 +0200:
> > > I am trying to archive all my existing mails in order to make a nicer
> > > workflow for myself (sort of a GTD thing with reading mails, either
> > > acting directly or tagging them with 'todo' or 'hold' depending on whether I
> > > have to do something or am waiting for someone to reply).
> >
> > bin/sup-tweak-labels was made for this :)
>
> Unfortunately, that fails completely for me:
>
> $ sup-tweak-labels -r inbox -v --all-sources
> [2014-04-24 15:15:50 +0200] WARNING: can't find character set by using locale, defaulting to utf-8
> Found 149439 documents across 453 sources. Scanning...
> 1-773309-5rG...@example.com: {inbox,unread,spam} => {unread,spam}
> [2014-04-24 15:15:50 +0200] Flushing Xapian updates to disk. This may take a while...
> /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/lib/sup/index.rb:141:in `update_message_state': undefined method `[]' for #<Redwood::Message:0x000000029ebf68> (NoMethodError)

Could you check if #295 [0] solves this for you? --tweak-labels wasn't
updated for the latest Index api changes. You have to specify the
--sync-back option if you want message flags to be synced back to
maildir, this _ignores_ any source specific sync_back settings so use
sup-tweak-labels on only one source at the time if you need more fine
grained control.

Note that even though you do the changes in the console as suggested in
the earlier mails the index list in the open sup won't be updated before
you restart sup.

- gaute

[0] https://github.com/sup-heliotrope/sup/pull/295

Gaute Hope

unread,
May 2, 2014, 5:08:19 AM5/2/14
to sup-talk
Excerpts from Gaute Hope's message of 2014-04-25 12:53:38 +0200:
> Excerpts from Alexander Klink's message of 2014-04-24 15:17:56 +0200:
> > Hi Matthieu,
> >
> > Excerpts from Matthieu Rakotojaona's message of 2014-04-23 20:11:28 +0200:
> > > Excerpts from Alexander Klink's message of 2014-04-23 17:42:40 +0200:
> > > > I am trying to archive all my existing mails in order to make a nicer
> > > > workflow for myself (sort of a GTD thing with reading mails, either
> > > > acting directly or tagging them with 'todo' or 'hold' depending on whether I
> > > > have to do something or am waiting for someone to reply).
> > >
> > > bin/sup-tweak-labels was made for this :)
> >
> > Unfortunately, that fails completely for me:
> >
> > $ sup-tweak-labels -r inbox -v --all-sources
> > [2014-04-24 15:15:50 +0200] WARNING: can't find character set by using locale, defaulting to utf-8
> > Found 149439 documents across 453 sources. Scanning...
> > 1-773309-5rG...@example.com: {inbox,unread,spam} => {unread,spam}
> > [2014-04-24 15:15:50 +0200] Flushing Xapian updates to disk. This may take a while...
> > /home/alech/.rvm/gems/ruby-1.9.3-p194/gems/sup-0.17.0/lib/sup/index.rb:141:in `update_message_state': undefined method `[]' for #<Redwood::Message:0x000000029ebf68> (NoMethodError)

This was fixed with the merge of #300. You should be able to use
sup-tweak-labels from git/develop now.

- gaute
signature.asc
Reply all
Reply to author
Forward
0 new messages