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

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

[nongnu] elpa/nix-mode 6a9cb7e682 081/500: Add basic REPL via nix-repl


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 6a9cb7e682 081/500: Add basic REPL via nix-repl
Date: Sat, 29 Jan 2022 08:26:38 -0500 (EST)

branch: elpa/nix-mode
commit 6a9cb7e6821b41de2a68181d17501706dce89b44
Author: Leon Isenberg <ljli@users.noreply.github.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>

    Add basic REPL via nix-repl
---
 nix-mode.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/nix-mode.el b/nix-mode.el
index 309a5090af..f934dcc9c1 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -211,6 +211,27 @@ If a close brace `}' ends an antiquote, the next character 
begins a string."
 
 (add-to-list 'flycheck-checkers 'nix)
 
+;;; REPL
+
+(defvar nix-prompt-regexp "nix-repl> ")
+
+(define-derived-mode nix-repl-mode comint-mode "Nix-REPL"
+  "Interactive prompt for Nix."
+  (setq-local comint-prompt-regexp nix-prompt-regexp)
+  (setq-local comint-prompt-read-only t))
+
+(defun nix-repl-show ()
+  "Load the Nix-REPL."
+  (interactive)
+  (pop-to-buffer-same-window
+   (get-buffer-create "*Nix-REPL*"))
+  (unless (comint-check-proc (current-buffer))
+    (nix--make-repl-in-buffer (current-buffer))
+    (nix-repl-mode)))
+
+(defun nix--make-repl-in-buffer (buffer)
+  (make-comint-in-buffer "Nix-REPL" buffer "nix-repl"))
+
 ;;; Indentation
 
 (defun nix-indent-level-parens ()



reply via email to

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