Reverted chagnes and replaced switch-buffer with display-buffer

This commit is contained in:
wailo 2019-05-01 15:51:31 +02:00
parent a8e0b5cd56
commit 794ef40c19
1 changed files with 20 additions and 14 deletions

View File

@ -262,14 +262,18 @@ to choose where to display it:
- 4 (when prefixing the command with C-u) -> new window - 4 (when prefixing the command with C-u) -> new window
- 16 (when prefixing the command with C-u C-u) -> new frame. - 16 (when prefixing the command with C-u C-u) -> new frame.
- else -> new buffer" - else -> new buffer"
(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)))
(process-connection-type nil) (process-connection-type nil)
(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-output-to-temp-buffer plantuml-preview-buffer (let ((ps (plantuml-start-process buf)))
(let* ((buf (get-buffer-create plantuml-preview-buffer)) (ps (plantuml-start-process buf)))
(process-send-string ps string) (process-send-string ps string)
(process-send-eof ps) (process-send-eof ps)
(set-process-sentinel ps (set-process-sentinel ps
@ -280,8 +284,10 @@ to choose where to display it:
((= prefix 16) ((= prefix 16)
(switch-to-buffer-other-frame plantuml-preview-buffer)) (switch-to-buffer-other-frame plantuml-preview-buffer))
((= prefix 4) ((= prefix 4)
(switch-to-buffer-other-window plantuml-preview-buffer))) (switch-to-buffer-other-window plantuml-preview-buffer))
(t (display-buffer plantuml-preview-buffer)))
(when imagep (when imagep
(with-current-buffer plantuml-preview-buffer
(image-mode) (image-mode)
(set-buffer-multibyte t)))))))) (set-buffer-multibyte t))))))))