about summary refs log tree commit diff
path: root/nix-yapf-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'nix-yapf-mode.el')
-rw-r--r--nix-yapf-mode.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/nix-yapf-mode.el b/nix-yapf-mode.el
new file mode 100644
index 000000000000..9dba47bd3614
--- /dev/null
+++ b/nix-yapf-mode.el
@@ -0,0 +1,21 @@
+;;; ~/.doom.d/nix-yapf-mode.el -*- lexical-binding: t; -*-
+
+
+(defun +grfn/yapfify-call-bin (input-buffer output-buffer start-line end-line)
+  (with-current-buffer input-buffer
+    (call-process-region
+     (point-min)
+     (point-max)
+     "nix-shell"
+     nil
+     (list output-buffer nil)
+     nil
+     "/home/griffin/code/urb/grid/yapf.nix"
+     "--run"
+     (concat
+      "yapf -l "
+      (number-to-string start-line)
+      "-"
+      (number-to-string end-line)))))
+
+(advice-add #'yapfify-call-bin :override #'+grfn/yapfify-call-bin)