diff options
author | Alan Pearce | 2023-07-09 12:30:17 +0200 |
---|---|---|
committer | Alan Pearce | 2023-07-13 19:43:14 +0200 |
commit | 8f91452e14f986669aef418cbcebacc790b863af (patch) | |
tree | 9680b33c9cf9ab2c151cb3e9965a4d056806442d | |
parent | 722afe1c779ca56d776b1ce346a1541582838a09 (diff) | |
download | nixfiles-8f91452e14f986669aef418cbcebacc790b863af.tar.lz nixfiles-8f91452e14f986669aef418cbcebacc790b863af.tar.zst nixfiles-8f91452e14f986669aef418cbcebacc790b863af.zip |
Emacs: only toggle relative/absolute line numbers when any are shown
-rw-r--r-- | user/emacs/init.el | 6 |
1 files changed, 4 insertions, 2 deletions
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) |