#15 preview mode as a new window
This commit is contained in:
parent
966064f371
commit
d47fb89c08
17
puml-mode.el
17
puml-mode.el
|
@ -194,7 +194,8 @@ default output type for new buffers."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((b (get-buffer puml-preview-buffer)))
|
(let ((b (get-buffer puml-preview-buffer)))
|
||||||
(when b
|
(when b
|
||||||
(kill-buffer b)))
|
(with-current-buffer puml-preview-buffer
|
||||||
|
(let ((inhibit-read-only t)) (erase-buffer)))))
|
||||||
|
|
||||||
(let* ((imagep (and (display-images-p)
|
(let* ((imagep (and (display-images-p)
|
||||||
(puml-is-image-output-p)))
|
(puml-is-image-output-p)))
|
||||||
|
@ -202,20 +203,25 @@ default output type for new buffers."
|
||||||
(buf (get-buffer-create puml-preview-buffer))
|
(buf (get-buffer-create puml-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)))
|
||||||
|
|
||||||
(let ((ps (start-process "PUML" buf
|
(let ((ps (start-process "PUML" buf
|
||||||
"java" "-jar" (shell-quote-argument puml-plantuml-jar-path)
|
"java" "-jar" (shell-quote-argument puml-plantuml-jar-path)
|
||||||
(puml-output-type-opt) "-p")))
|
(puml-output-type-opt) "-p")))
|
||||||
|
|
||||||
(process-send-region ps (point-min) (point-max))
|
(process-send-region ps (point-min) (point-max))
|
||||||
(process-send-eof ps)
|
(process-send-eof ps)
|
||||||
(set-process-sentinel ps
|
(set-process-sentinel ps
|
||||||
(lambda (ps event)
|
(lambda (ps event)
|
||||||
(unless (equal event "finished\n")
|
(unless (equal event "finished\n")
|
||||||
(error "PUML Preview failed: %s" event))
|
(error "PUML Preview failed: %s" event))
|
||||||
(switch-to-buffer puml-preview-buffer)
|
(let ((split-width-threshold 0)
|
||||||
|
(split-height-threshold nil))
|
||||||
|
(display-buffer puml-preview-buffer))
|
||||||
(when imagep
|
(when imagep
|
||||||
(image-mode)
|
(with-current-buffer puml-preview-buffer
|
||||||
(set-buffer-multibyte t)))))))
|
(image-mode))
|
||||||
|
(set-buffer-multibyte t))
|
||||||
|
)
|
||||||
|
))))
|
||||||
|
|
||||||
(unless puml-plantuml-kwdList
|
(unless puml-plantuml-kwdList
|
||||||
(puml-init)
|
(puml-init)
|
||||||
|
@ -280,7 +286,6 @@ default output type for new buffers."
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-derived-mode puml-mode prog-mode "puml"
|
(define-derived-mode puml-mode prog-mode "puml"
|
||||||
"Major mode for plantuml.
|
"Major mode for plantuml.
|
||||||
|
|
||||||
Shortcuts Command Name
|
Shortcuts Command Name
|
||||||
\\[puml-complete-symbol] `puml-complete-symbol'"
|
\\[puml-complete-symbol] `puml-complete-symbol'"
|
||||||
(make-local-variable 'puml-output-type)
|
(make-local-variable 'puml-output-type)
|
||||||
|
|
Loading…
Reference in New Issue