Skip to content

Commit

Permalink
Merge pull request #933 from zzkt/main
Browse files Browse the repository at this point in the history
a window-excursion for tidal.el
  • Loading branch information
yaxu authored Aug 3, 2022
2 parents 9f626e1 + 8a23a2c commit 33afc72
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions tidal.el
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,21 @@
(defun tidal-start-haskell ()
"Start haskell."
(interactive)
(if (comint-check-proc tidal-buffer)
(error "A tidal process is already running")
(apply
'make-comint
"tidal"
tidal-interpreter
nil
tidal-interpreter-arguments)
(tidal-see-output))
(tidal-send-string (concat ":script " tidal-boot-script-path)))
(save-window-excursion
(if (comint-check-proc tidal-buffer)
(when (yes-or-no-p
"A tidal process is already running. Do you want to restart it? ")
(tidal-restart-haskell))
(apply
'make-comint-in-buffer
"tidal"
tidal-buffer
tidal-interpreter
nil
tidal-interpreter-arguments)
(tidal-see-output))
(tidal-send-string (concat ":script " tidal-boot-script-path)))
(switch-to-buffer-other-window tidal-buffer))

(defun tidal-see-output ()
"Show haskell output."
Expand All @@ -122,6 +127,13 @@
(kill-buffer tidal-buffer)
(delete-other-windows))

(defun tidal-restart-haskell ()
"Restart haskell."
(interactive)
(let ((kill-buffer-query-functions nil))
(tidal-quit-haskell))
(tidal-start-haskell))

(defun tidal-chunk-string (n s)
"Split a string S into chunks of N characters."
(let* ((l (length s))
Expand Down

0 comments on commit 33afc72

Please sign in to comment.