Re: using printf-style sequences with mbox-hook
On 14-Jan-2002 08:54 Michael Elkins wrote: | mbox-hook was never intended to work on the per-message level, so just | adding the percent sequences won't help you get the resolution you want. | There is currently no way to bulk move messages to different mailboxes. | even when doing a tag-save. Maybe it wasn't intended, but it wasn't that hard to do. I do get the resolution I want; you really can't use mutt_make_string() (which I chose to (re)use) without having headers anyway. The added complexity is really insignificant. We're basically doing the mx_close_mailbox() for each distinct mailbox (after walking the msg list), except it's all done within mx_close_mailbox(). It's worth it to construct the list of mailboxes so we do our IMAP handling slightly more efficiently. A more significant code change would make it even more efficient, but it's a bigger trade-off. I'm certain I could do the tag-save the same way, but I didn't have a need for it. Others might. -- -Dale
Re: using printf-style sequences with mbox-hook
mbox-hook was never intended to work on the per-message level, so just adding the percent sequences won't help you get the resolution you want. There is currently no way to bulk move messages to different mailboxes. even when doing a tag-save. me On Sun, Jan 13, 2002 at 07:33:50PM -0500, Dale Woolridge wrote: > Even if you could defer them, they would only be resolved when you closed > the mailbox. Cases would still exist where the behaviour I want is not > exhibited. For example, if I'm reading messages that have arrived shortly > before midnight on 31 January and additional messages arrive after > midnight, then closing the mailbox would result in messages stored based > on the 1 February date. This example assumes you want to store messages > in folders where the smallest unit of time is month. Smaller units of > time will increase the likelihood of temporal boundary issues.
Re: using printf-style sequences with mbox-hook
Dale -- ...and then Dale Woolridge said... % % On 13-Jan-2002 18:49 David T-G wrote: % | % | I take it you want to be sure that the dates are accurate and not from % | startup, right? This is a common problem for headers and such (good old % | uptime) and the answer is usually to put the parsed half in single quotes % | to prevent mutt from executing the innards until the hook is called. % | I should think that that would work for you, too, and would be a lot % | easier to maintain than your patch. Of course, it's not as cool... :-) % % Yes, I do keep mutt running for days at a time. Based on my perusal Same here -- my mutt start time (on each of my six standard mutt processes!) is typically a few minutes after boot time :-) ... % Okay, that was a long-winded way of disagreeing with your suggestion. The % short one goes like this: I'm very confident that the mbox-hook command % won't allow back tick deferrals by quoting them as you propose. Good enough. I haven't done the research, but wanted to make sure you had all of the ideas available. % % That being said, printf-style sequences might be useful for more than Right. And they're much cooler than just '`command`' quoting! % solving my trivial problems. Of course, other than perhaps message % score, I really can't think of any other uses, but at least my problem % is solved. ;) Right :-) % -- % -Dale :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg23081/pgp0.pgp Description: PGP signature
Re: using printf-style sequences with mbox-hook
On 13-Jan-2002 18:49 David T-G wrote: | | I take it you want to be sure that the dates are accurate and not from | startup, right? This is a common problem for headers and such (good old | uptime) and the answer is usually to put the parsed half in single quotes | to prevent mutt from executing the innards until the hook is called. | I should think that that would work for you, too, and would be a lot | easier to maintain than your patch. Of course, it's not as cool... :-) Yes, I do keep mutt running for days at a time. Based on my perusal of the code, the mbox-hook hooks are "loaded" once at run-time, and ``-enclosed strings/commands are executed at that time. What you propose is quoting these ``-enclosed strings/commands in the hopes of deferring their execution to when they are resolved (through use). This _might_ be true for other hooks -- and I think it is for {folder,message,account}-hook -- but mx_close_mailbox() does not treat the hook entry this way; it is expanded as a path and doesn't allow any back tick tricks. Even if you could defer them, they would only be resolved when you closed the mailbox. Cases would still exist where the behaviour I want is not exhibited. For example, if I'm reading messages that have arrived shortly before midnight on 31 January and additional messages arrive after midnight, then closing the mailbox would result in messages stored based on the 1 February date. This example assumes you want to store messages in folders where the smallest unit of time is month. Smaller units of time will increase the likelihood of temporal boundary issues. Okay, that was a long-winded way of disagreeing with your suggestion. The short one goes like this: I'm very confident that the mbox-hook command won't allow back tick deferrals by quoting them as you propose. That being said, printf-style sequences might be useful for more than solving my trivial problems. Of course, other than perhaps message score, I really can't think of any other uses, but at least my problem is solved. ;) -- -Dale
Re: using printf-style sequences with mbox-hook
Dale -- ...and then Dale Woolridge said... % % I've created a patch which allows the use of printf-style sequences % in the mailbox parameter of the mbox-hook command. My motivation for Interesting! ... % Mostly I didn't like the few other options I considered: restarting mutt; % using source to process the hook(s) again; or creating a macro to recreate I take it you want to be sure that the dates are accurate and not from startup, right? This is a common problem for headers and such (good old uptime) and the answer is usually to put the parsed half in single quotes to prevent mutt from executing the innards until the hook is called. I should think that that would work for you, too, and would be a lot easier to maintain than your patch. Of course, it's not as cool... :-) HTH & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg23076/pgp0.pgp Description: PGP signature
using printf-style sequences with mbox-hook
I've created a patch which allows the use of printf-style sequences in the mailbox parameter of the mbox-hook command. My motivation for this patch was to store/archive my mailing list messages to folders based on date. I already had an fcc-save-hook like this: fcc-save-hook '~C mutt-users.*@mutt.org$' +lists.d/mutt/users/%<%Y/%b> and my old mbox-hook was: mbox-hook '+lists.d/mutt/users/incoming' +lists.d/mutt/users/`date +%Y/%b` but now I can do this: mbox-hook '+lists.d/mutt/users/incoming' +lists.d/mutt/users/%[%Y/%b] Mostly I didn't like the few other options I considered: restarting mutt; using source to process the hook(s) again; or creating a macro to recreate the mbox-hook. Knowing I wouldn't always remember to do any of these, I modified mbox-hook to allow the printf-style sequences as supported in fcc-save-hook. Perhaps someone else will find this patch useful too. You can find it at http://www.woolridge.org/mutt/ -- -Dale