From ce4e3feaa8bf5a3c0771c6004a4c60d0d55a0aab Mon Sep 17 00:00:00 2001 From: Tim Jones Date: Mon, 21 Oct 2019 09:41:17 +0100 Subject: [PATCH] Don't delete the preview buffer before re-creating the preview, just clear it and re-use the same buffer. Otherwise the preview buffer re-appears all over the place when many other buffers are open. --- plantuml-mode.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plantuml-mode.el b/plantuml-mode.el index d514751..18c2f42 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -479,15 +479,14 @@ Put the result into buffer BUF, selecting the window according to PREFIX: (defun plantuml-preview-string (prefix string) "Preview diagram from PlantUML sources (as STRING), using prefix (as PREFIX) to choose where to display it." - (let ((b (get-buffer plantuml-preview-buffer))) - (when b - (kill-buffer b))) - (let* ((imagep (and (display-images-p) (plantuml-is-image-output-p))) (buf (get-buffer-create plantuml-preview-buffer)) (coding-system-for-read (and imagep 'binary)) (coding-system-for-write (and imagep 'binary))) + (with-current-buffer buf + (image-toggle-display-text) + (erase-buffer)) (plantuml-exec-mode-preview-string prefix (plantuml-get-exec-mode) string buf))) (defun plantuml-preview-buffer (prefix)