Subject: bug#20096: 25.0.50; Add Font-Lock support for subr-x macros

From: Tassilo Horn <[email-masked]>
Date: Sun, 15 Mar 2015 09:25:38 +0100

Stefan Monnier <[email-masked]> writes:

>> but the attached patch uses a regexp defconst with a matcher
>> function for font-lock-keywords.
>
> Looks good.

Committed as 51e7e463e93708a0e40688f91200e9e9869ec662 on master.

>> +(defun lisp--el-update-after-load (_file)
>> +  "Update `lisp--el-macro-regexp' and adjust font-lock in existing buffers."
>> +  (lisp--el-update-macro-regexp)
>> +  (dolist (buf (buffer-list))
>> +    (when (derived-mode-p 'emacs-lisp-mode)
>> +      (font-lock-flush))))
>
> I think we should only flush if the set of macros has changed.

Ok, I'm doing that now.

> Other than that, the patch looks good.
> Have you tried it?

Yes, but not long enough.  Some non-important special forms such as `if'
and `progn' weren't highlighted anymore.  So now I consider both macros
and special forms.

> Does it work well in practice?

IMO, yes.  The difference is that there are some macros which haven't
been highlighted previously, e.g., `push'.

Bye,
Tassilo