I'm trying to use overlay to highlight a whole line but for some reason my overlay stops at the end of the line (past the last character) instead of the end of the physical line (just before fringe). I'm certainly missing something obvious. Using the code below, ;; Test
is highlighted
but I would have expected ;; Test
.
;; Test
(save-excursion
(goto-char 0)
(let ((beg (point-at-bol))
(end (min (point-max) (+ 1 (point-at-eol)))))
(overlay-put (make-overlay beg end)
'face '(:background "#f0f0f0"))))
Update Answer given by @rpluim, I need to add a :extend t
in the face definition.
point-at-eol
tells you where the last character on the line is. Why would you expect it to give you the rightmost character position of the window?:extend
face attribute which is new in emacs-27