all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Cc: John Ciolfi <John.Ciolfi@mathworks.com>
Subject: Two more CC Mode bugs fixed.  For Emacs 26?
Date: Tue, 19 Dec 2017 19:52:05 +0000	[thread overview]
Message-ID: <20171219195205.GA31877@ACM> (raw)

Hello, Emacs.

Thanks to John Ciolfi for reporting the following two bugs, which are
now fixed in standalone CC Mode:

1/-

In

    #include "b.hpp"//Comment

, the fontification goes haywire.  This is triggered by the lack of a
space between the second " and //.

The mechanism is an attempted optimisation in the "state cache" whereby
'category text properties are placed around the CPP construct not
including the comment.  Since there's no character between the CPP
construct and the comment, there's nowhere to put this text property, so
things go wrong.

The solution is to remove this "optimisation" entirely.  It didn't
really make much difference to CC Mode's run time anyway.

2/-

In a section of comment where doc comments should start, the doc comment
sometimes doesn't get fontified as such, e.g., when CC Mode is set up
for doxygen comments:

    // Function: foo
    /**
     *    Comment line 1 foo foo foo foo foo foo foo foo foo @b one
     *    Comment line 2 foo foo foo foo foo foo foo foo foo foo foo foo
     *    foo foo foo foo foo foo foo

, the lines from that starting with "/**" ought to get c-doc-face, but
don't.

The mechanism here is again a lack of a space.  c-font-lock-doc-comments
is trying to check whether the "/**" is itself within a comment or
string, and does so by testing the face of the character immediately
before.  This is the newline after "foo", which has comment-face, so the
function assumes that "/**" is inside a comment and fails to do the
right thing.

The solution is to check rigorously whether the "/**" is inside a
comment.  This is no problem now that processor cycles are a deal more
plentiful than when this code was originally written.

#########################################################################

I'd like to commit these two fixes to the release branch.  1/- because
it is relatively important, and 2/- because it is cheap and very low
risk.

What do people, Eli and others, say?

-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2017-12-19 19:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 19:52 Alan Mackenzie [this message]
2017-12-20 15:52 ` Two more CC Mode bugs fixed. For Emacs 26? Eli Zaretskii
2017-12-20 17:56   ` Alan Mackenzie
2017-12-21 16:21     ` Eli Zaretskii
2017-12-21 18:15       ` 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=20171219195205.GA31877@ACM \
    --to=acm@muc.de \
    --cc=John.Ciolfi@mathworks.com \
    --cc=emacs-devel@gnu.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.