summaryrefslogtreecommitdiff
path: root/elisp.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-02-11 09:51:43 +0800
committerJSDurand <mmemmew@gmail.com>2021-02-11 09:54:39 +0800
commit01c080b98c6c7b645ac5c502c896b0965b784cb1 (patch)
tree879aa0184654b900acd508c570211dbc2a0bc09c /elisp.el
parent393604e5bf4ce15df7342fdc094900fd1be2b39f (diff)
Change some font-lock behaviours.
* elisp.el (emacs-lisp-mode): (emacs-lisp-highlight-vars-and-faces): Change some highlighting.
Diffstat (limited to 'elisp.el')
-rw-r--r--elisp.el36
1 files changed, 26 insertions, 10 deletions
diff --git a/elisp.el b/elisp.el
index 17ff506..8045f64 100644
--- a/elisp.el
+++ b/elisp.el
@@ -1,8 +1,16 @@
-;;; -*- lexical-binding: t; -*-
+;;; elisp.el --- My configurations of Emacs Lisp mode -*- lexical-binding: t; -*-
+
+
+;;; Commentary:
+
+;; Some personal configurations.
+
+;;; Code:
;;; Hide Eldoc in the mode line
;; The original value is eldoc-minor-mode-string
+
(durand-hide-minor-mode eldoc-mode)
;;; fontification of extra keywords in emacs lisp files
@@ -11,18 +19,20 @@
(font-lock-add-keywords
'emacs-lisp-mode
- `(("^;;;###\\(autoload\\)[ \n]" (1 font-lock-warning-face t))
+ `(("^;;;###\\(autoload\\)[ \n]" (1 font-lock-preprocessor-face t))
(emacs-lisp-highlight-vars-and-faces . emacs-lisp-face)
("\\(\\(?:#'\\|['`]\\)\\)\\(?:[[:space:]]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\)?"
(1 font-lock-keyword-face)
- (2 font-lock-constant-face nil t))))
+ (2 font-lock-constant-face nil t)))
+ 'append)
;;;###autoload
(defvar emacs-lisp-face nil
- "The face used to highlight extra emacs lisp keywords.")
+ "The face used to highlight extra Emacs Lisp keywords.")
;;;###autoload
(defun emacs-lisp-highlight-vars-and-faces (end)
+ "Find special things to highlight within the confine of END."
(catch 'matcher
(while (re-search-forward "\\(?:\\sw\\|\\s_\\)+" end t)
(let ((ppss (save-excursion (syntax-ppss))))
@@ -41,8 +51,9 @@
(not (memq (char-before (1- (match-beginning 0)))
(list ?\' ?\`))))
(let ((unaliased (indirect-function symbol)))
- (cond ((or (macrop unaliased)
- (special-form-p unaliased))
+ (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)
@@ -51,7 +62,7 @@
unaliased)
(setq emacs-lisp-face
(if (subrp unaliased)
- 'font-lock-constant-face
+ 'font-lock-builtin-face
'font-lock-function-name-face)))))))
(throw 'matcher t)))))))
nil))
@@ -79,9 +90,10 @@
;;;###autoload
(defun better-calculate-lisp-indent (&optional parse-start)
- "Add better indentation for quoted and backquoted lists."
- ;; This line because `calculate-lisp-indent-last-sexp` was defined with `defvar`
- ;; with it's value ommited, marking it special and only defining it locally. So
+ "Add better indentation for quoted and backquoted lists.
+PARSE-START is the starting position of the parse."
+ ;; This line because `calculate-lisp-indent-last-sexp` was defined with `defvar`
+ ;; with it's value ommited, marking it special and only defining it locally. So
;; if you don't have this, you'll get a void variable error.
(defvar calculate-lisp-indent-last-sexp)
(save-excursion
@@ -252,3 +264,7 @@
(desired-indent)
(t
normal-indent))))))
+
+(provide 'elisp)
+
+;;; elisp.el ends here