branch: elpa/idris-mode
commit d48dbface36d96d5160e5fef42ca350726f59916
Author: Marek L <[email protected]>
Commit: Marek L <[email protected]>
Load current file only if command executed with prefix.
2. This aligns with similar behaviour of other languages in emacs
particularly clojure (cider).
---
idris-repl.el | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/idris-repl.el b/idris-repl.el
index 32e21801a8..d1e5c6bf50 100644
--- a/idris-repl.el
+++ b/idris-repl.el
@@ -188,10 +188,16 @@ If ALWAYS-INSERT is non-nil, always insert a prompt at
the end of the buffer."
(autoload 'idris-load-file-sync "idris-commands.el")
;;;###autoload
-(defun idris-switch-to-repl ()
- "Load the current Idris file buffer and jump to the Idris REPL."
- (interactive nil idris-mode)
- (idris-load-file-sync t)
+(defun idris-switch-to-repl (&optional load-file)
+ "Switch to the Idris REPL buffer.
+
+When executed in Idris file and LOAD-FILE is non-nil,
+the current file will be loaded into Idris before switching.
+Errors during file loading are ignored."
+ (interactive "P")
+ (if (and (derived-mode-p 'idris-mode) load-file)
+ (idris-load-file-sync t)
+ (idris-run))
(pop-to-buffer (idris-repl-buffer))
(goto-char (point-max)))