From 8f91452e14f986669aef418cbcebacc790b863af Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Jul 2023 12:30:17 +0200 Subject: Emacs: only toggle relative/absolute line numbers when any are shown --- user/emacs/init.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'user/emacs') diff --git a/user/emacs/init.el b/user/emacs/init.el index e19f8eb1..f2c7bfca 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -128,11 +128,13 @@ (defun noct-relative () "Show relative line numbers." - (setq-local display-line-numbers 'relative)) + (when display-line-numbers + (setq-local display-line-numbers 'relative))) (defun noct-absolute () "Show absolute line numbers." - (setq-local display-line-numbers t)) + (when display-line-numbers + (setq-local display-line-numbers t))) (add-hook 'evil-insert-state-entry-hook #'noct-absolute) (add-hook 'evil-insert-state-exit-hook #'noct-relative) -- cgit 1.4.1