GNU bug report logs - #42805
27.1; cc-mode/syntax/font-lock bug

Previous Next

Package: emacs;

Reported by: Gustavo Tavares Cabral <gustavotcabral <at> gmail.com>

Date: Mon, 10 Aug 2020 19:56:02 UTC

Severity: normal

Found in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 42805 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>,
 Gustavo Tavares Cabral <gustavotcabral <at> gmail.com>
Cc: 42805 <at> debbugs.gnu.org
Subject: Re: 27.1; cc-mode/syntax/font-lock bug
Date: Mon, 23 Nov 2020 18:57:18 +0000
Hello, Gustavo and Eli.

On Mon, Nov 23, 2020 at 19:10:11 +0200, Eli Zaretskii wrote:
> > From: Gustavo Tavares Cabral <gustavotcabral <at> gmail.com>
> > Date: Mon, 10 Aug 2020 16:55:40 -0300
> > Cc: bug-cc-mode <at> gnu.org

> > I have found two related issues. Both are evident in csharp-mode, but 
> > can easily be reproduced in c-mode. 

I'll answer the second issue now (which is easy) and hopefully get round
to the first one soon.

> > Issue 1 (cc-mode.el): 

[ .... ]

> > Issue 2 (maybe syntax.el): 

> >   When syntax-propertize-function is set (to '(lambda (beg end) nil)', 
> >   for example), a similar problem occurs if electric-pair-mode (or even 
> >   smartparens) is enabled. The symptoms started after commit 585fb95739,
> >   but I don't know if it is related.

> >   Steps to reproduce: 
> >     1. Open a .c file; 
> >     2. Eval '(setq syntax-propertize-function (lambda (beg end) nil)'; 
> >     3. Enable electric-pair-mode; 
> >     4. Insert/delete empty strings.

This is simple.  syntax-propertize-function is utterly incompatible with
CC Mode, and _will_ foul it up.  To quote from the Emacs Lisp manual
(recently added text):

     *Caution:* When this variable is non-`nil', Emacs removes
     `syntax-table' text properties arbitrarily and relies on
     `syntax-propertize-function' to reapply them.  Thus if this
     facility is used at all, the function must apply *all*
     `syntax-table' text properties used by the major mode.  In
     particular, Modes derived from a CC Mode mode must not use this
     variable, since CC Mode uses other means to apply and remove these
     text properties.

> Alan, could you please take a look?  Would it be possible to fix this
> for Emacs 27.2?

I hope so.  Are there any firm plans for a release date, yet?

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 3 years and 272 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.