branch: elpa/nix-mode
commit 28e83dd56bf2355918739eb41f2eabd860ec7566
Author: Jacob Vallejo <[email protected]>
Commit: Matthew Bauer <[email protected]>
Don’t overwrite smie-indent-exps & smie-indent-close
These functions are not buffer local, so can’t be touched. Instead, we
can just replace smie-indent-function in nix-mode buffers.
---
nix-mode.el | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/nix-mode.el b/nix-mode.el
index 1c5168f0c1..203a412dc8 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -970,10 +970,15 @@ The hook `nix-mode-hook' is run when Nix mode is started.
:forward-token 'nix-smie--forward-token
:backward-token 'nix-smie--backward-token)
(setq-local smie-indent-basic 2)
- (fset (make-local-variable 'smie-indent-exps)
- (symbol-function 'nix-smie--indent-exps))
- (fset (make-local-variable 'smie-indent-close)
- (symbol-function 'nix-smie--indent-close)))
+
+ (let ((nix-smie-indent-functions
+ ;; Replace the smie-indent-* equivalents with nix-mode's.
+ (mapcar (lambda (fun) (pcase fun
+ ('smie-indent-exps 'nix-smie--indent-exps)
+ ('smie-indent-close 'nix-smie--indent-close)
+ (_ fun)))
+ smie-indent-functions)))
+ (setq-local smie-indent-functions nix-smie-indent-functions)))
;; Automatic indentation [C-j]
(setq-local indent-line-function (lambda ()