lang/emacs-lisp: optimize symbol fontification

By ignoring symbols in comments and strings.
This commit is contained in:
Henrik Lissner 2018-08-20 23:47:31 +02:00
parent 97bc69b9e5
commit 1cb31d7cb5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -64,6 +64,9 @@ Functions are differentiated into special forms, built-in functions and
library/userland functions" library/userland functions"
(catch 'matcher (catch 'matcher
(while (re-search-forward "\\_<.+?\\_>" end t) (while (re-search-forward "\\_<.+?\\_>" end t)
(unless (save-excursion
(let ((ppss (syntax-ppss)))
(or (nth 3 ppss) (nth 4 ppss))))
(let ((symbol (intern-soft (match-string-no-properties 0)))) (let ((symbol (intern-soft (match-string-no-properties 0))))
(and (cond ((null symbol) nil) (and (cond ((null symbol) nil)
((eq symbol t) nil) ((eq symbol t) nil)
@ -82,7 +85,7 @@ library/userland functions"
(if (subrp unaliased) (if (subrp unaliased)
'font-lock-constant-face 'font-lock-constant-face
'font-lock-function-name-face)))))) 'font-lock-function-name-face))))))
(throw 'matcher t)))) (throw 'matcher t)))))
nil)) nil))
(eval-when-compile (eval-when-compile
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)) (byte-compile #'+emacs-lisp-highlight-vars-and-faces))