[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20096: 25.0.50; Add Font-Lock support for subr-x macros
From: |
Stefan Monnier |
Subject: |
bug#20096: 25.0.50; Add Font-Lock support for subr-x macros |
Date: |
Sat, 14 Mar 2015 09:56:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
>> Instead, The Right Thing to do, might be to change elisp-mode's
>> font-lock rules so they check obarray for macros (i.e. use mapatoms +
>> regexp-opt to generate a regexp matching all macros, and probably
>> update it from after-load-functions)?
> I don't understant what you mean with generating a macro matching all
> macros,
That's because I said "generate a regexp matching all macros", as you
can clearly see in the excerpt you quoted (see above).
> but the attached patch uses a regexp defconst with a matcher
> function for font-lock-keywords.
Looks good.
> +(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.
Other than that, the patch looks good.
Have you tried it? Does it work well in practice?
Stefan