Skip to content

Commit

Permalink
Update idris-compile-and-execute for Idris2
Browse files Browse the repository at this point in the history
Backport of idris2-compile-and-execute from https://github.com/idris-community/idris2-mode/pull/20/files
with preserving backward compatibility for Idris 1

Co-authored-by: "G. Allais" <guillaume.allais@ens-lyon.org>
  • Loading branch information
keram and gallais committed Nov 29, 2022
1 parent 8ff4a2d commit e350ed2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions idris-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,15 @@ Otherwise, case split as a pattern variable."
;; make sure point is at new defn
(goto-char end)))))))))))


(defun idris-compile-and-execute ()
"Execute the program in the current buffer"
"Execute the program in the current buffer."
(interactive)
(idris-load-file-sync)
(idris-eval '(:interpret ":exec")))
(if (>=-protocol-version 2 1)
(let ((name (read-string "MExpression to compile & execute (default main): "
nil nil "main")))
(idris-repl-eval-string (format ":exec %s" name) 0))
(idris-eval '(:interpret ":exec"))))

(defvar-local proof-region-start nil
"The start position of the last proof region.")
Expand Down

0 comments on commit e350ed2

Please sign in to comment.