bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43265: [External] : bug#43265: 28.0.50; Inconsistent fontifying in e


From: Drew Adams
Subject: bug#43265: [External] : bug#43265: 28.0.50; Inconsistent fontifying in elisp-mode
Date: Mon, 25 Jan 2021 16:01:23 +0000

> >> (setq a '(if a b))   is currently fontified incorrectly, while
> >> (setq a '(when a b)) is fontified correctly.
> >
> > Really?  Are you sure one is correct and the other not,
> > and that you have it the right way round?
> >
> >  (setq a '(setq b d))
> >  (setq a '(if a b))
> >  (setq a '(when a b))
> >  (setq a '(and a b))
> >
> > Nowadays, all of those `setq's, the `if', and the `and'
> > are highlighted; poor-boy `when' isn't. :-(
> 
> All but `when' are special forms, so Lars is right that the distinction
> is between special forms vs. macros.

That may be the distinction now, but the behavior has
changed over time.

The real question about that distinction should be
whether it's helpful/useful for users?  Typically
for Lisp whether a special form is implemented at
a lower-than-Lisp level or as a macro or in some
other way is only an implementation detail.

What's most helpful, for a user, in terms of
font-lock?  I'm guessing that the aim behind this
distinguishing special forms from macros by
highlighting is really aimed at distinguishing
user-defined macros from predefined macros.

To me, as one user, highlighting predefined
macros the same as special forms makes sense.
But so does highlighting all macros differently
from functions and special forms.  To me, it's
not so helpful to not highlight macros at all.

> > But is it really "correct" to fontify _any_ of the names
> > in those quoted sexps as if they were being used with
> > their active meanings - as code?  In that context they're
> > just data - list elements.
> 
> Yeah, the special forms should probably not be highlighted here.

That was my main point, yes.  To do that correctly
in the general case is maybe hard (when is something
"used" as a function/macro/special-form?).  But a
first approximation should be pretty easy and helpful.

Users can be helped by not highlighting such things
when quoted (e.g. in quoted lists).  Highlighting
them in such contexts is misleading.  That's the main
highlighting change I'd like to see made.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]