Emacs: close types buffer when editing buffer closes

This commit is contained in:
Milo Davis 2017-10-25 11:27:49 +02:00 committed by Benjamin Canou
parent 6c992b58df
commit 5ce950e168

View File

@ -827,6 +827,14 @@ Enables or disables stack and error display."
(michelson-type-at-point))))
(current-buffer))))
(defun michelson-close-output-buffer ()
"Close the interactive editing buffer."
(interactive)
(let ((buffer (get-buffer michelson-output-buffer-name)))
(when buffer
(let ((window (get-buffer-window buffer)))
(if window (quit-window t window) (kill-buffer buffer))))))
(define-derived-mode michelson-mode prog-mode "Michelson"
"Major mode for editing Michelson smart contracts."
(interactive)
@ -855,6 +863,7 @@ Enables or disables stack and error display."
(make-local-variable 'focus-in-hook)
'michelson-update-minibuffer-info)
(add-hook 'post-self-insert-hook 'michelson-clean-cache)
(add-hook 'kill-buffer-hook 'michelson-close-output-buffer t t)
(setq major-mode 'michelson-mode)
(setq mode-name "Michelson")
(setq indent-tabs-mode nil)