emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-lisp-mode highlights incorrectly defmacros/defuns’ arglists


From: Alan Mackenzie
Subject: Re: emacs-lisp-mode highlights incorrectly defmacros/defuns’ arglists
Date: Tue, 16 Oct 2018 18:35:51 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

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 via email to

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