Refactor hl-line eob fix in Emacs 26+
This commit is contained in:
parent
48c77b1126
commit
8b7404bf75
|
@ -159,14 +159,15 @@ shorter major mode name in the mode-line. See `doom|set-mode-name'.")
|
||||||
|
|
||||||
;; On Emacs 26+, when point is on the last line, hl-line highlights bleed into
|
;; On Emacs 26+, when point is on the last line, hl-line highlights bleed into
|
||||||
;; the rest of the window after eob. This is the fix.
|
;; the rest of the window after eob. This is the fix.
|
||||||
(unless (get 'display-line-numbers 'nlinum)
|
(when EMACS26+
|
||||||
(defun doom--line-range ()
|
(defun doom--line-range ()
|
||||||
(cons (line-beginning-position)
|
(cons (line-beginning-position)
|
||||||
(cond ((save-excursion
|
(cond ((let ((eol (line-end-position)))
|
||||||
(goto-char (line-end-position))
|
(and (= eol (point-max))
|
||||||
(and (eobp) (not (bolp))))
|
(/= eol (line-beginning-position))))
|
||||||
(1- (line-end-position)))
|
(1- (line-end-position)))
|
||||||
((or (eobp) (save-excursion (forward-line) (eobp)))
|
((or (eobp)
|
||||||
|
(= (line-end-position 2) (point-max)))
|
||||||
(line-end-position))
|
(line-end-position))
|
||||||
((line-beginning-position 2)))))
|
((line-beginning-position 2)))))
|
||||||
(setq hl-line-range-function #'doom--line-range))
|
(setq hl-line-range-function #'doom--line-range))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user