From 2e3d6640690163a8d4930501595e6a0d9bf5356b Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Sun, 23 Jul 2017 00:47:49 +0200 Subject: [PATCH] Michelson emacs-mode: auto resize type buffer. --- emacs/michelson-mode.el | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/emacs/michelson-mode.el b/emacs/michelson-mode.el index 3bc741ee5..901d69761 100644 --- a/emacs/michelson-mode.el +++ b/emacs/michelson-mode.el @@ -326,7 +326,27 @@ nil (setq message (concat message "\n"))) (setq message (concat message (cadr (cdr elt))))))) - (display-message-or-buffer message "*Michelson*")))) + (if (string= message "") + (setq message "\n No instruction at point.")) + (let + ((message-window + (display-buffer-below-selected + (get-buffer-create "*Michelson*") nil)) + (lines 0)) + (save-excursion + (set-buffer "*Michelson*") + (toggle-read-only nil) + (erase-buffer) + (insert message) + (toggle-read-only t) + (beginning-of-buffer) + (while (not (eobp)) + (vertical-motion 1) + (setq lines (+ 1 lines))) + (window-resize + message-window + (+ (- (max 4 lines) + (window-size message-window)) 1))))))) (defun michelson-update-minibuffer-info () (when (nth 2 michelson-state) (cancel-timer (nth 2 michelson-state)))