lang/emacs-lisp: optimize symbol fontification
By ignoring symbols in comments and strings.
This commit is contained in:
parent
97bc69b9e5
commit
1cb31d7cb5
1 changed files with 22 additions and 19 deletions
|
@ -64,25 +64,28 @@ Functions are differentiated into special forms, built-in functions and
|
|||
library/userland functions"
|
||||
(catch 'matcher
|
||||
(while (re-search-forward "\\_<.+?\\_>" end t)
|
||||
(let ((symbol (intern-soft (match-string-no-properties 0))))
|
||||
(and (cond ((null symbol) nil)
|
||||
((eq symbol t) nil)
|
||||
((special-variable-p symbol)
|
||||
(setq +emacs-lisp--face 'font-lock-variable-name-face))
|
||||
((and (fboundp symbol)
|
||||
(eq (char-before (match-beginning 0)) ?\())
|
||||
(let ((unaliased (indirect-function symbol t)))
|
||||
(unless (or (macrop unaliased)
|
||||
(special-form-p unaliased))
|
||||
(let (unadvised)
|
||||
(while (not (eq (setq unadvised (ad-get-orig-definition unaliased))
|
||||
(setq unaliased (indirect-function unadvised t)))))
|
||||
unaliased)
|
||||
(setq +emacs-lisp--face
|
||||
(if (subrp unaliased)
|
||||
'font-lock-constant-face
|
||||
'font-lock-function-name-face))))))
|
||||
(throw 'matcher t))))
|
||||
(unless (save-excursion
|
||||
(let ((ppss (syntax-ppss)))
|
||||
(or (nth 3 ppss) (nth 4 ppss))))
|
||||
(let ((symbol (intern-soft (match-string-no-properties 0))))
|
||||
(and (cond ((null symbol) nil)
|
||||
((eq symbol t) nil)
|
||||
((special-variable-p symbol)
|
||||
(setq +emacs-lisp--face 'font-lock-variable-name-face))
|
||||
((and (fboundp symbol)
|
||||
(eq (char-before (match-beginning 0)) ?\())
|
||||
(let ((unaliased (indirect-function symbol t)))
|
||||
(unless (or (macrop unaliased)
|
||||
(special-form-p unaliased))
|
||||
(let (unadvised)
|
||||
(while (not (eq (setq unadvised (ad-get-orig-definition unaliased))
|
||||
(setq unaliased (indirect-function unadvised t)))))
|
||||
unaliased)
|
||||
(setq +emacs-lisp--face
|
||||
(if (subrp unaliased)
|
||||
'font-lock-constant-face
|
||||
'font-lock-function-name-face))))))
|
||||
(throw 'matcher t)))))
|
||||
nil))
|
||||
(eval-when-compile
|
||||
(byte-compile #'+emacs-lisp-highlight-vars-and-faces))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue