GNU bug report logs - #51574
27.2; Bad Lisp font-locking with `font-lock-type-face'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Tue, 2 Nov 2021 22:29:02 UTC

Severity: minor

Found in version 27.2

Fixed in version 29.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51574 in the body.
You can then email your comments to 51574 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51574; Package emacs. (Tue, 02 Nov 2021 22:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 02 Nov 2021 22:29:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 27.2; Bad Lisp font-locking with `font-lock-type-face'
Date: Tue, 2 Nov 2021 22:28:41 +0000
This regression was introduced in Emacs 25 (no problem before then).

emacs -Q

In buffer *scratch* type this Lisp code:

(car `(foo\ &bar toto))
(car `(foo\&bar toto))
(car `(foo&bar toto))

The first sexp evaluates to the symbol `foo &bar'.  The second and third
evaluate to the symbol `foo&bar'.  The first `\' escapes the SPC char.
The second `\' does nothing (a noop) - it escapes a char that doesn't
need escaping for it to be included in a Lisp symbol name.

But Emacs Lisp font-locking incorrectly gives the `&bar' part of each of
those symbols the face `font-lock-type-face'.  It doesn't correctly
recognize symbol syntax.

There should be no reason to determine that `&bar' represents part of a
type or class name, in any such context.

The bug is in variable `lisp-el-font-lock-keywords-2'.

BTW, the doc string of face `font-lock-type-face' should also be fixed,
to say either "type and class" or "types and classes", not this:

  Font Lock mode face used to highlight type and classes.

In GNU Emacs 27.2 (build 1, x86_64-w64-mingw32)
 of 2021-03-26 built on CIRROCUMULUS
Repository revision: deef5efafb70f4b171265b896505b92b6eef24e6
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1288)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51574; Package emacs. (Thu, 04 Nov 2021 18:30:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51574 <at> debbugs.gnu.org
Subject: Re: bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
Date: Thu, 04 Nov 2021 19:29:28 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

> BTW, the doc string of face `font-lock-type-face' should also be fixed,
> to say either "type and class" or "types and classes", not this:
>
>   Font Lock mode face used to highlight type and classes.

I've now fixed this on the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51574; Package emacs. (Thu, 04 Nov 2021 18:31:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51574 <at> debbugs.gnu.org
Subject: Re: bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
Date: Thu, 04 Nov 2021 19:30:31 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

> The bug is in variable `lisp-el-font-lock-keywords-2'.

I guess it's this bit:

         ;; ELisp and CLisp `&' keywords as types.
         (,(concat "\\_<&" lisp-mode-symbol-regexp "\\_>")
          . font-lock-type-face)

Anybody have a suggestion here for a fix?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51574; Package emacs. (Tue, 20 Sep 2022 11:35:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51574 <at> debbugs.gnu.org
Subject: Re: bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
Date: Tue, 20 Sep 2022 13:34:25 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I guess it's this bit:
>
>          ;; ELisp and CLisp `&' keywords as types.
>          (,(concat "\\_<&" lisp-mode-symbol-regexp "\\_>")
>           . font-lock-type-face)
>
> Anybody have a suggestion here for a fix?

I've now fixed this for "foo\ &bar" and "foo\ :bar" (and other white
space).  I have not fixed "foo\&bar", because people shouldn't write
that and fontifying it "wrong" is fine.




bug marked as fixed in version 29.1, send any further explanations to 51574 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 20 Sep 2022 11:35:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 19 Oct 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 189 days ago.

Previous Next


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