Skip to content

Commit

Permalink
Fixes #33. Noticeable lag when typing in larger code blocks
Browse files Browse the repository at this point in the history
- Set text property `font-lock-fontified` for fontified code blocks
- also fix compiler error by quoting lambdas with sharp quote
  • Loading branch information
Tobias Zawada authored and Tobias Zawada committed Jul 24, 2023
1 parent a7691c8 commit 22fef60
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions adoc-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)))

Expand Down Expand Up @@ -2351,7 +2353,7 @@ Use this function as matching function MATCHER in `font-lock-keywords'."

;; --- general attribute list block element
;; ^\[(?P<attrlist>.*)\]$
(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)))

Expand Down

0 comments on commit 22fef60

Please sign in to comment.