[ESS-bugs] ess-mode 5.3.0; comint-prompt-regexp follow-up

tyler tyler.smith at mail.mcgill.ca
Mon Dec 10 21:40:04 CET 2007


On Mon, Dec 10, 2007 at 04:30:05PM +0100, Martin Maechler wrote:
> 
>     t> This is a follow up to a previous message. Since I can't
>     t> subscribe to the mailing list, there appears to be no way
>     t> of replying to a particular message.
> 
> well, you could (and should) have replied to Tony's answer which *was* CC'ed
> to you...

My apologies. I couldn't reply to Tony's first message as it didn't
get to me, due to a config problem at my end.

>     t> I don't know if it makes any differences to the efficiency of the
>     t> regexp, but as far as I can tell the outermost grouping is not used,
>     t> so the regexp could be reduced to
> 
>     t> "^\\([A-Z][][A-Za-z0-9.]*\\)?> \\|+ ?"
> 
> Are you sure?  Would this really match "^+ ?" as well ?
> I'd rather keep that part just for clarity.

After checking with the (emacs)Regexp Backslash and doing some
experimenting, I am. \( \) constructions are only necessary if you want
to limit the groupings that \| considers. The default is to use the
entire previous (or following) expression. From the manual:

     `\|' applies to the largest possible surrounding expressions.
     Only a surrounding `\( ... \)' grouping can limit the grouping
     power of `\|'.

After very limited testing I don't detect any speed difference with or
without the outermost \\( \\), so in the end I guess it's a matter of
taste.

Thanks!

Tyler

-- 
There is something fascinating about science. One gets such wholesale 
returns of conjecture out of such a trifling investment of fact.
                                       --Mark Twain



More information about the ESS-bugs mailing list