diff --git a/plantuml-mode.el b/plantuml-mode.el index e40ba0d..8014a5e 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -404,7 +404,8 @@ Window is selected according to PREFIX: (when imagep (with-current-buffer buf (image-mode) - (set-buffer-multibyte t))))) + (set-buffer-multibyte t))) + (set-window-point (get-buffer-window buf 'visible) (point-min)))) (defun plantuml-jar-preview-string (prefix string buf) "Preview the diagram from STRING by running the PlantUML JAR. @@ -484,7 +485,8 @@ Put the result into buffer BUF, selecting the window according to PREFIX: to choose where to display it." (let ((b (get-buffer plantuml-preview-buffer))) (when b - (kill-buffer b))) + (with-current-buffer b + (erase-buffer)))) (let* ((imagep (and (display-images-p) (plantuml-is-image-output-p)))