From 885d02b406d882a332362479bef53dd874ab0edd Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 9 Aug 2021 11:20:56 +0800 Subject: 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. --- elisp.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 -- cgit v1.2.3-18-g5258