summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2023-07-09 12:30:17 +0200
committerAlan Pearce2023-07-13 19:43:14 +0200
commit8f91452e14f986669aef418cbcebacc790b863af (patch)
tree9680b33c9cf9ab2c151cb3e9965a4d056806442d /user
parent722afe1c779ca56d776b1ce346a1541582838a09 (diff)
downloadnixfiles-8f91452e14f986669aef418cbcebacc790b863af.tar.lz
nixfiles-8f91452e14f986669aef418cbcebacc790b863af.tar.zst
nixfiles-8f91452e14f986669aef418cbcebacc790b863af.zip
Emacs: only toggle relative/absolute line numbers when any are shown
Diffstat (limited to 'user')
-rw-r--r--user/emacs/init.el6
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)