all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Lars Ingebrigtsen <larsi@gnus.org>, Eli Zaretskii <eliz@gnu.org>
Cc: "43265@debbugs.gnu.org" <43265@debbugs.gnu.org>,
	"maurooaranda@gmail.com" <maurooaranda@gmail.com>,
	"monnier@iro.umontreal.ca" <monnier@iro.umontreal.ca>,
	"tsdh@gnu.org" <tsdh@gnu.org>
Subject: bug#43265: [External] : bug#43265: 28.0.50; Inconsistent fontifying in elisp-mode
Date: Sun, 24 Jan 2021 21:58:34 +0000	[thread overview]
Message-ID: <SA2PR10MB447488AD516666F6F38C9862F3BE9@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87y2gioztq.fsf@gnus.org>

Oh boy - font-lock bikeshedding!

> Skimming that thread, I can't see any explanation for why we don't check
> that special forms are in a function position, while we do that for
> macros? I.e.,
> 
> (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. :-(
___

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.

It was Emacs 25 that started highlighting all of those
`setq's, and `and'.  Up through Emacs 24, `setq' and
`and' weren't highlighted anywhere - and both `if' and
`when' were highlighted (everywhere).

Emacs 25 made `when' a special case (unhighlighted), and
it made `setq' and `and' unspecial (highlighted).  That
new behavior is no more "correct" than what it replaced.

If any highlightings could be considered more correct
than others, I'd think a more correct one would _at
least_ not highlight function/macro/special-form names
when used as elements of a list (i.e. quoted) or as
plain-quoted atoms.

Consider:

 (defun foo (x y) 42) ; or (defmacro foo (x y) 42)
 (setq a '(foo a b))
 (setq a '(if a b))

`foo' in the quoted list isn't highlighted; `if' is.
Why?


In sum:

1. We're not very consistent (before or since Emacs 25).

2. The behavior's changed over time: sometimes to add
highlighting (`setq', `and'), sometimes to remove it
(`when').  Why?  Maybe (or maybe not) there were some
good reasons.  In any case, for a _user_ things are not
so clear.

3. IMO, it could make sense to not highlight such names
when they're not syntactically seen as being _used_ as
function/macro/special-form, but are instead seen as
data (e.g. quoted).

(When the use isn't obvious, pick a direction to err on,
and be relatively consistent about it.)

Now the question becomes, What constitutes "use" as a
function/macro/special-form?  Plain-quoting doesn't,
IMO; but what about #'?

How many angels fit on the head of a pin?  (Depends on
the angels and the pin.)





  reply	other threads:[~2021-01-24 21:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 20:05 bug#43265: 28.0.50; Inconsistent fontifying in elisp-mode Mauro Aranda
2021-01-22 19:32 ` Lars Ingebrigtsen
2021-01-22 20:11   ` Mauro Aranda
2021-01-22 22:32   ` Stefan Monnier
2021-01-23 18:42     ` Lars Ingebrigtsen
2021-01-23 19:54       ` Stefan Monnier
2021-01-24 19:58         ` Lars Ingebrigtsen
2021-01-24 19:59           ` Lars Ingebrigtsen
2021-01-24 20:09           ` Eli Zaretskii
2021-01-24 20:16             ` Lars Ingebrigtsen
2021-01-24 21:58               ` Drew Adams [this message]
2021-01-25  6:30                 ` bug#43265: [External] : " Tassilo Horn
2021-01-25  6:39                   ` Lars Ingebrigtsen
2021-01-25  6:46                     ` Tassilo Horn
2021-01-25 13:59                       ` Stefan Monnier
2021-01-25 23:34                         ` Lars Ingebrigtsen
2021-01-25 16:09                       ` Drew Adams
2021-01-25 16:14                         ` Drew Adams
2021-01-25 16:01                   ` Drew Adams
2021-01-24 21:25           ` Stefan Monnier
2021-01-26  0:19 ` Lars Ingebrigtsen
2021-01-26  0:27   ` Mauro Aranda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR10MB447488AD516666F6F38C9862F3BE9@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=43265@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=maurooaranda@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.