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#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode) Date: 20 Apr 2016 08:27:53 -0000 Organization: muc.de e.V. Message-ID: <20160420082753.22176.qmail@mail.muc.de> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1461140906 16617 80.91.229.3 (20 Apr 2016 08:28:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Apr 2016 08:28:26 +0000 (UTC) Cc: 23308@debbugs.gnu.org To: Mohammed Sadik Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 20 10:28:15 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 1asnUd-0007jR-94 for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Apr 2016 10:28:15 +0200 Original-Received: from localhost ([::1]:45003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asnUc-0001b1-HC for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Apr 2016 04:28:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asnUV-0001H0-3r for bug-gnu-emacs@gnu.org; Wed, 20 Apr 2016 04:28:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asnUU-0006Ks-1U for bug-gnu-emacs@gnu.org; Wed, 20 Apr 2016 04:28:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asnUQ-0006KI-7h; Wed, 20 Apr 2016 04:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1asnUQ-0004K5-0H; Wed, 20 Apr 2016 04:28:02 -0400 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: Wed, 20 Apr 2016 08:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23308 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 23308-submit@debbugs.gnu.org id=B23308.146114087716606 (code B ref 23308); Wed, 20 Apr 2016 08:28:01 +0000 Original-Received: (at 23308) by debbugs.gnu.org; 20 Apr 2016 08:27:57 +0000 Original-Received: from localhost ([127.0.0.1]:40981 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1asnUK-0004Jm-U4 for submit@debbugs.gnu.org; Wed, 20 Apr 2016 04:27:57 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:60072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1asnUJ-0004Je-5x for 23308@debbugs.gnu.org; Wed, 20 Apr 2016 04:27:55 -0400 Original-Received: (qmail 22177 invoked by uid 3782); 20 Apr 2016 08:27:53 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64)) 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" Xref: news.gmane.org gmane.emacs.bugs:116624 Archived-At: Hello, Mohammed. In article you wrote: > In c-mode (may be in other modes too), lines like #include > sometimes break (nth 0 (syntax-ppss)), the depth of brackets. This > happens because angle brackets ('<' and '>') in #include lines are > considered to be brackets (which is true) in emacs 25.0.92, but not > in emacs 24.5, where syntax-ppss doesn't break. Yes, indeed. Thanks for taking the trouble to report this bug, and thanks even more for distilling the problem down to a small, easy to work with test case. > How to reproduce: > open a new c file: emacs -Q test.c > Type the following in the file (where | is the point): > #include <> > int > main (void) > { > | > } > Now move between the angle brackets (| is the point): > #include <|> > ... > Now type some header names: > #include > ... > Now check the first value of (syntax-ppss). It is zero. > Now move to some other point (don't press RET). Check the value of > syntax-ppss. > The value is negative when outside of any paren, This was actually quite tricky to track down. It was caused by an erroneous fix to a bug in 2010, which has since been properly fixed by other means. > In GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9) > of 2016-04-13 built on fedora.localdomain > Windowing system distributor 'Fedora Project', version 11.0.11800000 > Configured features: > XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS > LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Would you please try out the following patch, and let me know whether it fixes the bug completely, and if not, what problems still remain. (cc-engine.el is in directory .../emacs/lisp/progmodes.) Thanks! diff -r cf78a1fa7d43 cc-engine.el --- a/cc-engine.el Sat Apr 02 17:35:03 2016 +0000 +++ b/cc-engine.el Wed Apr 20 08:14:02 2016 +0000 @@ -3443,7 +3443,7 @@ (< c-state-old-cpp-beg here)) (c-with-all-but-one-cpps-commented-out c-state-old-cpp-beg - (min c-state-old-cpp-end here) + c-state-old-cpp-end (c-invalidate-state-cache-1 here)) (c-with-cpps-commented-out (c-invalidate-state-cache-1 here)))) -- Alan Mackenzie (Nuremberg, Germany).