summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-08-09 11:20:56 +0800
committerJSDurand <mmemmew@gmail.com>2021-08-09 11:20:56 +0800
commit885d02b406d882a332362479bef53dd874ab0edd (patch)
tree56dd22c6d5a595bd77047c0469ab80bde1408414
parent95e85e429a3ebcae9173fb45316db45cf0435f5e (diff)
fix: elisp fontification
* elisp.el (emacs-lisp-highlight-vars-and-faces): Now the quote #' will mark the symbol as a function, if it really is a function.
-rw-r--r--elisp.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/elisp.el b/elisp.el
index c1c62fb..c944040 100644
--- a/elisp.el
+++ b/elisp.el
@@ -45,6 +45,28 @@
(and (cond ((null symbol) nil)
((eq symbol t) nil)
((keywordp symbol) nil)
+ ((let ((start (match-beginning 0)))
+ (and (fboundp symbol)
+ (eq (char-before (max (point-min)
+ start))
+ ?')
+ (eq (char-before (max (point-min)
+ (1- start)))
+ ?#)))
+ (let ((unaliased (indirect-function symbol)))
+ (cond ((special-form-p unaliased)
+ (setq emacs-lisp-face 'font-lock-constant-face))
+ ((macrop unaliased)
+ (setq emacs-lisp-face 'font-lock-keyword-face))
+ (t
+ (let (unadvised)
+ (while (not (eq (setq unadvised (ad-get-orig-definition unaliased))
+ (setq unaliased (indirect-function unadvised)))))
+ unaliased)
+ (setq emacs-lisp-face
+ (if (subrp unaliased)
+ 'font-lock-builtin-face
+ 'font-lock-function-name-face))))))
((special-variable-p symbol)
(setq emacs-lisp-face 'font-lock-variable-name-face))
((let ((quote-before-p