Skip to content

Commit

Permalink
Only remove kw-replacement overlays in adoc-unfontify-region-function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Zawada authored and Tobias Zawada committed Jan 30, 2024
1 parent 05914c7 commit 53d87da
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions adoc-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,7 @@ meta characters."
(make-overlay (match-end 1) (match-end 1)))))
(setq adoc-replacement-failed (not o))
(unless adoc-replacement-failed
(overlay-put o 'adoc-kw-replacement t)
(overlay-put o 'after-string s))))
found))

Expand Down Expand Up @@ -2148,11 +2149,9 @@ Use this function as matching function MATCHER in `font-lock-keywords'."
(defun adoc-unfontify-region-function (beg end)
(font-lock-default-unfontify-region beg end)

;; remove overlays. Currently only used by AsciiDoc replacements
;; TODO: this is an extremely brute force solution and interacts very badly
;; with many (minor) modes using overlays such as flyspell or ediff
(when adoc-insert-replacement
(remove-overlays beg end))
(cl-loop for ol being the overlays from beg to end
when (overlay-get ol 'adoc-kw-replacement)
do (delete-overlay ol))

;; text properties. Currently only display raise used for sub/superscripts.
;; code snipped copied from tex-mode
Expand Down

0 comments on commit 53d87da

Please sign in to comment.