unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Garreau, Alexandre" <galex-713@galex-713.eu>
Cc: emacs-devel@gnu.org
Subject: Re: emacs-lisp-mode highlights incorrectly defmacros/defuns’ arglists
Date: Tue, 16 Oct 2018 18:35:51 +0000	[thread overview]
Message-ID: <20181016183551.GB5722@ACM> (raw)
In-Reply-To: <87in21u6gu.fsf@portable.galex-713.eu>

Hello, Alexandre.

On Tue, Oct 16, 2018 at 19:49:53 +0200, Garreau, Alexandre wrote:
> At least *someone* must have *seen* this:
> #+BEGIN_SRC elisp
> (defmacro unless (cond &rest body)
>   "If COND yields nil, do BODY, else return nil.
> When COND yields nil, eval BODY forms sequentially and return
> value of last one, or nil if there are none.

> \(fn COND BODY...)"
>   (declare (indent 1) (debug t))
>   (cons 'if (cons cond (cons nil body))))
> #+END_SRC

> “cond” is highlighted in blue, while since defmacro (as well as defun,
> which present the same issue) is itself a macro, and the meaning of its
> arglist is known and fixed in lisp (a list of symbols, whose the first
> isn’t particularly meant to be called), why is cond highlighted just as
> if the arglist was a real form to be evaluated, while we know it’s not?

You surely are conscious of the fact that `cond' is a special form?  To
use it as an argument name is asking for trouble, surely.

The font locking in emacs-lisp-mode appears not to be too sophisticated.
But it is fast.

> Wouldn’t there be a way to turn off these highlightings in such places
> of known old and fixed macro calls?

There might well be, but it would slow fontification down, somewhat.  I
suspect that changing "cond" to something less contentious will get the
result you want.

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2018-10-16 18:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 17:49 emacs-lisp-mode highlights incorrectly defmacros/defuns’ arglists Garreau, Alexandre
2018-10-16 18:35 ` Alan Mackenzie [this message]
2018-10-16 19:22   ` Garreau, Alexandre
2018-10-16 20:10     ` Alan Mackenzie
2018-10-16 20:12   ` Garreau, Alexandre
2018-10-16 21:23 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20181016183551.GB5722@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=galex-713@galex-713.eu \
    /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 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).