Re: set different index_format for mails
= On [2011-11-09 10:52:00 -0500]: Ed Blackman Said: On Wed, Nov 09, 2011 at 11:01:27AM +0800, stardiviner wrote: = On [2011-11-08 12:03:50 -0500]: Ed Blackman Said: On Tue, Nov 08, 2011 at 02:13:05PM +0100, Gregor Zattler wrote: It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. Actually, it is. If you set index_format to a shell command that ends with a pipe, that Mutt will run that shell command for each message and use the output as the actual index_format. If you pass index_format expandos as arguments, Mutt will pass the expanded string. The shell command could then use that to emit different formats for different messages. For example, I have a script called format_date, and have this in .muttrc: set index_format=/path/to/format_date '%[%s]' '%%s' | This really is a good idea. I want to set index_format for different type mails like: new, deleted, replied, signed, encrypted ... But I do not know how to use those value like ~N ~R ~D ~g ~G etc. Do you know how to pass them to script ? Those are patterns, you can't pass them. You can pass the format strings that are listed in muttrc under index_format. It looks like all the patterns you are interested in are reflected in the message flags format string, %Z. So you'd change index_format in .muttrc to: set index_format=/path/to/format_flags '%Z' | Good idea, take it. Then create a format_flags script loosely based on mine that parses the flags argument and echos the right index_format based on what's passed in the flags. -- Ed Blackman -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature
Re: set different index_format for mails
= On [2011-11-08 09:13:27 -0800]: Gary Johnson Said: On 2011-11-08, Gregor Zattler wrote: Hi stardiviner, * stardiviner [08. Nov. 2011]: = On [2011-11-08 11:40:18 +0100]: * stardiviner [08. Nov. 2011]: Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. You can also use conditional elements in index_format that will print different pieces of information depending on the values of other pieces of information. This is explained in the mutt manual in the Conditionals section. As an example, I have this string as part of my index_format. %?X?* ? I have already tested, this %?n?new? only work in status_format, can not work on index_format correctly. here is my result: I set them like this: folder-hook =INBOX set index_format = ' %?n?new? %?o?old? %?d?del? %2C|%N [%4Z] | %-10L %?H?[spam]? %10s % %4c %[%I:%M %P %b/%d]' # for macro gi new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... If the number of attachments (X) is non-zero, * is inserted. Otherwise, is inserted. Regards, Gary -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature
Re: set different index_format for mails
On Wed, Nov 09, 2011 at 11:01:27AM +0800, stardiviner wrote: = On [2011-11-08 12:03:50 -0500]: Ed Blackman Said: On Tue, Nov 08, 2011 at 02:13:05PM +0100, Gregor Zattler wrote: It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. Actually, it is. If you set index_format to a shell command that ends with a pipe, that Mutt will run that shell command for each message and use the output as the actual index_format. If you pass index_format expandos as arguments, Mutt will pass the expanded string. The shell command could then use that to emit different formats for different messages. For example, I have a script called format_date, and have this in .muttrc: set index_format=/path/to/format_date '%[%s]' '%%s' | This really is a good idea. I want to set index_format for different type mails like: new, deleted, replied, signed, encrypted ... But I do not know how to use those value like ~N ~R ~D ~g ~G etc. Do you know how to pass them to script ? Those are patterns, you can't pass them. You can pass the format strings that are listed in muttrc under index_format. It looks like all the patterns you are interested in are reflected in the message flags format string, %Z. So you'd change index_format in .muttrc to: set index_format=/path/to/format_flags '%Z' | Then create a format_flags script loosely based on mine that parses the flags argument and echos the right index_format based on what's passed in the flags. -- Ed Blackman signature.txt Description: Digital signature
Re: set different index_format for mails
On 2011-11-09, stardiviner wrote: = On [2011-11-08 09:13:27 -0800]: Gary Johnson Said: You can also use conditional elements in index_format that will print different pieces of information depending on the values of other pieces of information. This is explained in the mutt manual in the Conditionals section. As an example, I have this string as part of my index_format. %?X?* ? I have already tested, this %?n?new? only work in status_format, can not work on index_format correctly. here is my result: I set them like this: folder-hook =INBOX set index_format = ' %?n?new? %?o?old? %?d?del? %2C|%N [%4Z] | %-10L %?H?[spam]? %10s % %4c %[%I:%M %P %b/%d]' # for macro gi new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... new old del 9|0 [ O +] | VeryCD » subject: ... There is a problem with your folder-hook. The command argument must be a single string, like this. folder-hook =INBOX 'set index_format= %?n?new? %?o?old? %?d?del? %2C|%N [%4Z] | %-10L %?H?[spam]? %10s % %4c %[%I:%M %P %b/%d]' # for macro gi Note that I moved the opening single quote to the beginning of the command so that set index_format= is included in the command. I also removed the spaces on both sides of the equal sign. I did not test the resulting hook, however. Regards, Gary
Re: set different index_format for mails
Hi stardiviner, * stardiviner numbch...@gmail.com [08. Nov. 2011]: I try to set different *index_format* for maials. like this: message-hook ~g set index_format = ' A %H %C| +%N [%4Z] %-13L %s % %4c' # signed message-hook ~g set index_format = ' B %H %C| %N [%4Z] %-13L %s % %4c' # replied The patterns are the same. This does not work. But folder-hook can set different *index_format*. like this: folder-hook . set index_format = ' %H %C| [%4Z] %-13L » %s % %4c' folder-hook =INBOX set index_format = ' %H %C| %N [%4Z] %-13L %s % %4c' # for macro gi Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? Ciao, Gregor -- -... --- .-. . -.. ..--.. ...-.-
Re: set different index_format for mails
= On [2011-11-08 11:40:18 +0100]: Gregor Zattler Said: Hi stardiviner, * stardiviner numbch...@gmail.com [08. Nov. 2011]: I try to set different *index_format* for maials. like this: message-hook ~g set index_format = ' A %H %C| +%N [%4Z] %-13L %s % %4c' # signed message-hook ~R set index_format = ' B %H %C| %N [%4Z] %-13L %s % %4c' # replied The patterns are the same. Sorry for this, actually they are different. I type wrong. This does not work. But folder-hook can set different *index_format*. like this: folder-hook . set index_format = ' %H %C| [%4Z] %-13L » %s % %4c' folder-hook =INBOX set index_format = ' %H %C| %N [%4Z] %-13L %s % %4c' # for macro gi Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? Maybe there are other method to do this. Ciao, Gregor -- -... --- .-. . -.. ..--.. ...-.- -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature
Re: set different index_format for mails
Hi stardiviner, * stardiviner numbch...@gmail.com [08. Nov. 2011]: = On [2011-11-08 11:40:18 +0100]: * stardiviner numbch...@gmail.com [08. Nov. 2011]: Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. For instance with: folder-hook . 'color index green default ~P' emails from me are coloured green. I do this with a folder-hook because for some specific folders I do not want this setting and override for these folders. Ciao, Gregor -- -... --- .-. . -.. ..--.. ...-.- signature.asc Description: Digital signature
Re: set different index_format for mails
= On [2011-11-08 14:13:05 +0100]: Gregor Zattler Said: Hi stardiviner, * stardiviner numbch...@gmail.com [08. Nov. 2011]: = On [2011-11-08 11:40:18 +0100]: * stardiviner numbch...@gmail.com [08. Nov. 2011]: Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. Thanks. really hope mutt can add this option. For instance with: folder-hook . 'color index green default ~P' emails from me are coloured green. I do this with a folder-hook because for some specific folders I do not want this setting and override for these folders. Ciao, Gregor -- -... --- .-. . -.. ..--.. ...-.- -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature
Re: set different index_format for mails
On Tue, Nov 08, 2011 at 02:13:05PM +0100, Gregor Zattler wrote: It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. Actually, it is. If you set index_format to a shell command that ends with a pipe, that Mutt will run that shell command for each message and use the output as the actual index_format. If you pass index_format expandos as arguments, Mutt will pass the expanded string. The shell command could then use that to emit different formats for different messages. For example, I have a script called format_date, and have this in .muttrc: set index_format=/path/to/format_date '%[%s]' '%%s' | The script emits a different date format for each message in the index depending on how old it is: ' 6:41pm' if less than a day, ' Thu 6pm' if more than a day but less than a week, ' Jan 20' if more than a week but less than 30 days, and '01/20/11' if more than 30 days. See http://marc.info/?l=mutt-usersm=129556814118983 and the thread that leads up to it. A different program could be written to examine the message flags in '%Z' instead of the time, and output different formats depending on those flags. The script in the message linked above could serve as a starting point, though the middle part where it's doing the date calculations would need to be replaced with flag comparisons. I don't have time to experiment with creating a full solution for the original poster, but hopefully this will point someone in the right direction. -- Ed Blackman signature.txt Description: Digital signature
Re: set different index_format for mails
On 2011-11-08, Gregor Zattler wrote: Hi stardiviner, * stardiviner [08. Nov. 2011]: = On [2011-11-08 11:40:18 +0100]: * stardiviner [08. Nov. 2011]: Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. You can also use conditional elements in index_format that will print different pieces of information depending on the values of other pieces of information. This is explained in the mutt manual in the Conditionals section. As an example, I have this string as part of my index_format. %?X?* ? If the number of attachments (X) is non-zero, * is inserted. Otherwise, is inserted. Regards, Gary
Re: set different index_format for mails
Quoth Gary Johnson on Tuesday, 08 November 2011: On 2011-11-08, Gregor Zattler wrote: Hi stardiviner, * stardiviner [08. Nov. 2011]: = On [2011-11-08 11:40:18 +0100]: * stardiviner [08. Nov. 2011]: Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. You can also use conditional elements in index_format that will print different pieces of information depending on the values of other pieces of information. This is explained in the mutt manual in the Conditionals section. As an example, I have this string as part of my index_format. %?X?* ? If the number of attachments (X) is non-zero, * is inserted. Otherwise, is inserted. Regards, Gary That doesn't seem to work for me (it always prints the *). What versions support it? I'm on 1.4.2.3i (FreeBSD ports version). -- .O. | Sterling (Chip) Camden | http://camdensoftware.com ..O | sterl...@camdensoftware.com | http://chipsquips.com OOO | 2048R/D6DBAF91 | http://chipstips.com pgpwwjA6GjOvN.pgp Description: PGP signature
Re: set different index_format for mails
* On 08 Nov 2011, Chip Camden wrote: As an example, I have this string as part of my index_format. %?X?* ? If the number of attachments (X) is non-zero, * is inserted. Otherwise, is inserted. That doesn't seem to work for me (it always prints the *). What versions support it? I'm on 1.4.2.3i (FreeBSD ports version). IMO there is no reason to run 1.4 if you're able (capable and permitted) to compile. The %??? notation works in 1.4 but the %X expando (as all ability to evaluate attachments) was introduced well into 1.5. -- David Champion • d...@uchicago.edu • IT Services • University of Chicago
Re: set different index_format for mails
On 2011-11-08, Chip Camden wrote: Quoth Gary Johnson on Tuesday, 08 November 2011: As an example, I have this string as part of my index_format. %?X?* ? If the number of attachments (X) is non-zero, * is inserted. Otherwise, is inserted. That doesn't seem to work for me (it always prints the *). What versions support it? I'm on 1.4.2.3i (FreeBSD ports version). I don't know--I've been out of the development loop for a while. I've used conditionals in my status_format for a long time, at least as far back as 1.4.2.2i. I think the %X sequence may be fairly recent, though, introduced in 1.5.something. I couldn't find anything about it in the changlog that came in the Ubuntu mutt package. I'm currently using 1.5.20 and this is the first time I've used %X in my index_format. Regards, Gary
Re: set different index_format for mails
* On 08 Nov 2011, Gary Johnson wrote: I don't know--I've been out of the development loop for a while. I've used conditionals in my status_format for a long time, at least as far back as 1.4.2.2i. I think the %X sequence may be fairly recent, though, introduced in 1.5.something. I couldn't find Introduced here: changeset: 4412:5a347f860ec3 branch: HEAD user:David Champion d...@uchicago.edu date:Tue Oct 04 06:05:39 2005 + summary: Attachment counting for index display (patch-1.5.11.dgc.attach.6). shell$ hg log -r 5a347f860ec3 --template='{latesttag}\n' mutt-1-5-11-rel That tells what was the most recent tag at the time of the revision in which %X was committed, so we conclude that it was first released in 1.5.12. shell$ hg log --template='{latesttag} {date|isodate}\n' -r mutt-1-5-12-rel -r mutt-1-4-2-3-rel -r mutt-1-4-rel mutt-1-5-12-rel 2006-07-14 18:20 + mutt-1-4-2-3-rel 2007-05-26 18:00 -0700 mutt-1-4-rel 2002-05-29 09:31 + Note that 1.4.2.3 is newer than 1.5.12. It's a stable branch, so it contains security/bugfix updates only, no feature backports. I would be genuinely surprised if someone measured reliability across many users and found that 1.5.21 is any less stable than 1.4.2.3. I run single mutt 1.5.21 processes literally for months at a stretch without exiting -- and I have a feature patch queue about 20 deep on top of HEAD. Mutt is far more stable (and performant, even with attachment counting) than any web browser I use. This is why nobody should be using 1.4, and why mutt should abandon the even/odd stable/development dichotomy. ;) -- David Champion • d...@uchicago.edu • IT Services • University of Chicago
Re: set different index_format for mails
= On [2011-11-08 12:03:50 -0500]: Ed Blackman Said: On Tue, Nov 08, 2011 at 02:13:05PM +0100, Gregor Zattler wrote: It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. Actually, it is. If you set index_format to a shell command that ends with a pipe, that Mutt will run that shell command for each message and use the output as the actual index_format. If you pass index_format expandos as arguments, Mutt will pass the expanded string. The shell command could then use that to emit different formats for different messages. For example, I have a script called format_date, and have this in .muttrc: set index_format=/path/to/format_date '%[%s]' '%%s' | This really is a good idea. I want to set index_format for different type mails like: new, deleted, replied, signed, encrypted ... But I do not know how to use those value like ~N ~R ~D ~g ~G etc. Do you know how to pass them to script ? The script emits a different date format for each message in the index depending on how old it is: ' 6:41pm' if less than a day, ' Thu 6pm' if more than a day but less than a week, ' Jan 20' if more than a week but less than 30 days, and '01/20/11' if more than 30 days. See http://marc.info/?l=mutt-usersm=129556814118983 and the thread that leads up to it. A different program could be written to examine the message flags in '%Z' instead of the time, and output different formats depending on those flags. The script in the message linked above could serve as a starting point, though the middle part where it's doing the date calculations would need to be replaced with flag comparisons. I don't have time to experiment with creating a full solution for the original poster, but hopefully this will point someone in the right direction. -- Ed Blackman -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature
Re: set different index_format for mails
= On [2011-11-08 09:13:27 -0800]: Gary Johnson Said: On 2011-11-08, Gregor Zattler wrote: Hi stardiviner, * stardiviner [08. Nov. 2011]: = On [2011-11-08 11:40:18 +0100]: * stardiviner [08. Nov. 2011]: Is there other way to set different *index_format* for mails ? index_format describes the format of your index which shows (normally) several emails at once while message-hook deals with individual emails. What should your index look like if there are different emails for which you want to have different index_formats? So it is impossible to set different index_format for messages ? It's not possible to change the index format for individual emails in the index but you can colour different email entries differently. You can also use conditional elements in index_format that will print different pieces of information depending on the values of other pieces of information. This is explained in the mutt manual in the Conditionals section. As an example, I have this string as part of my index_format. %?X?* ? Thanks, this is very useful, I forget it, I use it on other way, I forgot it. This can work. very good. If the number of attachments (X) is non-zero, * is inserted. Otherwise, is inserted. Regards, Gary -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature
set different index_format for mails
I try to set different *index_format* for maials. like this: message-hook ~g set index_format = ' A %H %C| +%N [%4Z] %-13L %s % %4c' # signed message-hook ~g set index_format = ' B %H %C| %N [%4Z] %-13L %s % %4c' # replied This does not work. But folder-hook can set different *index_format*. like this: folder-hook . set index_format = ' %H %C| [%4Z] %-13L » %s % %4c' folder-hook =INBOX set index_format = ' %H %C| %N [%4Z] %-13L %s % %4c' # for macro gi Is there other way to set different *index_format* for mails ? If you have good idea, please tell me, thanks very much. -- stardiviner GPG: 5D9F64D8 Twitter: @numbchild http://stardiviner.dyndns-blog.com/author.html signature.asc Description: Digital signature