branch: elpa/flycheck
commit 5a83fb4f3e00e9a956270a9fd8eaf1839daea345
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Preserve pre-existing line-prefix when adding overlays
When flycheck adds an overlay on text that already has a line-prefix
text property (e.g. from org-indent-mode), the overlay now inherits
that property so indentation is not lost.
Fixes #2127
---
flycheck.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/flycheck.el b/flycheck.el
index 3b339f13ab..64b4725297 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -4829,7 +4829,13 @@ function resolves `conditional' style specifications."
level flycheck-indication-mode))
(setf (overlay-get overlay 'wrap-prefix)
(flycheck-error-level-make-indicator
- level flycheck-indication-mode t)))
+ level flycheck-indication-mode t))
+ ;; Preserve any existing line-prefix text property (e.g. from
+ ;; org-indent-mode) so the overlay doesn't clobber indentation.
+ (let ((existing-prefix (get-text-property
+ (overlay-start overlay) 'line-prefix)))
+ (when existing-prefix
+ (setf (overlay-get overlay 'line-prefix) existing-prefix))))
(pcase (flycheck--highlighting-style err)
((or `nil (guard (null flycheck-highlighting-mode)))
;; Erase the highlighting