branch: elpa/nix-mode
commit 9fb4e16c9fa86c796ec20753e0473888a36c16d2
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>
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