emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode 9fb4e16c9f 233/500: Setup global-nix-mode


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 9fb4e16c9f 233/500: Setup global-nix-mode
Date: Sat, 29 Jan 2022 08:27:09 -0500 (EST)

branch: elpa/nix-mode
commit 9fb4e16c9fa86c796ec20753e0473888a36c16d2
Author: Matthew Bauer <matthew.bauer@obsidian.systems>
Commit: Matthew Bauer <matthew.bauer@obsidian.systems>

    Setup global-nix-mode
---
 nix.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/nix.el b/nix.el
index bddb6e1e8f..12e9780e1f 100644
--- a/nix.el
+++ b/nix.el
@@ -84,11 +84,19 @@ ATTRIBUTE from PATH to get Nix expressions from."
   "Minor mode to enable Nix enhancements."
   :require 'nix
   :global t
-  (when global-nix-mode
-    (add-to-list 'interpreter-mode-alist '("nix-shell" . nix-shebang-mode))
-    (add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-mode))
-    (add-to-list 'auto-mode-alist '("\\.drv\\'" . nix-drv-mode))
-    (add-hook 'after-change-major-mode-hook 'nix-shell-mode)))
+  (if global-nix-mode
+      (progn
+        (add-to-list 'interpreter-mode-alist '("nix-shell" . nix-shebang-mode))
+        (add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-mode))
+        ;; (add-to-list 'auto-mode-alist '("\\.drv\\'" . nix-drv-mode))
+        (add-hook 'after-change-major-mode-hook 'nix-shell))
+    (progn
+      (setq interpreter-mode-alist (remove '("nix-shell" . nix-shebang-mode)
+                                           interpreter-mode-alist))
+      (setq auto-mode-alist
+            (remove '("\\.drv\\'" . nix-drv-mode)
+                    (remove '("\\.nix\\'" . nix-mode) auto-mode-alist)))
+      (remove-hook 'after-change-major-mode-hook 'nix-shell))))
 
 (provide 'nix)
 ;;; nix.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]