unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
@ 2021-11-02 22:28 Drew Adams
  2021-11-04 18:29 ` Lars Ingebrigtsen
  2021-11-04 18:30 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Drew Adams @ 2021-11-02 22:28 UTC (permalink / raw)
  To: 51574

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)






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

* bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
  2021-11-02 22:28 bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face' Drew Adams
@ 2021-11-04 18:29 ` Lars Ingebrigtsen
  2021-11-04 18:30 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-04 18:29 UTC (permalink / raw)
  To: Drew Adams; +Cc: 51574

Drew Adams <drew.adams@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





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

* bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
  2021-11-02 22:28 bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face' Drew Adams
  2021-11-04 18:29 ` Lars Ingebrigtsen
@ 2021-11-04 18:30 ` Lars Ingebrigtsen
  2022-09-20 11:34   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-04 18:30 UTC (permalink / raw)
  To: Drew Adams; +Cc: 51574

Drew Adams <drew.adams@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





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

* bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face'
  2021-11-04 18:30 ` Lars Ingebrigtsen
@ 2022-09-20 11:34   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-20 11:34 UTC (permalink / raw)
  To: Drew Adams; +Cc: 51574

Lars Ingebrigtsen <larsi@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.





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

end of thread, other threads:[~2022-09-20 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 22:28 bug#51574: 27.2; Bad Lisp font-locking with `font-lock-type-face' Drew Adams
2021-11-04 18:29 ` Lars Ingebrigtsen
2021-11-04 18:30 ` Lars Ingebrigtsen
2022-09-20 11:34   ` Lars Ingebrigtsen

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