From 17fc31d7f83af3b239e8d64e185695438ca7424a Mon Sep 17 00:00:00 2001 From: Carlo Sciolla Date: Sat, 26 Aug 2017 22:06:51 +0200 Subject: [PATCH] Saner defaults for preview buffer location --- plantuml-mode.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plantuml-mode.el b/plantuml-mode.el index aed962e..eca66cf 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -241,9 +241,9 @@ default output type for new buffers." (defun plantuml-preview-string (prefix string) "Preview diagram from PlantUML sources (as STRING), using prefix (as PREFIX) to choose where to display it: -- 4 (when prefixing the command with C-u) -> new window -- 16 (when prefixing the command with C-u C-u) -> new frame. -- else -> new buffer" +- 4 (when prefixing the command with C-u) -> current buffer +- 16 (when prefixing the command with C-u C-u) -> new frame +- else -> new window" (let ((b (get-buffer plantuml-preview-buffer))) (when b (kill-buffer b))) @@ -262,12 +262,13 @@ to choose where to display it: (lambda (_ps event) (unless (equal event "finished\n") (error "PLANTUML Preview failed: %s" event)) + (cond ((= prefix 16) (switch-to-buffer-other-frame plantuml-preview-buffer)) ((= prefix 4) - (switch-to-buffer-other-window plantuml-preview-buffer)) - (t (switch-to-buffer plantuml-preview-buffer))) + (switch-to-buffer plantuml-preview-buffer)) + (t (switch-to-buffer-other-window plantuml-preview-buffer))) (when imagep (image-mode) (set-buffer-multibyte t)))))))