Patch amended, PNG still not working >:(
This commit is contained in:
parent
5ed5f8321c
commit
4758925ce9
36
puml-mode.el
36
puml-mode.el
|
@ -116,23 +116,35 @@
|
||||||
|
|
||||||
(defconst puml-preview-buffer "*PUML Preview*")
|
(defconst puml-preview-buffer "*PUML Preview*")
|
||||||
|
|
||||||
(defun puml-output-type-opt ()
|
(defun puml-output-type ()
|
||||||
"Detect displayable format."
|
"Detects the best output type to use for generated diagrams."
|
||||||
(if (display-images-p)
|
(cond ((image-type-available-p 'svg) 'svg)
|
||||||
"-tsvg"
|
; TODO: PNG is not yet supported, see issue #6
|
||||||
"-tutxt"))
|
((image-type-available-p 'png) 'utxt)
|
||||||
|
('utxt)))
|
||||||
|
|
||||||
(defun puml-preview-sentinel (ps findescr)
|
(defun puml-is-image-output-p ()
|
||||||
"Sentinel of preview process"
|
"Return true if the diagram output format is an image, false if it's text based."
|
||||||
(if (equal findescr "finished\n")
|
(not (equalp 'utxt
|
||||||
|
(puml-output-type))))
|
||||||
|
|
||||||
|
(defun puml-output-type-opt ()
|
||||||
|
"Create the flag to pass to PlantUML to produce the selected output format."
|
||||||
|
(let ((type (puml-output-type)))
|
||||||
|
(concat "-t" (symbol-name type))))
|
||||||
|
|
||||||
|
(defun puml-preview-sentinel (ps event)
|
||||||
|
"For the PlantUML process (as PS) reacts on the termination event (as EVENT)."
|
||||||
|
(if (equal event "finished\n")
|
||||||
(progn
|
(progn
|
||||||
(switch-to-buffer puml-preview-buffer)
|
(switch-to-buffer puml-preview-buffer)
|
||||||
(when (display-images-p)
|
(when (and (display-images-p)
|
||||||
(image-mode)))
|
(puml-is-image-output-p))
|
||||||
(warn "PUML Preview failed: %s" findescr)))
|
(image-mode)))
|
||||||
|
(warn "PUML Preview failed: %s" event)))
|
||||||
|
|
||||||
(defun puml-preview ()
|
(defun puml-preview ()
|
||||||
"Preview diagram"
|
"Preview diagram."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((b (get-buffer puml-preview-buffer)))
|
(let ((b (get-buffer puml-preview-buffer)))
|
||||||
(when b
|
(when b
|
||||||
|
|
Loading…
Reference in New Issue