Add option to enable extra elisp fontification
This commit is contained in:
parent
9570670eb1
commit
9f074a1aa3
1 changed files with 23 additions and 12 deletions
|
@ -1,5 +1,14 @@
|
||||||
;;; lang/emacs-lisp/config.el -*- lexical-binding: t; -*-
|
;;; lang/emacs-lisp/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar +emacs-lisp-enable-extra-fontification t
|
||||||
|
"If non-nil, fontify built-in functions and variables especially (symbols
|
||||||
|
defined by Emacs, not Doom or packages). This can help make typos stand out.")
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; elisp-mode deferral hack
|
||||||
|
;;
|
||||||
|
|
||||||
;; `elisp-mode' is loaded at startup. In order to lazy load its config we need
|
;; `elisp-mode' is loaded at startup. In order to lazy load its config we need
|
||||||
;; to pretend it isn't loaded
|
;; to pretend it isn't loaded
|
||||||
(delq 'elisp-mode features)
|
(delq 'elisp-mode features)
|
||||||
|
@ -50,21 +59,23 @@
|
||||||
;; initialization
|
;; initialization
|
||||||
+emacs-lisp|init-imenu +emacs-lisp|disable-flycheck-maybe))
|
+emacs-lisp|init-imenu +emacs-lisp|disable-flycheck-maybe))
|
||||||
|
|
||||||
;; Improve elisp fontification
|
;; Special fontification for doom
|
||||||
(load! "+symbols")
|
|
||||||
(font-lock-add-keywords
|
(font-lock-add-keywords
|
||||||
'emacs-lisp-mode
|
'emacs-lisp-mode
|
||||||
`(;; Highlight custom Doom cookies
|
`(;; custom Doom cookies
|
||||||
("^;;;###\\(autodef\\|if\\)[ \n]" (1 font-lock-warning-face t))
|
("^;;;###\\(autodef\\|if\\)[ \n]" (1 font-lock-warning-face t))
|
||||||
;; Highlight doom/module functions
|
;; doom/module functions
|
||||||
("\\(^\\|\\s-\\|,\\)(\\(\\(doom\\|\\+\\)[^) ]+\\|[^) ]+!\\)[) \n]" (2 'font-lock-keyword-face))
|
("\\(^\\|\\s-\\|,\\)(\\(\\(doom\\|\\+\\)[^) ]+\\|[^) ]+!\\)[) \n]" (2 'font-lock-keyword-face))))
|
||||||
;; Highlight symbols in standard library
|
|
||||||
;; (,(regexp-opt +emacs-lisp-macro-list 'symbols) . font-lock-builtin-face)
|
;; Highlight symbols in standard library
|
||||||
(,(regexp-opt +emacs-lisp-function-list 'symbols) . font-lock-function-name-face)
|
(when +emacs-lisp-enable-extra-fontification
|
||||||
(,(regexp-opt +emacs-lisp-command-list 'symbols) . font-lock-function-name-face)
|
(load! "+symbols")
|
||||||
;; (,(regexp-opt +emacs-lisp-special-form-list 'symbols) . font-lock-keyword-face)
|
(font-lock-add-keywords
|
||||||
(,(regexp-opt +emacs-lisp-variable-list 'symbols) . font-lock-variable-name-face)
|
'emacs-lisp-mode
|
||||||
(,(regexp-opt +emacs-lisp-option-list 'symbols) . font-lock-variable-name-face)))
|
`((,(concat "\\(?:(\\|#'\\)" (regexp-opt +emacs-lisp-function-list t) "\\_>") (1 'font-lock-function-name-face))
|
||||||
|
(,(concat "\\(?:(\\|#'\\)" (regexp-opt +emacs-lisp-command-list t) "\\_>") (1 'font-lock-function-name-face))
|
||||||
|
(,(regexp-opt +emacs-lisp-variable-list 'symbols) . font-lock-variable-name-face)
|
||||||
|
(,(regexp-opt +emacs-lisp-option-list 'symbols) . font-lock-variable-name-face))))
|
||||||
|
|
||||||
(defun +emacs-lisp|init-imenu ()
|
(defun +emacs-lisp|init-imenu ()
|
||||||
"Improve imenu support with better expression regexps and Doom-specific forms."
|
"Improve imenu support with better expression regexps and Doom-specific forms."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue