Re: Macro to move mail to trash in Gmail.

2012-01-14 Thread Christian Dysthe
On 01/14/12 at 01:04pm, Ed Blackman wrote:
> On Sat, Jan 14, 2012 at 07:50:12AM -0600, Christian Dysthe wrote:
> >On 01/13/12 at 09:30pm, Ed Blackman wrote:
> >>OK.  You just need to move the "save" until after resolve is
> >>restored.  That way the save will delete and move to the next
> >>message.
> >>
> >>macro index,pager D "set my_resolve=\$resolve 
> >>resolve=no\
> >>N\
> >>set resolve=\$my_resolve &my_resolve\
> >>+Gmail/trash" "move message to the trash"
> >
> >I've been using the macro some more. On thing I noticed is that when I
> >delete from the pager the mail is moved to trash immediately, but when
> >I do it from the index I have to refresh the folder before it's moved.
> >Why the difference?
> 
> I wouldn't expect a difference.  I would expect that in both cases,
> the message would be in the trash immediately after the macro
> completes.  In both cases, I would also expect that the message
> would still be in the original folder, marked for deletion, until
> you refresh the folder.
> 
> I don't actually use mutt to access Gmail, or IMAP at all.  I just
> have a bit of experience with writing macros, and combined the
> "save; set; operate; restore" pattern for macros, Luis Mochan's
> mention of the resolve setting, and your original attempt creating a
> macro.  So if the above isn't what you're seeing, hopefully someone
> else can help.

The macro works great. I was mostly curious as to why there seem to be 
a difference. I'm impressed you were able to write this macro without 
being able to test it on a live IMAP account!
> 
> -- 
> Ed Blackman



-- 
//Christian Dysthe


Re: Macro to move mail to trash in Gmail.

2012-01-14 Thread Ed Blackman

On Sat, Jan 14, 2012 at 07:50:12AM -0600, Christian Dysthe wrote:

On 01/13/12 at 09:30pm, Ed Blackman wrote:

OK.  You just need to move the "save" until after resolve is
restored.  That way the save will delete and move to the next
message.

macro index,pager D "set my_resolve=\$resolve resolve=no\
N\
set resolve=\$my_resolve &my_resolve\
+Gmail/trash" "move message to the trash"


I've been using the macro some more. On thing I noticed is that when I
delete from the pager the mail is moved to trash immediately, but when
I do it from the index I have to refresh the folder before it's moved.
Why the difference?


I wouldn't expect a difference.  I would expect that in both cases, the 
message would be in the trash immediately after the macro completes.  In 
both cases, I would also expect that the message would still be in the 
original folder, marked for deletion, until you refresh the folder.


I don't actually use mutt to access Gmail, or IMAP at all.  I just have 
a bit of experience with writing macros, and combined the "save; set; 
operate; restore" pattern for macros, Luis Mochan's mention of the 
resolve setting, and your original attempt creating a macro.  So if the 
above isn't what you're seeing, hopefully someone else can help.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Macro to move mail to trash in Gmail.

2012-01-14 Thread Christian Dysthe
On 01/13/12 at 09:30pm, Ed Blackman wrote:
> On Fri, Jan 13, 2012 at 06:39:00PM -0600, Christian Dysthe wrote:
> >On 01/13/12 at 11:36am, Ed Blackman wrote:
> >>macro index,pager D "set my_resolve=\$resolve 
> >>resolve=no\
> >>N+Gmail/trash\
> >>set resolve=\$my_resolve &my_resolve" "move message 
> >>to the trash"
> >
> >Thank you so much! This macro works exactly like I would like it to
> >except for one minor issue: It does not move to the next message after
> >the e-mail is delete (moved to Gmail trash). The problem before was
> >that it moved to the next mail and moved that to trash. Now it works
> >perfectly with regards to deleting and moving the mail. If it's no way
> >or have it move to the next mail after deletion  to do that I'm fine
> >with the way it works now.
> 
> OK.  You just need to move the "save" until after resolve is
> restored.  That way the save will delete and move to the next
> message.
> 
> macro index,pager D "set my_resolve=\$resolve 
> resolve=no\
> N\
> set resolve=\$my_resolve &my_resolve\
> +Gmail/trash" "move message to the trash"
> 
> Still untested.

