<<< Date Index >>>     <<< Thread Index >>>

Re: mutt/2402: damaged regexps in folder-hooks



The following reply was made to PR mutt/2402; it has been noted by GNATS.

From: Rocco Rutte <pdmef@xxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc: 
Subject: Re: mutt/2402: damaged regexps in folder-hooks
Date: Fri, 4 Aug 2006 09:11:54 +0000

 Hi,
 
 * Alain Bench [06-08-04 10:55:02 +0200] wrote:
 
 >     At last! Found *the* working syntax. Tadaa!
 
 > | folder-hook (^ABC$) yaddahyaddah
 
 >     This expands to self:
 
 > | Status of commands:
 
 > | folder-hook
 > |   (^ABC$)
 > |     yaddahyaddah
 
 >     ...and regexec seems to like it. No problem for negation:
 
 > | folder-hook !(^ABC$) yaddahyaddah
 
 >     ...expands to:
 
 > | folder-hook
 > |   !( (^ABC$) )
 > |     yaddahyaddah
 
 >     ...and works as expected. So it's maybe just a matter of documenting
 > it. Something like: "To prevent the expansion of mailbox shortcut
 > characters that you would want to use as special characters in the
 > regexp, enclose the whole regexp in parenthesis. Example: If you want to
 > match ^regexp$ exactly, without the default automagic expansion of "^"
 > shortcut to the full name of the current folder, then use (^regexp$) as
 > pattern. This is needed only for folder-hook patterns, the only ones to
 > first endure folder expansion, and then pursue a regexp career."
 
 This would be the cheapest way to fix the bug, I guess. However, I think 
 when using:
 
    folder-hook ^foo
 
 most people expect this to be a perfectly valid regexp (since the usage 
 for folder-hook mentions regex). The minority (if at all), expects this 
 to expand to the current folder.
 
 So we should honor this by making the people's life harder who use the 
 shortcut, and keep it as-is for the regex users.
 
    bye, Rocco
 -- 
 :wq!