summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2024-04-29 23:17:46 +0200
committerAlan Pearce2024-04-30 00:05:15 +0200
commit6ee4be8ff88a796485eac5e448af18d3c0f2a796 (patch)
treef87ed29c7e3ef45d9a8ab7e9a2cb1040261b0764 /user/emacs
parentc0adc4b8e20b2594a6bc655db7795d85a18c34cf (diff)
downloadnixfiles-6ee4be8ff88a796485eac5e448af18d3c0f2a796.tar.lz
nixfiles-6ee4be8ff88a796485eac5e448af18d3c0f2a796.tar.zst
nixfiles-6ee4be8ff88a796485eac5e448af18d3c0f2a796.zip
emacs: defensively check for existing non-ts- mode hooks
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 21a8b9d6..08add74f 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -1014,10 +1014,21 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :config (progn
             (setq treemacs-no-png-images t)))
 
-(setq typescript-ts-mode-hook typescript-ts-mode
-      dockerfile-ts-mode-hook dockerfile-ts-mode
-      yaml-ts-mode-hook yaml-mode-hook
-      go-ts-mode-hook go-mode-hook)
+(if (boundp 'typescript-mode-hook)
+    (setq typescript-ts-mode-hook typescript-mode-hook))
+
+(if (boundp 'dockerfile-mode-hook)
+    (setq dockerfile-ts-mode-hook dockerfile-mode-hook))
+
+(if (boundp 'yaml-mode-hook)
+    (setq yaml-ts-mode-hook yaml-mode-hook))
+
+(if (boundp 'go-mode-hook)
+    (setq go-ts-mode-hook go-mode-hook))
+
+(if (boundp 'nix-mode-hook)
+    (setq nix-ts-mode-hook nix-mode-hook))
+
 (use-package eglot
   :defer 3
   :general (:states 'normal :keymaps 'eglot-mode-map