I've been using the macro some more. On thing I noticed is that when I 
delete from the pager the mail is moved to trash immediately, but when 
I do it from the index I have to refresh the folder before it's moved. 
Why the difference?
> 
> -- 
> Ed Blackman



-- 
//Christian Dysthe


Re: Macro to move mail to trash in Gmail.

2012-01-14 Thread Christian Dysthe
On 01/13/12 at 09:30pm, Ed Blackman wrote:
> On Fri, Jan 13, 2012 at 06:39:00PM -0600, Christian Dysthe wrote:
> >On 01/13/12 at 11:36am, Ed Blackman wrote:
> >>macro index,pager D "set my_resolve=\$resolve 
> >>resolve=no\
> >>N+Gmail/trash\
> >>set resolve=\$my_resolve &my_resolve" "move message 
> >>to the trash"
> >
> >Thank you so much! This macro works exactly like I would like it to
> >except for one minor issue: It does not move to the next message after
> >the e-mail is delete (moved to Gmail trash). The problem before was
> >that it moved to the next mail and moved that to trash. Now it works
> >perfectly with regards to deleting and moving the mail. If it's no way
> >or have it move to the next mail after deletion  to do that I'm fine
> >with the way it works now.
> 
> OK.  You just need to move the "save" until after resolve is
> restored.  That way the save will delete and move to the next
> message.
> 
> macro index,pager D "set my_resolve=\$resolve 
> resolve=no\
> N\
> set resolve=\$my_resolve &my_resolve\
> +Gmail/trash" "move message to the trash"
> 
> Still untested.

Thanks again! Now it works perfectly (at least for me). I'll keep this 
macro in the vault with the Coca Cola recipe since I could never have
come up with it myself. :)
> 
> -- 
> Ed Blackman



-- 
//Christian Dysthe


Re: Macro to move mail to trash in Gmail.

2012-01-13 Thread Ed Blackman

On Fri, Jan 13, 2012 at 06:39:00PM -0600, Christian Dysthe wrote:

On 01/13/12 at 11:36am, Ed Blackman wrote:

macro index,pager D "set my_resolve=\$resolve resolve=no\
N+Gmail/trash\
set resolve=\$my_resolve &my_resolve" "move message to the 
trash"


Thank you so much! This macro works exactly like I would like it to
except for one minor issue: It does not move to the next message after
the e-mail is delete (moved to Gmail trash). The problem before was
that it moved to the next mail and moved that to trash. Now it works
perfectly with regards to deleting and moving the mail. If it's no way
or have it move to the next mail after deletion  to do that I'm fine
with the way it works now.


OK.  You just need to move the "save" until after resolve is restored.  
That way the save will delete and move to the next message.


macro index,pager D "set my_resolve=\$resolve resolve=no\
N\
set resolve=\$my_resolve &my_resolve\
+Gmail/trash" "move message to the trash"

Still untested.

--
Ed Blackman


signature.txt
Description: Digital signature


Re: Macro to move mail to trash in Gmail.

2012-01-13 Thread Christian Dysthe
On 01/13/12 at 11:36am, Ed Blackman wrote:
> On Thu, Jan 12, 2012 at 08:38:01AM -0600, Luis Mochan wrote:
> >Acoording to the manual, there is a variable:
> >
> >resolve
> >
> >Type: boolean
> >Default: yes
> >
> >When set, the cursor will be automatically advanced to the next
> >(possibly undeleted) message whenever a command that modifies the
> >current message is executed.
> 
> I found unsetting resolve all the time was annoying, since most of
> the time I *do* want to move to the next message.  Try this macro.
> It uses a pattern I picked up in this group: save the current
> setting, change it, perform the desired action, then reset to the
> saved setting.
> 
> macro index,pager D "set my_resolve=\$resolve 
> resolve=no\
> N+Gmail/trash\
> set resolve=\$my_resolve &my_resolve" "move message to 
> the trash"
> 
> I haven't tested this particular macro, but I just rewrote the
> macros that I have that previously did "save to mailbox (implicitly
> moving to next entry); move to previous entry", and they work just
> great with "save resolve value; set resolve=no; save; restore saved
> resolve value".

