From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#5560: 23.1.92; parens matching in c-mode broken Date: Mon, 22 Feb 2016 10:35:55 +0000 Message-ID: <20160222103555.GA1984@acm.fritz.box> References: <4B60ED87-9CF5-464A-AE3F-C948ADB1C4D2@gmail.com> <20160220225723.GA10801@acm.fritz.box> <20160221123539.GA2220@acm.fritz.box> <00B53025-4477-4BBC-961A-0B8DF4234C19@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1456137277 29516 80.91.229.3 (22 Feb 2016 10:34:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 10:34:37 +0000 (UTC) Cc: Andrew Hyatt , 5560@debbugs.gnu.org To: David Reitter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 22 11:34:22 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXnoo-0007mG-3A for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Feb 2016 11:34:18 +0100 Original-Received: from localhost ([::1]:48325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXnoh-0003cm-UJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Feb 2016 05:34:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXnoe-0003ce-64 for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2016 05:34:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXnod-00086l-1t for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2016 05:34:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXnoY-000869-E9; Mon, 22 Feb 2016 05:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aXnoY-000188-6s; Mon, 22 Feb 2016 05:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 22 Feb 2016 10:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5560 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 5560-submit@debbugs.gnu.org id=B5560.14561372124303 (code B ref 5560); Mon, 22 Feb 2016 10:34:02 +0000 Original-Received: (at 5560) by debbugs.gnu.org; 22 Feb 2016 10:33:32 +0000 Original-Received: from localhost ([127.0.0.1]:36848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXno4-00017L-Jo for submit@debbugs.gnu.org; Mon, 22 Feb 2016 05:33:32 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:58314) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXno2-00017C-PN for 5560@debbugs.gnu.org; Mon, 22 Feb 2016 05:33:31 -0500 Original-Received: (qmail 11297 invoked by uid 3782); 22 Feb 2016 10:33:29 -0000 Original-Received: from acm.muc.de (p548A53D7.dip0.t-ipconnect.de [84.138.83.215]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 22 Feb 2016 11:33:27 +0100 Original-Received: (qmail 2633 invoked by uid 1000); 22 Feb 2016 10:35:55 -0000 Content-Disposition: inline In-Reply-To: <00B53025-4477-4BBC-961A-0B8DF4234C19@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113446 Archived-At: Hello, David. On Sun, Feb 21, 2016 at 04:40:09PM -0500, David Reitter wrote: > Alan, > Your patch works as advertised for my test case. It’s certainly > better to error out than to do the wrong thing. > I think you are catching the right situations, but my confidence is > low because of the readability of the code (what is 4, 5?). 4 and 5 are the low level codes for "open paren" and "close paren" syntax. I don't like them much either, but `syntax-after' is the only interface available which returns the syntax of a character in a buffer, taking account of syntax-table text properties. 4 and 5 (or, more precisely, (4 . ?\)), (5 . ?\()) are what we have to work with. One way would be to create two constants with fancy names with values 4 and 5, but I don't think that helps much - anybody debugging and suspicious of the values still has to find the page in the elisp manual to check, but has an extra irritating indirection to cope with. How would you feel about explanatory comments on the two lines - something like: + (if (/= (car (syntax-after start)) 4) ; low-level code for ?\( ? What we really need is a better interface. Perhaps `char-syntax-after', which would actually return ?\( and ?\). In fact, I think I'll raise a bug report for this. > I think the question is whether that fix is appropriate for the 25.1 > release. If you want to apply it there, I would probably test a whole > lot of cases in modes that are derivates of c-mode. I think the fix should go into 25.1. I'm confident enough about the mechanism of the bug that I'm not sure extensive testing is warranted. > - David -- Alan Mackenzie (Nuremberg, Germany).