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.
This commit is contained in:
parent
fec1d4fb9d
commit
ce4e3feaa8
|
@ -479,15 +479,14 @@ Put the result into buffer BUF, selecting the window according to PREFIX:
|
||||||
(defun plantuml-preview-string (prefix string)
|
(defun plantuml-preview-string (prefix string)
|
||||||
"Preview diagram from PlantUML sources (as STRING), using prefix (as PREFIX)
|
"Preview diagram from PlantUML sources (as STRING), using prefix (as PREFIX)
|
||||||
to choose where to display it."
|
to choose where to display it."
|
||||||
(let ((b (get-buffer plantuml-preview-buffer)))
|
|
||||||
(when b
|
|
||||||
(kill-buffer b)))
|
|
||||||
|
|
||||||
(let* ((imagep (and (display-images-p)
|
(let* ((imagep (and (display-images-p)
|
||||||
(plantuml-is-image-output-p)))
|
(plantuml-is-image-output-p)))
|
||||||
(buf (get-buffer-create plantuml-preview-buffer))
|
(buf (get-buffer-create plantuml-preview-buffer))
|
||||||
(coding-system-for-read (and imagep 'binary))
|
(coding-system-for-read (and imagep 'binary))
|
||||||
(coding-system-for-write (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)))
|
(plantuml-exec-mode-preview-string prefix (plantuml-get-exec-mode) string buf)))
|
||||||
|
|
||||||
(defun plantuml-preview-buffer (prefix)
|
(defun plantuml-preview-buffer (prefix)
|
||||||
|
|
Loading…
Reference in New Issue