Skip to content

Commit

Permalink
Remove idris-mode event hooks on closing Idris connection
Browse files Browse the repository at this point in the history
Why:
to allow change hooks after restart of Idris connection
  • Loading branch information
keram committed Dec 11, 2022
1 parent 723e778 commit c84ed5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions idris-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,10 @@ type-correct, so loading will fail."
(let ((bufs (list :connection :repl :proof-obligations :proof-shell :proof-script :log :info :notes :holes :tree-viewer)))
(dolist (b bufs) (idris-kill-buffer b))))

(defun idris-remove-event-hooks ()
"Remove Idris event hooks set after connection with Idris established."
(dolist (h idris-event-hooks) (remove-hook 'idris-event-hooks h)))

(defun idris-pop-to-repl ()
"Go to the REPL, if one is open."
(interactive)
Expand Down Expand Up @@ -988,6 +992,7 @@ https://github.com/clojure-emacs/cider"
(setq idris-loaded-region-overlay nil)))
(idris-prover-end)
(idris-kill-buffers)
(idris-remove-event-hooks)
(setq idris-process-current-working-directory nil)
(setq idris-protocol-version 0
idris-protocol-version-minor 0)))
Expand Down
2 changes: 1 addition & 1 deletion inferior-idris.el
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ directory variables.")
(defvar idris-continuation-counter 1
"Continuation serial number counter.")

(defvar idris-event-hooks)
(defvar idris-event-hooks '())

(defun idris-dispatch-event (event process)
(or (run-hook-with-args-until-success 'idris-event-hooks event)
Expand Down

0 comments on commit c84ed5a

Please sign in to comment.