Re: Equivalent to 'limit' for index?
--> David Woodfall [2013-02-06 21:59:48 +]: > Is there a way of 1) Doing a 'limit' in the index, which shows only > folders with new mail, or 2) A file-mask that I can use to do the > same? > > Man page and google didn't find anything, and I tried making a macro > for limit for the index but it didn't work. > > Thanks I see Andre has provided some of his own scripts and, they do look interesting; I'll take a look too if that's ok. But the index view is just that. It displays messages and info about them for that mailbox; so no, you couldn't use the limit function for showing mailboxes with new mail other than the buffy-list function. In my default folder-hook I have this (borrowed from Rado's config which is listed on the wiki under config tricks): folder-hook . \ ... ;\ macro index ;\ ... ;\ ' [then I list my other folder-hooks underneath] and at the bottom of the file folder-hook . 'push ' What that does is to list all the folders at the bottom of the index view with new mail in the buffy-list each time I change to a new folder. I also have buffy-list bound to as well so if I want to check the buffy-list again when in the index view I just press . Are you still having problems getting mutt to tell you what mailboxes have new mail in them? Jamie -- Primary Key: 4096R/1D31DC38 2011-12-03 Key Fingerprint: A4B9 E875 A18C 6E11 F46D B788 BEE6 1251 1D31 DC38
Re: Command/Macro to show new messages via IMAP?
--> David Woodfall [2013-02-06 21:55:46 +]: > On Wed, Feb 06, 2013 at 08:14:24AM +, James Griffin > put forth the proposition: > >--> David Woodfall [2013-02-05 18:46:56 +]: > > > >>>And I think I've found a problem with my mailboxes commands. When I > >>>tried changing the mailboxes for mailing lists I suddenly started > >>>getting a message count in the $folder_format working, so it has to be > >>>something to do with that I think. > >> > >>Indeed that was a problem. I also found that only %C, %N and %f work > >>for imap. > > > >Great stuff, glad you found the solution. It usually is in the man > >pages with some trial and error. > > Actually it's not in the man pages, but it would have saved me some > time if it had been. The information for the printf format specifiers is in man muttrc under index_view; when you look at folder_format is refers you to index_view to see the format specifiers and explains what they do. -- Primary Key: 4096R/1D31DC38 2011-12-03 Key Fingerprint: A4B9 E875 A18C 6E11 F46D B788 BEE6 1251 1D31 DC38
Re: Command/Macro to show new messages via IMAP?
On Thu, Feb 07, 2013 at 08:17:41AM +, James Griffin put forth the proposition: --> David Woodfall [2013-02-06 21:55:46 +]: On Wed, Feb 06, 2013 at 08:14:24AM +, James Griffin put forth the proposition: >--> David Woodfall [2013-02-05 18:46:56 +]: > >>>And I think I've found a problem with my mailboxes commands. When I >>>tried changing the mailboxes for mailing lists I suddenly started >>>getting a message count in the $folder_format working, so it has to be >>>something to do with that I think. >> >>Indeed that was a problem. I also found that only %C, %N and %f work >>for imap. > >Great stuff, glad you found the solution. It usually is in the man >pages with some trial and error. Actually it's not in the man pages, but it would have saved me some time if it had been. The information for the printf format specifiers is in man muttrc under index_view; when you look at folder_format is refers you to index_view to see the format specifiers and explains what they do. Yes, I know, but it doesn't say that most of them don't work with IMAP.
Re: Equivalent to 'limit' for index?
On Thu, Feb 07, 2013 at 08:01:21AM +, James Griffin put forth the proposition: --> David Woodfall [2013-02-06 21:59:48 +]: Is there a way of 1) Doing a 'limit' in the index, which shows only folders with new mail, or 2) A file-mask that I can use to do the same? Man page and google didn't find anything, and I tried making a macro for limit for the index but it didn't work. Thanks I see Andre has provided some of his own scripts and, they do look interesting; I'll take a look too if that's ok. But the index view is just that. It displays messages and info about them for that mailbox; so no, you couldn't use the limit function for showing mailboxes with new mail other than the buffy-list function. In my default folder-hook I have this (borrowed from Rado's config which is listed on the wiki under config tricks): folder-hook . \ ... ;\ macro index ;\ ... ;\ ' [then I list my other folder-hooks underneath] and at the bottom of the file folder-hook . 'push ' What that does is to list all the folders at the bottom of the index view with new mail in the buffy-list each time I change to a new folder. I also have buffy-list bound to as well so if I want to check the buffy-list again when in the index view I just press . Are you still having problems getting mutt to tell you what mailboxes have new mail in them? No it works fine now. Just trying out a couple of shell scripts similar to Andre's, but much simpler: mailboxes.sh: ## #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ sort -u | sed 's/^\.//') do if [ "$f" == "new" ] || [ "$f" == "cur" ]; then f="INBOX" fi echo -n " +"$f done echo It seems to be working fine but for some reason I'm unable to bind it to a macro in browser: macro browser z "|~/.mutt/mailboxes.sh\n" This just tells me that key is unbound, and I've tried it elsewhere like index, which works, but I'd rather have it in browser where I'm actually looking at the mailboxes.
Re: Equivalent to 'limit' for index?
--> David Woodfall [2013-02-07 08:44:34 +]: > On Thu, Feb 07, 2013 at 08:01:21AM +, James Griffin > put forth the proposition: > >--> David Woodfall [2013-02-06 21:59:48 +]: > > > >>Is there a way of 1) Doing a 'limit' in the index, which shows only > >>folders with new mail, or 2) A file-mask that I can use to do the > >>same? > >> > >>Man page and google didn't find anything, and I tried making a macro > >>for limit for the index but it didn't work. > >> > >>Thanks > > > >I see Andre has provided some of his own scripts and, they do look > >interesting; I'll take a look too if that's ok. > > > >But the index view is just that. It displays messages and info about > >them for that mailbox; so no, you couldn't use the limit function for > >showing mailboxes with new mail other than the buffy-list function. > > > >In my default folder-hook I have this (borrowed from Rado's config which > >is listed on the wiki under config tricks): > > > > folder-hook . \ > > ... ;\ > > macro index ;\ > > ... ;\ > > ' > > > > [then I list my other folder-hooks underneath] > > > >and at the bottom of the file > > > > folder-hook . 'push ' > > > >What that does is to list all the folders at the bottom of the index > >view with new mail in the buffy-list each time I change to a new folder. > >I also have buffy-list bound to as well so if I want to check the > >buffy-list again when in the index view I just press . > > > >Are you still having problems getting mutt to tell you what mailboxes > >have new mail in them? > > No it works fine now. Just trying out a couple of shell scripts > similar to Andre's, but much simpler: > > mailboxes.sh: > ## > #!/bin/sh > > set -e > MAILDIR="/home/david/mail" > HOSTNAME="blackswan" > > for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ >sort -u | sed 's/^\.//') > do >if [ "$f" == "new" ] || [ "$f" == "cur" ]; then >f="INBOX" >fi >echo -n " +"$f > done > > echo > > It seems to be working fine but for some reason I'm unable to bind it to a > macro in browser: > > macro browser z "|~/.mutt/mailboxes.sh\n" > > This just tells me that key is unbound, and I've tried it elsewhere like > index, which works, but I'd rather have it in browser where I'm actually > looking at the mailboxes. What do you mean by "in a browser" ? Do you you mean the folder view? -- Primary Key: 4096R/1D31DC38 2011-12-03 Key Fingerprint: A4B9 E875 A18C 6E11 F46D B788 BEE6 1251 1D31 DC38
Re: Equivalent to 'limit' for index?
On Thu, Feb 07, 2013 at 09:33:00AM +, James Griffin put forth the proposition: --> David Woodfall [2013-02-07 08:44:34 +]: On Thu, Feb 07, 2013 at 08:01:21AM +, James Griffin put forth the proposition: >--> David Woodfall [2013-02-06 21:59:48 +]: > >>Is there a way of 1) Doing a 'limit' in the index, which shows only >>folders with new mail, or 2) A file-mask that I can use to do the >>same? >> >>Man page and google didn't find anything, and I tried making a macro >>for limit for the index but it didn't work. >> >>Thanks > >I see Andre has provided some of his own scripts and, they do look >interesting; I'll take a look too if that's ok. > >But the index view is just that. It displays messages and info about >them for that mailbox; so no, you couldn't use the limit function for >showing mailboxes with new mail other than the buffy-list function. > >In my default folder-hook I have this (borrowed from Rado's config which >is listed on the wiki under config tricks): > >folder-hook . \ >... ;\ >macro index ;\ >... ;\ >' > >[then I list my other folder-hooks underneath] > >and at the bottom of the file > >folder-hook . 'push ' > >What that does is to list all the folders at the bottom of the index >view with new mail in the buffy-list each time I change to a new folder. >I also have buffy-list bound to as well so if I want to check the >buffy-list again when in the index view I just press . > >Are you still having problems getting mutt to tell you what mailboxes >have new mail in them? No it works fine now. Just trying out a couple of shell scripts similar to Andre's, but much simpler: mailboxes.sh: ## #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ sort -u | sed 's/^\.//') do if [ "$f" == "new" ] || [ "$f" == "cur" ]; then f="INBOX" fi echo -n " +"$f done echo It seems to be working fine but for some reason I'm unable to bind it to a macro in browser: macro browser z "|~/.mutt/mailboxes.sh\n" This just tells me that key is unbound, and I've tried it elsewhere like index, which works, but I'd rather have it in browser where I'm actually looking at the mailboxes. What do you mean by "in a browser" ? Do you you mean the folder view? Yes, when I use the toggle-mailboxes command and it lists all the imap folders. I've seen plenty of macros for browser online, but it just seems to get ignored here. Maybe they are outdated.
Re: Equivalent to 'limit' for index?
On Thu, Feb 07, 2013 at 09:40:43AM +, David Woodfall put forth the proposition: On Thu, Feb 07, 2013 at 09:33:00AM +, James Griffin put forth the proposition: --> David Woodfall [2013-02-07 08:44:34 +]: On Thu, Feb 07, 2013 at 08:01:21AM +, James Griffin put forth the proposition: --> David Woodfall [2013-02-06 21:59:48 +]: Is there a way of 1) Doing a 'limit' in the index, which shows only folders with new mail, or 2) A file-mask that I can use to do the same? Man page and google didn't find anything, and I tried making a macro for limit for the index but it didn't work. Thanks I see Andre has provided some of his own scripts and, they do look interesting; I'll take a look too if that's ok. But the index view is just that. It displays messages and info about them for that mailbox; so no, you couldn't use the limit function for showing mailboxes with new mail other than the buffy-list function. In my default folder-hook I have this (borrowed from Rado's config which is listed on the wiki under config tricks): folder-hook . \ ... ;\ macro index ;\ ... ;\ ' [then I list my other folder-hooks underneath] and at the bottom of the file folder-hook . 'push ' What that does is to list all the folders at the bottom of the index view with new mail in the buffy-list each time I change to a new folder. I also have buffy-list bound to as well so if I want to check the buffy-list again when in the index view I just press . Are you still having problems getting mutt to tell you what mailboxes have new mail in them? No it works fine now. Just trying out a couple of shell scripts similar to Andre's, but much simpler: mailboxes.sh: ## #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ sort -u | sed 's/^\.//') do if [ "$f" == "new" ] || [ "$f" == "cur" ]; then f="INBOX" fi echo -n " +"$f done echo It seems to be working fine but for some reason I'm unable to bind it to a macro in browser: macro browser z "|~/.mutt/mailboxes.sh\n" This just tells me that key is unbound, and I've tried it elsewhere like index, which works, but I'd rather have it in browser where I'm actually looking at the mailboxes. What do you mean by "in a browser" ? Do you you mean the folder view? Yes, when I use the toggle-mailboxes command and it lists all the imap folders. I've seen plenty of macros for browser online, but it just seems to get ignored here. Maybe they are outdated. Well, I got it working by using 'macro generic' instead, then adding a couple of at the end: macro generic Z ":source ~/.mutt/sourceallboxes\n" macro generic z ":source ~/.mutt/sourceboxes\n" If anyone is interested the scripts below: sourceboxes: unmailboxes * mailboxes `~/.mutt/mailboxes.sh` subscribe `~/.mutt/subscribed.sh` sourceallboxes: unmailboxes * mailboxes `~/.mutt/allmailboxes.sh` subscribe `~/.mutt/allsubscribed.sh` mailboxes.sh: #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ sort -u | sed 's/^\.//') do if [ "$f" == "new" ] || [ "$f" == "cur" ]; then f="INBOX" fi echo -n " +"$f done allmailboxes.sh: #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "new" | cut -d'/' -f5 | sed 's/^\.//') do if [ "$f" == "new" ]; then f="INBOX" fi echo -n " +"$f done subscribed.sh: #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | grep "\.lists\." \ | cut -d'/' -f5 | sort -u | sed 's/^\.//') do echo -n $f" " done allsubscribed.sh: #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name ".lists.*" \ | cut -d'/' -f5 | sort -u | sed 's/^\.//') do if [ -n "$f" ]; then echo -n "$f " fi done ## Seems to work fine for me, although I'm guessing a bit at how individual email files are named when new. For instance, some end in my hostname and some end in a ','. -- When all you have is a Swiss Army Knife, every problem looks like email. -- Peter da Silva
Re: Equivalent to 'limit' for index?
On Thu, Feb 07, 2013 at 08:44:34AM +, David Woodfall wrote: > On Thu, Feb 07, 2013 at 08:01:21AM +, James Griffin > put forth the proposition: > >--> David Woodfall [2013-02-06 21:59:48 +]: > No it works fine now. Just trying out a couple of shell scripts > similar to Andre's, but much simpler: > > mailboxes.sh: > ## > #!/bin/sh > > set -e > MAILDIR="/home/david/mail" > HOSTNAME="blackswan" > > for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ >sort -u | sed 's/^\.//') > do >if [ "$f" == "new" ] || [ "$f" == "cur" ]; then >f="INBOX" >fi >echo -n " +"$f > done > > echo > > It seems to be working fine but for some reason I'm unable to bind it to a > macro in browser: > > macro browser z "|~/.mutt/mailboxes.sh\n" > > This just tells me that key is unbound, and I've tried it elsewhere like > index, which works, but I'd rather have it in browser where I'm actually > looking at the mailboxes. Well, not quite obvious at first, but easy to understand: Your script generates just a list of mailbox names, e.g. "+foo +bar +baz". That output is usable by feeding it into a mailboxes-command. e.g. "mailboxes `mailboxes.sh`". And that command in turn you can bind to a macro.: "macro browser z "mailboxes `mailboxes.sh`" But: that macro will be generated while parsing the config, so it will execute "mailboxes +foo +bar +baz" when it is called. So you need to source that out into a seperate file, that than in turn is sourced by the macron on demand. So you essentially end up with a state that I already had: commit 17cb8a4ff0a455073fba19fdb95871b73ddf480e in my mutt-repo. At that time I was still using the 1st version of my mailboxes-script, but it got unmanageable as some of my folders grew too big. So the runtime of the script ended up being 30-60s, depending on the speed of my NFS-server serving the Maildir. So I reimplemented it using perl (because I wanted to do perl anyway some day) and build it to be completely optimized. The issue I diagnosed with the old version was that it ran through all directories and file to find unread mails, but that takes too long. In the perl-version I stop at the first occurance of an unread mail or don't even check the cur-directory if already the new-directory has contents. And I also avoid going into cur, new or tmp directories if it should print all anyway. But it is up to you what way you want to go. Have fun, Andre -- Andre Klärner smime.p7s Description: S/MIME cryptographic signature
Re: Equivalent to 'limit' for index?
On Thu, Feb 07, 2013 at 10:47:57AM +0100, Andre Klärner put forth the proposition: On Thu, Feb 07, 2013 at 08:44:34AM +, David Woodfall wrote: On Thu, Feb 07, 2013 at 08:01:21AM +, James Griffin put forth the proposition: >--> David Woodfall [2013-02-06 21:59:48 +]: No it works fine now. Just trying out a couple of shell scripts similar to Andre's, but much simpler: mailboxes.sh: ## #!/bin/sh set -e MAILDIR="/home/david/mail" HOSTNAME="blackswan" for f in $(find $MAILDIR -name "*," -o -name "*$HOSTNAME" | cut -d'/' -f5 | \ sort -u | sed 's/^\.//') do if [ "$f" == "new" ] || [ "$f" == "cur" ]; then f="INBOX" fi echo -n " +"$f done echo It seems to be working fine but for some reason I'm unable to bind it to a macro in browser: macro browser z "|~/.mutt/mailboxes.sh\n" This just tells me that key is unbound, and I've tried it elsewhere like index, which works, but I'd rather have it in browser where I'm actually looking at the mailboxes. Well, not quite obvious at first, but easy to understand: Your script generates just a list of mailbox names, e.g. "+foo +bar +baz". That output is usable by feeding it into a mailboxes-command. e.g. "mailboxes `mailboxes.sh`". And that command in turn you can bind to a macro.: "macro browser z "mailboxes `mailboxes.sh`" But: that macro will be generated while parsing the config, so it will execute "mailboxes +foo +bar +baz" when it is called. So you need to source that out into a seperate file, that than in turn is sourced by the macron on demand. So you essentially end up with a state that I already had: commit 17cb8a4ff0a455073fba19fdb95871b73ddf480e in my mutt-repo. At that time I was still using the 1st version of my mailboxes-script, but it got unmanageable as some of my folders grew too big. So the runtime of the script ended up being 30-60s, depending on the speed of my NFS-server serving the Maildir. So I reimplemented it using perl (because I wanted to do perl anyway some day) and build it to be completely optimized. The issue I diagnosed with the old version was that it ran through all directories and file to find unread mails, but that takes too long. In the perl-version I stop at the first occurance of an unread mail or don't even check the cur-directory if already the new-directory has contents. And I also avoid going into cur, new or tmp directories if it should print all anyway. Yes, my first effort was much too slow, but piping from find takes < a second to output the list. I've also taken out the subscribed part and just subscribe to all when mutt loads. Thanks for the info on macros. I didn't know they were generated like that.
Re: Command/Macro to show new messages via IMAP?
--> David Woodfall [2013-02-07 08:37:46 +]: ... > Yes, I know, but it doesn't say that most of them don't work with > IMAP. Yes, having had another look I tend to agree with you; the printf sequences that are not imap campatible aren't specified as such. Not all of them anyway. Jamie -- Primary Key: 4096R/1D31DC38 2011-12-03 Key Fingerprint: A4B9 E875 A18C 6E11 F46D B788 BEE6 1251 1D31 DC38
Re: Equivalent to 'limit' for index?
Hi David, On Thu, Feb 07, 2013 at 09:55:55AM +, David Woodfall wrote: > Seems to work fine for me, although I'm guessing a bit at how > individual email files are named when new. For instance, some > end in my hostname and some end in a ','. well, those ending in your hostname are probaply in the new/ part of the maildir. While they are moved to cur/ by the MUA they get renames and appended with the ":2,PRSTDF" field, which is a delimiter, the version of the stuff behind, another delimiter and the flags. All is explained in detail here: http://cr.yp.to/proto/maildir.html That is also one new thing in my mailboxes.pl: It tries to parse it as near to the spec as possible. Regards, Andre -- Andre Klärner smime.p7s Description: S/MIME cryptographic signature
Re: Equivalent to 'limit' for index?
On Thu, Feb 07, 2013 at 02:23:03PM +0100, Andre Klärner put forth the proposition: Hi David, On Thu, Feb 07, 2013 at 09:55:55AM +, David Woodfall wrote: Seems to work fine for me, although I'm guessing a bit at how individual email files are named when new. For instance, some end in my hostname and some end in a ','. well, those ending in your hostname are probaply in the new/ part of the maildir. While they are moved to cur/ by the MUA they get renames and appended with the ":2,PRSTDF" field, which is a delimiter, the version of the stuff behind, another delimiter and the flags. All is explained in detail here: http://cr.yp.to/proto/maildir.html That is also one new thing in my mailboxes.pl: It tries to parse it as near to the spec as possible. Thanks, that's useful info.
Sent-folder to display SEND TO address instead SEND FROM
I use for my regular inbox: set index_format="%4C %Z [%-25.25n] [%d] (%?M?C%3M&%4c?) %s" and I try to use this for my Sent folder to display the TO address in my Sent folder instead of my FROM address. folder-hook Sent 'set index_format="%4C %Z [%-25.25t] [%d] \ (%?M?C%3M&%4c?) %s"' However, this does not work. As soon as I jump back from my Sent folder into any other folder, mutt starts to display the FROM value the same way as it displays the TO value in 'Sent' folder: there is now a prefix 'To ' in front of each %...n format string. I.e. it looks now like '... [To ] ...' I don't even understand why there is a 'To ' in front of each message indicated by [%-25.25t] - but why does mutt now format every display index like the folder hook I applied to 'Sent' only? This is boring. I know that I am the recipient in all folders but SENT - and in SENT I am the only sender, don't need to remind me ;) Perhaps I did something wrong. Torsten
Re: Sent-folder to display SEND TO address instead SEND FROM
Hi Torsten, * Torsten Flammiger [07. Feb. 2013]: > I use for my regular inbox: > set index_format="%4C %Z [%-25.25n] [%d] (%?M?C%3M&%4c?) %s" > > and I try to use this for my Sent folder to display the TO address > in my Sent folder instead of my FROM address. > > folder-hook Sent 'set index_format="%4C %Z [%-25.25t] [%d] \ >(%?M?C%3M&%4c?) %s"' > > However, this does not work. As soon as I jump back from my > Sent folder into any other folder, mutt starts to > display the FROM value the same way as it displays the TO > value in 'Sent' folder: there is now a prefix 'To ' in front of > each %...n format string. I.e. it looks now like > '... [To ] ...' > > I don't even understand why there is a 'To ' in front of > each message indicated by [%-25.25t] - but why does mutt > now format every display index like the folder hook I applied > to 'Sent' only? This is boring. I know that I am the recipient > in all folders but SENT - and in SENT I am the only sender, > don't need to remind me ;) > > Perhaps I did something wrong. You'll have to teach mutt to switch back to your "normal" index format, when switchin mailboxes: folder-hook . 'set index_format="%4C %Z [%-25.25n] [%d] (%?M?C%3M&%4c?) %s"' Ciao, Gregor -- -... --- .-. . -.. ..--.. ...-.-
Re: Sent-folder to display SEND TO address instead SEND FROM
On Thu, Feb 07, 2013 at 10:11:22PM +0100, Torsten Flammiger wrote: > I use for my regular inbox: > set index_format="%4C %Z [%-25.25n] [%d] (%?M?C%3M&%4c?) %s" > > and I try to use this for my Sent folder to display the TO address > in my Sent folder instead of my FROM address. > > folder-hook Sent 'set index_format="%4C %Z [%-25.25t] [%d] \ >(%?M?C%3M&%4c?) %s"' This works for me very well: "%-15.15L" -- Suvayu Open source is the future. It sets us free.
Re: Sent-folder to display SEND TO address instead SEND FROM
Am 08.02.2013 02:32, schrieb Gregor Zattler: Hi Torsten, [...] Perhaps I did something wrong. You'll have to teach mutt to switch back to your "normal" index format, when switchin mailboxes: folder-hook . 'set index_format="%4C %Z [%-25.25n] [%d] (%?M?C%3M&%4c?) %s"' ahh, that makes sense. Thanks Torsten