Skip to content

Commit ca1e5fd

Browse files
authored
Merge pull request #641 from keram/idris-quit-v2
Simplify idris-quit
2 parents 5b2ba0a + 51becb1 commit ca1e5fd

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

idris-commands.el

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -925,10 +925,8 @@ type-correct, so loading will fail."
925925
(idris-compiler-notes-list-show (reverse idris-raw-warnings))))
926926

927927
(defun idris-kill-buffers ()
928-
(idris-warning-reset-all)
929-
(setq idris-currently-loaded-buffer nil)
930928
;; not killing :events since it it tremendously useful for debuging
931-
(let ((bufs (list :connection :repl :proof-obligations :proof-shell :proof-script :log :info :notes :holes :tree-viewer)))
929+
(let ((bufs (list :repl :proof-obligations :proof-shell :proof-script :log :info :notes :holes :tree-viewer)))
932930
(dolist (b bufs) (idris-kill-buffer b))))
933931

934932
(defun idris-remove-event-hooks ()
@@ -960,7 +958,7 @@ https://github.com/clojure-emacs/cider"
960958
(interactive)
961959
(let ((command-line-flags (idris-compute-flags)))
962960
;; Kill the running Idris if the command-line flags need updating
963-
(when (and (get-buffer-process (get-buffer idris-connection-buffer-name))
961+
(when (and (get-buffer-process idris-connection-buffer-name)
964962
(not (equal command-line-flags idris-current-flags)))
965963
(message "Idris command line arguments changed, restarting Idris")
966964
(idris-quit)
@@ -992,28 +990,26 @@ https://github.com/clojure-emacs/cider"
992990
(defun idris-quit ()
993991
"Quit the Idris process, cleaning up the state synchronized with Emacs."
994992
(interactive)
995-
(setq idris-prover-currently-proving nil)
996-
(let* ((pbuf (get-buffer idris-process-buffer-name))
997-
(cbuf (get-buffer idris-connection-buffer-name)))
998-
(when cbuf
999-
(when (get-buffer-process cbuf)
1000-
(with-current-buffer cbuf (delete-process nil))) ; delete connection without asking
1001-
(kill-buffer cbuf))
1002-
(when pbuf
1003-
(when (get-buffer-process pbuf)
1004-
(with-current-buffer pbuf (delete-process nil))) ; delete process without asking
1005-
(kill-buffer pbuf)
1006-
(unless (get-buffer idris-process-buffer-name) (idris-kill-buffers))
1007-
(setq idris-rex-continuations '())
1008-
(when idris-loaded-region-overlay
1009-
(delete-overlay idris-loaded-region-overlay)
1010-
(setq idris-loaded-region-overlay nil)))
1011-
(idris-prover-end)
1012-
(idris-kill-buffers)
1013-
(idris-remove-event-hooks)
1014-
(setq idris-process-current-working-directory nil)
1015-
(setq idris-protocol-version 0
1016-
idris-protocol-version-minor 0)))
993+
(if (get-buffer-process idris-process-buffer-name)
994+
(delete-process idris-process-buffer-name))
995+
(if (get-buffer-process idris-connection-buffer-name)
996+
(delete-process idris-connection-buffer-name))
997+
(if (get-buffer idris-process-buffer-name)
998+
(kill-buffer idris-process-buffer-name))
999+
(if (get-buffer idris-connection-buffer-name)
1000+
(kill-buffer idris-connection-buffer-name))
1001+
(if idris-loaded-region-overlay
1002+
(delete-overlay idris-loaded-region-overlay))
1003+
(idris-prover-end)
1004+
(idris-warning-reset-all)
1005+
(idris-remove-event-hooks)
1006+
(idris-kill-buffers)
1007+
(setq idris-loaded-region-overlay nil
1008+
idris-currently-loaded-buffer nil
1009+
idris-rex-continuations '()
1010+
idris-process-current-working-directory nil
1011+
idris-protocol-version 0
1012+
idris-protocol-version-minor 0))
10171013

10181014
(defun idris-delete-ibc (no-confirmation)
10191015
"Delete the IBC file for the current buffer.

0 commit comments

Comments
 (0)