From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Unquoted special characters in regexps Date: Thu, 02 Mar 2006 19:40:08 +0100 Message-ID: <44073C08.1070903@gmx.at> References: <4400AD8E.5050001@gmx.at> <4400BBB1.2050800@gmx.at> <200602252213.k1PMDBP24413@raven.dms.auburn.edu> <4401A98D.3070809@gmx.at> <4401E0F2.7030800@gmx.at> <4401FCBA.1070206@gmx.at> <200602280030.k1S0UDE07149@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1141410651 1659 80.91.229.2 (3 Mar 2006 18:30:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2006 18:30:51 +0000 (UTC) Cc: schwab@suse.de, Luc Teirlinck , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 03 19:30:49 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FFF33-0002qK-Af for ged-emacs-devel@m.gmane.org; Fri, 03 Mar 2006 19:30:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FFF31-0003lQ-P7 for ged-emacs-devel@m.gmane.org; Fri, 03 Mar 2006 13:30:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FEsnJ-0001x5-G8 for emacs-devel@gnu.org; Thu, 02 Mar 2006 13:44:57 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FEsnG-0001wh-9q for emacs-devel@gnu.org; Thu, 02 Mar 2006 13:44:55 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FEsnE-0001wc-TC for emacs-devel@gnu.org; Thu, 02 Mar 2006 13:44:53 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1FEsol-00065X-Rz for emacs-devel@gnu.org; Thu, 02 Mar 2006 13:46:28 -0500 Original-Received: (qmail invoked by alias); 02 Mar 2006 18:44:50 -0000 Original-Received: from N904P028.adsl.highway.telekom.at (EHLO [62.47.56.252]) [62.47.56.252] by mail.gmx.net (mp034) with SMTP; 02 Mar 2006 19:44:50 +0100 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: rms@gnu.org In-Reply-To: X-Y-GMX-Trusted: 0 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51080 Archived-At: > First of all, there are (surprisingly) many occurrences of "\\]" in > the Emacs source, where the `]' _is_ special and closes a character > alternative that contains a slash. > > That is a good point. We don't want people to get confused about that. There are very few expressions where `\\' does have to precede a right bracket, `[^\\]', `[]\\]', and `[^]\\]' come to mind. I any other case people may avoid confusion by moving the backslash in front of another character. In current Emacs code there are some 100 occurrencs where programmers were able to convey the intention that they indeed wanted to match a right bracket by writing `\\]'. Simultaneously, programmers were able to express that they did _not_ want a character alternative to end here. Your change will make it difficult if not impossible to express such intentions. And, your change is motivated by the pessimistic assumption that people frequently submit code with buggy regexps. Even if that were the case your change would hardly help. Consider the following expression from `gud-jdb-marker-filter': "\\(\[[0-9]+\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9.,]+\\)" Experience tells me that this should be probably written as "\\(\\[[0-9]+\\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9.,]+\\)" but I'm not quite sure since `gud.el' is one of the few Emacs files that do not consistently use `\\]' to match a right bracket.