hlissner/emacs-solaire-mode

Solaire gets confused when point is on the last line

jjwest opened this issue · 3 comments

After updating to the latest version of solaire-mode I noticed that when the point is placed on the last line
the rest of the buffer is no longer colorized correctly.

Screenshot: https://i.imgur.com/GhfzDAM.png

Yikes, sorry for the late reply. Perhaps this the work of hl-line-mode? If you still have the problem, could you try disabling it (M-x hl-line-mode) and see if the issue persists?

I could never pinpoint the exact cause, but it seemed to be some weird dynamic between hl-line-mode, solaire-mode and the new display-line-numbers. When one of the three was deactivated the issue disappeared. I ended up manually disabling hl-line-mode on the last line to resolve the issue.

Recently upgraded to Emacs 26 myself and I see this problem now. If it's useful, here's how I get around it:

(defun doom--line-range ()
  (cons (line-beginning-position)
        (cond ((save-excursion
                 (goto-char (line-end-position))
                 (and (eobp) (not (bolp))))
               (1- (line-end-position)))
              ((or (eobp) (save-excursion (forward-line) (eobp)))
               (line-end-position))
              (t
               (line-beginning-position 2))))
(setq hl-line-range-function #'doom--line-range)

Since this is more an underlying Emacs issue than a solaire-mode (or even hl-line-mode), I'll close this issue.