From 22fef60073d0c1efdfbe1b7d63928bf5b4f029e2 Mon Sep 17 00:00:00 2001 From: Tobias Zawada Date: Mon, 24 Jul 2023 22:09:55 +0200 Subject: [PATCH] Fixes #33. Noticeable lag when typing in larger code blocks - Set text property `font-lock-fontified` for fontified code blocks - also fix compiler error by quoting lambdas with sharp quote --- adoc-mode.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 38d3d5f..4d114bf 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -253,7 +253,7 @@ are fontified natively regardless of their size." :type '(choice :tag "Fontify code blocks " :format "\n%{%t%}: %[Size%] %v" (integer :tag "limited to") (boolean :tag "unlimited")) - :safe '(lambda (x) (or (booleanp x) (numberp x))) + :safe #'(lambda (x) (or (booleanp x) (numberp x))) :package-version '(adoc-mode . "0.8.0")) ;; This is based on `org-src-lang-modes' from org-src.el @@ -1725,7 +1725,7 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'." (list ;; see also regexp of forced line break, which is similar. it is not directly ;; obvious from asciidoc sourcecode what the exact rules are. - '(lambda (end) (adoc-kwf-std end "^\\(\\+\\)[ \t]*$" '(1))) + #'(lambda (end) (adoc-kwf-std end "^\\(\\+\\)[ \t]*$" '(1))) '(1 '(face adoc-meta-face adoc-reserved block-del) t))) (defun adoc-kw-delimited-block (del &optional text-face inhibit-text-reserved) @@ -2119,6 +2119,8 @@ Use this function as matching function MATCHER in `font-lock-keywords'." ;; Set background for block as well as opening and closing lines. (font-lock-append-text-property start-src end-src+nl 'face 'adoc-native-code-face) + (add-text-properties + start-src end-src+nl '(font-lock-fontified t font-lock-multiline t)) ))) t))) @@ -2351,7 +2353,7 @@ Use this function as matching function MATCHER in `font-lock-keywords'." ;; --- general attribute list block element ;; ^\[(?P.*)\]$ - (list '(lambda (end) (adoc-kwf-std end "^\\(\\[\\(.*\\)\\]\\)[ \t]*$" '(0))) + (list #'(lambda (end) (adoc-kwf-std end "^\\(\\[\\(.*\\)\\]\\)[ \t]*$" '(0))) '(1 '(face adoc-meta-face adoc-reserved block-del)) '(2 '(face adoc-meta-face adoc-attribute-list t)))