[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mo
From: |
Alan Mackenzie |
Subject: |
bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode) |
Date: |
20 Apr 2016 08:27:53 -0000 |
User-agent: |
tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64)) |
Hello, Mohammed.
In article <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org> you wrote:
> In c-mode (may be in other modes too), lines like #include <stdio.h>
> 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 <stdio.h|>
> ...
> 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).