Thank you so much! This macro works exactly like I would like it to 
except for one minor issue: It does not move to the next message after 
the e-mail is delete (moved to Gmail trash). The problem before was 
that it moved to the next mail and moved that to trash. Now it works 
perfectly with regards to deleting and moving the mail. If it's no way 
or have it move to the next mail after deletion  to do that I'm fine 
with the way it works now.
> 
> -- 
> Ed Blackman



-- 
//Christian Dysthe


Re: Macro to move mail to trash in Gmail.

2012-01-13 Thread Will Fiveash
On Fri, Jan 13, 2012 at 11:36:06AM -0500, Ed Blackman wrote:
> I found unsetting resolve all the time was annoying, since most of the time
> I *do* want to move to the next message.  Try this macro.  It uses a pattern
> I picked up in this group: save the current setting, change it, perform the
> desired action, then reset to the saved setting.
> 
> macro index,pager D "set my_resolve=\$resolve 
> resolve=no\
> N+Gmail/trash\
> set resolve=\$my_resolve &my_resolve" "move message to 
> the trash"
> 
> I haven't tested this particular macro, but I just rewrote the macros that I
> have that previously did "save to mailbox (implicitly moving to next entry);
> move to previous entry", and they work just great with "save resolve value;
> set resolve=no; save; restore saved resolve value".

I too have had similar issues and in my .muttrc I have:

unset resolve   # move to the next message when an action is performed

macro pager D ":set resolve\n:unset resolve\n" "Delete Message"
macro index D ":set resolve\n:unset resolve\n" "Delete Message"
macro index N ":set resolve\n:unset resolve\n" "Toggle message 
'N'ew flag"

These settings make me happier.
-- 
Will Fiveash


Re: Macro to move mail to trash in Gmail.

2012-01-13 Thread Ed Blackman

On Thu, Jan 12, 2012 at 08:38:01AM -0600, Luis Mochan wrote:

Acoording to the manual, there is a variable:

resolve

Type: boolean
Default: yes

When set, the cursor will be automatically advanced to the next
(possibly undeleted) message whenever a command that modifies the
current message is executed.


I found unsetting resolve all the time was annoying, since most of the 
time I *do* want to move to the next message.  Try this macro.  It uses 
a pattern I picked up in this group: save the current setting, change 
it, perform the desired action, then reset to the saved setting.


macro index,pager D "set my_resolve=\$resolve resolve=no\
N+Gmail/trash\
set resolve=\$my_resolve &my_resolve" "move message to the 
trash"

I haven't tested this particular macro, but I just rewrote the macros 
that I have that previously did "save to mailbox (implicitly moving to 
next entry); move to previous entry", and they work just great with 
"save resolve value; set resolve=no; save; restore saved resolve value".


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Macro to move mail to trash in Gmail.

2012-01-12 Thread Luis Mochan
Acoording to the manual, there is a variable:

resolve

Type: boolean
Default: yes

When set, the cursor will be automatically advanced to the next 
(possibly undeleted) message whenever a command that modifies the 
current message is executed.

I guess unsetting 'resolve' would help.

Regards,
Luis


On Thu, Jan 12, 2012 at 08:55:22AM +0200, Alexander Gattin wrote:
> Hello,
> 
> On Wed, Jan 11, 2012 at 08:24:20AM -0600,
> Christian Dysthe wrote:
> > macro index,pager D "N+Gmail/trash"
> > "move message to the trash"
> > 
> > This one works, but iit moves to the next mail
> > and deletes it instead of the current mail
> > selected.
> 
> Is it possible to remember position, mark message
> as read, then return to it and delete?
> 
> Probably, simpler solution like "mark, step up,
> delete" would also work 99% of times...
> 
> -- 
> With best regards,
> xrgtn

-- 

  o
