mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 22:41:06 -08:00
Improve dynamic elisp keyword font-locking
* emacs-lisp/byte-run.el (macro-declarations-alist): New declaration no-font-lock-keyword. (defmacro): Flush font-lock in existing elisp buffers. * emacs-lisp/lisp-mode.el (lisp--el-update-after-load) (lisp--el-update-macro-regexp, lisp--el-macro-regexp): Delete functions and defconst. (lisp--el-match-keyword): Rename from lisp--el-match-macro. (lisp--el-font-lock-flush-elisp-buffers): New function. (lisp-mode-variables): Remove code for updating lisp--el-macro-regexp, and add lisp--el-font-lock-flush-elisp-buffers to after-load-functions.
This commit is contained in:
parent
1a93b9145d
commit
9fdc166ee0
3 changed files with 57 additions and 33 deletions
|
|
@ -147,11 +147,16 @@ This is used by `declare'.")
|
|||
(defvar macro-declarations-alist
|
||||
(cons
|
||||
(list 'debug
|
||||
#'(lambda (name _args spec)
|
||||
(list 'progn :autoload-end
|
||||
(list 'put (list 'quote name)
|
||||
''edebug-form-spec (list 'quote spec)))))
|
||||
defun-declarations-alist)
|
||||
#'(lambda (name _args spec)
|
||||
(list 'progn :autoload-end
|
||||
(list 'put (list 'quote name)
|
||||
''edebug-form-spec (list 'quote spec)))))
|
||||
(cons
|
||||
(list 'no-font-lock-keyword
|
||||
#'(lambda (name _args val)
|
||||
(list 'function-put (list 'quote name)
|
||||
''no-font-lock-keyword (list 'quote val))))
|
||||
defun-declarations-alist))
|
||||
"List associating properties of macros to their macro expansion.
|
||||
Each element of the list takes the form (PROP FUN) where FUN is a function.
|
||||
For each (PROP . VALUES) in a macro's declaration, the FUN corresponding
|
||||
|
|
@ -201,6 +206,19 @@ The return value is undefined.
|
|||
(message "Warning: Unknown macro property %S in %S"
|
||||
(car x) name))))
|
||||
decls)))
|
||||
;; Refresh font-lock if this is a new macro, or it is an
|
||||
;; existing macro whose 'no-font-lock-keyword declaration
|
||||
;; has changed.
|
||||
(if (and
|
||||
;; If lisp-mode hasn't been loaded, there's no reason
|
||||
;; to flush.
|
||||
(fboundp 'lisp--el-font-lock-flush-elisp-buffers)
|
||||
(or (not (fboundp name)) ;; new macro
|
||||
(and (fboundp name) ;; existing macro
|
||||
(member `(function-put ',name 'no-font-lock-keyword
|
||||
',(get name 'no-font-lock-keyword))
|
||||
declarations))))
|
||||
(lisp--el-font-lock-flush-elisp-buffers))
|
||||
(if declarations
|
||||
(cons 'prog1 (cons def declarations))
|
||||
def))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue