3

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.

Nicolas Rougier
  • 517
  • 3
  • 16

1 Answers1

3

Starting in emacs-27 you can specify the :extend t attribute when creating the face, and the background will then extend to the right edge of the Emacs window.

rpluim
  • 5,245
  • 11
  • 25