unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Two more CC Mode bugs fixed.  For Emacs 26?
@ 2017-12-19 19:52 Alan Mackenzie
  2017-12-20 15:52 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2017-12-19 19:52 UTC (permalink / raw)
  To: emacs-devel; +Cc: John Ciolfi

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).



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-21 18:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-19 19:52 Two more CC Mode bugs fixed. For Emacs 26? Alan Mackenzie
2017-12-20 15:52 ` Eli Zaretskii
2017-12-20 17:56   ` Alan Mackenzie
2017-12-21 16:21     ` Eli Zaretskii
2017-12-21 18:15       ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).