On 04Aug2016 12:44, Yubin Ruan <ablacktsh...@gmail.com> wrote:
On Thu, Aug 04, 2016 at 10:38:49AM +1000, c...@zip.com.au wrote:
On 04Aug2016 07:52, Yubin Ruan <ablacktsh...@gmail.com> wrote:
>Fortunately, after a few googling and combining all those info I
>have gathered,
>I find something like this:
>
>push
'<tag-pattern>~cmutt-us...@mutt.org<enter>;simaps://ablacktsh...@imap.gmail.com/mutt-users<enter>y'
I would be inclined to replace the ";" with "<tag-prefix>" and the
"s" with "<save-message>". Just to make it all clear, and to avoid
damage by any macro definition you might make. I tend to either
spell it all out with <blah> or (for very short macros) to be
entirely keystrokes (I have a couple of macros for the "message"
view that are just bound to "q" and the same thing in the index view
i.e. "quit the message view and do what would happen in the index
view".
>I put this in my .muttrc, and every time I open mutt, it would automatically
>move all the messages which are `To: mutt-users@mutt.org` or `Cc:
>mutt-users@mutt.org` to the mutt-users folder. Although it does it remotely,
>which would slow thing down when the network connection is not so good,
You might be surprised. If all the work is being done by the imap
server and the messages are not being pulled down to mutt and pushed
back up things should be pretty fast even on a poor connection.
That trick did work, but there still exists some problems when I put more than
one `push` command in my .muttrc:
push
'<tag-pattern>~cmutt-us...@mutt.org<enter>;simaps://ablacktsh...@imap.gmail.com/mutt-users<enter>y'
push
'<tag-pattern>~cmutt-...@mutt.org<enter>;simaps://ablacktsh...@imap.gmail.com/mutt-dev<enter>y'
push '<tag-pattern>~f....'
...
(just as an example)
It seem like that the `push` command would not block when the preceding one is
not finished, which result in that those tagged message would NOT be saved to
the appropriate folder. That means, for example, those mails that
belong to `mutt-users`
folder would now be saved to the `mutt-dev` folder, which is probably because
the second `push` take effect before the first one can finish and the first
<save-message> never get a chance to take effect.
any idea?
Two issues to be aware of:
- the entire muttrc runs before the keyboard stream starts being processed,
and push just inserts text into the front of that stream. So the push
command does not act until the muttrc has been processed.
- each push command pushes onto the _front_ of the keyboard stream
That second part is important: _after_ the above push commands your keyboard
stream looks like this:
<tag-pattern>~f....
<tag-pattern>~cmutt-...@mutt.org<enter>;simaps://ablacktsh...@imap.gmail.com/mutt-dev<enter>y
<tag-pattern>~cmutt-us...@mutt.org<enter>;simaps://ablacktsh...@imap.gmail.com/mutt-users<enter>y
because the last push command to execute as your:
push '<tag-pattern>~f....'
This means that your "<tag-pattern>~f...." is the first thing to happen. Mutt
_does_ wait for each command, but they aren't happening in the order you
expected.
Cheers,
Cameron Simpson <c...@zip.com.au>