From: Alan Mackenzie <acm@muc.de>
To: Mohammed Sadik <sadiq@sadiqpk.org>
Cc: 23308@debbugs.gnu.org
Subject: bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode)
Date: 20 Apr 2016 08:27:53 -0000 [thread overview]
Message-ID: <20160420082753.22176.qmail@mail.muc.de> (raw)
In-Reply-To: <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org>
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).
next prev parent reply other threads:[~2016-04-20 8:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 15:52 bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode) Mohammed Sadik
[not found] ` <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org>
2016-04-20 8:27 ` Alan Mackenzie [this message]
2016-04-20 12:47 ` Mohammed Sadik
[not found] ` <CANHUxH0Y8VdSemySSQ3Kx=cmSVKGz6=PPifCPQJzPd_fhrxtow@mail.gmail.com>
2016-04-29 14:42 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160420082753.22176.qmail@mail.muc.de \
--to=acm@muc.de \
--cc=23308@debbugs.gnu.org \
--cc=sadiq@sadiqpk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.