[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ec42ff3 2/7: Prefer setq-local in font-lock.el
From: |
Stefan Kangas |
Subject: |
master ec42ff3 2/7: Prefer setq-local in font-lock.el |
Date: |
Wed, 9 Dec 2020 02:58:39 -0500 (EST) |
branch: master
commit ec42ff31156a41b4087c4be9ee10702392b66c23
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Prefer setq-local in font-lock.el
* lisp/font-lock.el:
(font-lock-add-keywords, font-lock-turn-on-thing-lock)
(font-lock-fontify-syntactic-keywords-region)
(font-lock-set-defaults): Prefer setq-local.
---
lisp/font-lock.el | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index e708e69..0e771e8 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -152,8 +152,8 @@
;;
;; (add-hook 'foo-mode-hook
;; (lambda ()
-;; (set (make-local-variable 'font-lock-defaults)
-;; '(foo-font-lock-keywords t))))
+;; (setq-local font-lock-defaults
+;; '(foo-font-lock-keywords t))))
;;;; Adding Font Lock support for modes:
@@ -173,8 +173,8 @@
;;
;; and within `bar-mode' there could be:
;;
-;; (set (make-local-variable 'font-lock-defaults)
-;; '(bar-font-lock-keywords nil t))
+;; (setq-local font-lock-defaults
+;; '(bar-font-lock-keywords nil t))
;; What is fontification for? You might say, "It's to make my code look nice."
;; I think it should be for adding information in the form of cues. These cues
@@ -733,7 +733,7 @@ see the variables `c-font-lock-extra-types',
`c++-font-lock-extra-types',
;; font-lock-mode it only enabled the font-core.el part, not the
;; font-lock-mode-internal. Try again.
(font-lock-mode -1)
- (set (make-local-variable 'font-lock-defaults) '(nil t))
+ (setq-local font-lock-defaults '(nil t))
(font-lock-mode 1))
;; Otherwise set or add the keywords now.
;; This is a no-op if it has been done already in this buffer
@@ -933,18 +933,15 @@ The value of this variable is used when Font Lock mode is
turned on."
;; Prepare for jit-lock
(remove-hook 'after-change-functions
#'font-lock-after-change-function t)
- (set (make-local-variable 'font-lock-flush-function)
- #'jit-lock-refontify)
- (set (make-local-variable 'font-lock-ensure-function)
- #'jit-lock-fontify-now)
+ (setq-local font-lock-flush-function #'jit-lock-refontify)
+ (setq-local font-lock-ensure-function #'jit-lock-fontify-now)
;; Prevent font-lock-fontify-buffer from fontifying eagerly the whole
;; buffer. This is important for things like CWarn mode which
;; adds/removes a few keywords and does a refontify (which takes ages on
;; large files).
- (set (make-local-variable 'font-lock-fontify-buffer-function)
- #'jit-lock-refontify)
+ (setq-local font-lock-fontify-buffer-function #'jit-lock-refontify)
;; Don't fontify eagerly (and don't abort if the buffer is large).
- (set (make-local-variable 'font-lock-fontified) t)
+ (setq-local font-lock-fontified t)
;; Use jit-lock.
(jit-lock-register #'font-lock-fontify-region
(not font-lock-keywords-only))
@@ -1558,7 +1555,7 @@ START should be at the beginning of a line."
(unless parse-sexp-lookup-properties
;; We wouldn't go through so much trouble if we didn't intend to use those
;; properties, would we?
- (set (make-local-variable 'parse-sexp-lookup-properties) t))
+ (setq-local parse-sexp-lookup-properties t))
;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords.
(when (symbolp font-lock-syntactic-keywords)
(setq font-lock-syntactic-keywords (font-lock-eval-keywords
@@ -1942,8 +1939,8 @@ Sets various variables using `font-lock-defaults' and
(set (make-local-variable (car x)) (cdr x)))
;; Set up `font-lock-keywords' last because its value might depend
;; on other settings.
- (set (make-local-variable 'font-lock-keywords)
- (font-lock-eval-keywords keywords))
+ (setq-local font-lock-keywords
+ (font-lock-eval-keywords keywords))
;; Local fontification?
(while local
(font-lock-add-keywords nil (car (car local)) (cdr (car local)))
- master updated (2581beb -> 22caab8), Stefan Kangas, 2020/12/09
- master 4248d60 1/7: * lisp/progmodes/sql.el: Remove redundant URL., Stefan Kangas, 2020/12/09
- master 3d6498c 3/7: Prefer setq-local in sql.el, Stefan Kangas, 2020/12/09
- master dc0295c 4/7: Prefer setq-local in cfengine.el, Stefan Kangas, 2020/12/09
- master 7ebd7ba 5/7: Prefer setq-local in etags.el, Stefan Kangas, 2020/12/09
- master 22caab8 7/7: Prefer setq-local in some remaining progmodes, Stefan Kangas, 2020/12/09
- master ec42ff3 2/7: Prefer setq-local in font-lock.el,
Stefan Kangas <=
- master dbc044e 6/7: Prefer setq-local in gdb-mi.el, Stefan Kangas, 2020/12/09