W. Luis Mochán,  | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388 `>/   /\
Apdo. Postal 48-3, 62251 |   (*)/\/  \
Cuernavaca, Morelos, México  | moc...@fis.unam.mx   /\_/\__/

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org 




Re: Macro to move mail to trash in Gmail.

2012-01-11 Thread Alexander Gattin
Hello,

On Wed, Jan 11, 2012 at 08:24:20AM -0600,
Christian Dysthe wrote:
> macro index,pager D "N+Gmail/trash"
> "move message to the trash"
> 
> This one works, but iit moves to the next mail
> and deletes it instead of the current mail
> selected.

Is it possible to remember position, mark message
as read, then return to it and delete?

Probably, simpler solution like "mark, step up,
delete" would also work 99% of times...

-- 
With best regards,
xrgtn


Re: Macro to move mail to trash in Gmail.

2012-01-11 Thread Mandar Mitra
Christian Dysthe wrote (Wed, Jan 11, 2012 at 09:55:14AM -0600):
> 
> I would like for mail that I'm never going to read to be marked as read 
> when they are deleted. I also use the sidebar in mutt and it clutters 
> it up having unread mail indicated in the trash folder when it's mail I 
> already have deleted.

But you *do* want Trash to be listed in the sidebar, is that it?
Otherwise, you could simply omit Trash from the list of mailboxes
displayed in the sidebar, and it wouldn't bother you.

You might also try to set resolve to "no". Then your macro:

macro index,pager D "N+Gmail/trash"
"move message to the trash"

might work. Not sure if it would result in undesirable behaviour
under different circumstances.

Also,  may be a shorter alternative to ...

mandar.


Re: Macro to move mail to trash in Gmail.

2012-01-11 Thread Christian Dysthe
On 01/11/12 at 08:24pm, Mandar Mitra wrote:
> Christian Dysthe wrote (Wed, Jan 11, 2012 at 08:24:20AM -0600):
> 
> > Are anyone here using mutt
> > with Gmail and have a working solution for moving mail to trash and
> > mark it read?
> 
> I don't have an answer; I'm only trying to understand your requirement
> (I use the same combination that you do).
> 
> You delete unread mail presumably based on the sender / subject info?
> Why does it bother you that it remains marked unread in Trash?

I would like for mail that I'm never going to read to be marked as read 
when they are deleted. I also use the sidebar in mutt and it clutters 
it up having unread mail indicated in the trash folder when it's mail I 
already have deleted.
> 
> Mostly idly curious,
> mandar.

-- 
//Christian Dysthe


Re: Macro to move mail to trash in Gmail.

2012-01-11 Thread Mandar Mitra
Christian Dysthe wrote (Wed, Jan 11, 2012 at 08:24:20AM -0600):

> Are anyone here using mutt
> with Gmail and have a working solution for moving mail to trash and
> mark it read?

I don't have an answer; I'm only trying to understand your requirement
(I use the same combination that you do).

You delete unread mail presumably based on the sender / subject info?
Why does it bother you that it remains marked unread in Trash?

Mostly idly curious,
mandar.


Macro to move mail to trash in Gmail.

2012-01-11 Thread Christian Dysthe
Hi,

I'm using mutt with offlineimap and msmtp. It's working great except
for one issue: In Gmail mail is moved to the trash folder (or label in
Gmail lingo) and then automatically deleted from there after 30 days.
I have for days tried to create a macro that moved mail to trash and
removes the 'new'flag so that the mail appears as read in the trash
folder. The first macro I found on a web page with a "Gmail with mutt"
tutorial. The macro looks like this:

macro index,pager D "+Gmail/trash" "move message
to the trash"

It moves the mail to trash, but new deleted mail is marked unread in
the trash folder and I would like for all mail in trash to be marked
read. I then modified the macro and ended up with this:

macro index,pager D "N+Gmail/trash"
"move message to the trash"

This one works, but iit moves to the next mail and deletes it instead
of the current mail selected. If I could get this macro to not move
ahead one mail it would be the solution. Are anyone here using mutt
with Gmail and have a working solution for moving mail to trash and
mark it read? If so please let me know how you do it. If someone has
suggestions on how I could create a macro doing what I want it would
be great to know.

-- 
//Christian