Saner defaults for preview buffer location

This commit is contained in:
Carlo Sciolla 2017-08-26 22:06:51 +02:00
parent dc03882b90
commit 17fc31d7f8
No known key found for this signature in database
GPG Key ID: BA5D71E6F3C580C1
1 changed files with 6 additions and 5 deletions

View File

@ -241,9 +241,9 @@ default output type for new buffers."
(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:
- 4 (when prefixing the command with C-u) -> new window - 4 (when prefixing the command with C-u) -> current buffer
- 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 window"
(let ((b (get-buffer plantuml-preview-buffer))) (let ((b (get-buffer plantuml-preview-buffer)))
(when b (when b
(kill-buffer b))) (kill-buffer b)))
@ -262,12 +262,13 @@ to choose where to display it:
(lambda (_ps event) (lambda (_ps event)
(unless (equal event "finished\n") (unless (equal event "finished\n")
(error "PLANTUML Preview failed: %s" event)) (error "PLANTUML Preview failed: %s" event))
(cond (cond
((= 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 plantuml-preview-buffer))
(t (switch-to-buffer plantuml-preview-buffer))) (t (switch-to-buffer-other-window plantuml-preview-buffer)))
(when imagep (when imagep
(image-mode) (image-mode)
(set-buffer-multibyte t))))))) (set-buffer-multibyte t)))))))