Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions contrib/trailing-spaces/trailing-spaces.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@
(return)))))

(defun scan-trailing-spaces (start end)
(with-point ((p1 start)
(p2 start)
(end end))
(line-start p1)
(line-end end)
(clear-space-attribute p1 end)
(loop :while (point< p1 end)
:do (line-end p1)
(move-point p2 p1)
(skip-whitespace-backward p1 t)
(put-text-property p1 p2 :attribute 'space-attribute)
(unless (line-offset p1 1)
(return)))))
(unless (lem-core:not-switchable-buffer-p (lem:current-buffer))
(with-point ((p1 start)
(p2 start)
(end end))
(line-start p1)
(line-end end)
(clear-space-attribute p1 end)
(loop :while (point< p1 end)
:do (line-end p1)
(move-point p2 p1)
(skip-whitespace-backward p1 t)
(put-text-property p1 p2 :attribute 'space-attribute)
(unless (line-offset p1 1)
(return))))))

(defun enable ()
(add-hook (variable-value 'after-syntax-scan-hook :global)
Expand Down