Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse the old preview buffer/window such that display-buffer behaves #160

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions plantuml-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -482,9 +483,10 @@ 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)))
(when-let ((b (get-buffer plantuml-preview-buffer))
(inhibit-read-only t))
(with-current-buffer b
(erase-buffer)))

(let* ((imagep (and (display-images-p)
(plantuml-is-image-output-p)))
Expand Down