branch: elpa/idris-mode
commit dfce8b6631ff1a408d8c6201adc1b064b944a0a1
Author: Marek L <nospam.ke...@gmail.com>
Commit: Marek L <nospam.ke...@gmail.com>

    Move `idris-run` from inferior-idris.el to idris-commands.el
    
    Why:
     - To keep most of interactive commands in same file.
     - Second it is sensible to have idris-run next to idris-quit definition.
     - Last it removes cycle dependency on idris-prover.el in idris-repl.el.
---
 idris-commands.el | 34 ++++++++++++++++++++++++++++++++++
 idris-repl.el     |  1 +
 inferior-idris.el | 36 ------------------------------------
 3 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/idris-commands.el b/idris-commands.el
index b88980042f..af7eb582fb 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -966,6 +966,40 @@ https://github.com/clojure-emacs/cider";
           (user-error "No Idris buffer found")))
     (user-error "Not in a Idris REPL buffer")))
 
+(defun idris-run ()
+  "Run an inferior Idris process."
+  (interactive)
+  (let ((command-line-flags (idris-compute-flags)))
+    ;; Kill the running Idris if the command-line flags need updating
+    (when (and (get-buffer-process (get-buffer idris-connection-buffer-name))
+               (not (equal command-line-flags idris-current-flags)))
+      (message "Idris command line arguments changed, restarting Idris")
+      (idris-quit)
+      (sit-for 0.01)) ; allows the sentinel to run and reset idris-process
+    ;; Start Idris if necessary
+    (when (not idris-process)
+      (setq idris-process
+            (get-buffer-process
+             (apply #'make-comint-in-buffer
+                    "idris"
+                    idris-process-buffer-name
+                    idris-interpreter-path
+                    nil
+                    "--ide-mode-socket"
+                    command-line-flags)))
+      (with-current-buffer idris-process-buffer-name
+        (add-hook 'comint-preoutput-filter-functions
+                  'idris-process-filter
+                  nil
+                  t)
+        (add-hook 'comint-output-filter-functions
+                  'idris-show-process-buffer
+                  nil
+                  t))
+      (set-process-sentinel idris-process 'idris-sentinel)
+      (setq idris-current-flags command-line-flags)
+      (accept-process-output idris-process 3))))
+
 (defun idris-quit ()
   "Quit the Idris process, cleaning up the state synchronized with Emacs."
   (interactive)
diff --git a/idris-repl.el b/idris-repl.el
index 2baba65ccd..ae4c0b40ab 100644
--- a/idris-repl.el
+++ b/idris-repl.el
@@ -165,6 +165,7 @@ If ALWAYS-INSERT is non-nil, always insert a prompt at the 
end of the buffer."
   (pop-to-buffer (idris-repl-buffer))
   (goto-char (point-max)))
 
+(autoload 'idris-run "idris-commands.el")
 ;;;###autoload
 (defun idris-repl ()
   (interactive)
diff --git a/inferior-idris.el b/inferior-idris.el
index 17fd79574c..08aeb843c8 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -97,42 +97,6 @@ Set using file or directory variables.")
   "The list of `command-line-args' actually passed to Idris.
 This is maintained to restart Idris when the arguments change.")
 
-(autoload 'idris-prover-event-hook-function "idris-prover.el")
-(autoload 'idris-quit "idris-commands.el")
-(defun idris-run ()
-  "Run an inferior Idris process."
-  (interactive)
-  (let ((command-line-flags (idris-compute-flags)))
-    ;; Kill the running Idris if the command-line flags need updating
-    (when (and (get-buffer-process (get-buffer idris-connection-buffer-name))
-               (not (equal command-line-flags idris-current-flags)))
-      (message "Idris command line arguments changed, restarting Idris")
-      (idris-quit)
-      (sit-for 0.01)) ; allows the sentinel to run and reset idris-process
-    ;; Start Idris if necessary
-    (when (not idris-process)
-      (setq idris-process
-            (get-buffer-process
-             (apply #'make-comint-in-buffer
-                    "idris"
-                    idris-process-buffer-name
-                    idris-interpreter-path
-                    nil
-                    "--ide-mode-socket"
-                    command-line-flags)))
-      (with-current-buffer idris-process-buffer-name
-        (add-hook 'comint-preoutput-filter-functions
-                  'idris-process-filter
-                  nil
-                  t)
-        (add-hook 'comint-output-filter-functions
-                  'idris-show-process-buffer
-                  nil
-                  t))
-      (set-process-sentinel idris-process 'idris-sentinel)
-      (setq idris-current-flags command-line-flags)
-      (accept-process-output idris-process 3))))
-
 (defun idris-connect (port)
   "Establish a connection with a Idris REPL at PORT."
   (when (not idris-connection)

Reply via email to