#6 Use 'binary coding for reading the PNG output / writing to the preview buffer

This commit is contained in:
Carlo Sciolla 2015-09-26 09:24:22 +02:00
parent 769f88a4ad
commit ff322bf843
2 changed files with 7 additions and 6 deletions

View File

@ -8,7 +8,7 @@ PlantUML mode for Emacs
> “Pummel me all you want," I say. "Pummel me to death, in fact. My answers will not change."
> The Invierno step back, frowning. "You must love her very much," he says, not unkindly.”
>
>
> from [The Bitter Kingdom - Fire and Thorns #3](https://www.goodreads.com/book/show/11431896-the-bitter-kingdom)
@ -51,7 +51,7 @@ You can either tell `puml-mode` to autocomplete the word before the cursor by ty
To render the PlantUML diagram within Emacs, you can also hit `M-x puml-preview`. This will run PlantUML and display the result in the `*PUML-Preview*` buffer. The format used to render the diagram is automagically chosen from what's supported by your Emacs. It will be one of the following, in order of preference:
- SVG
- ~~PNG~~ **still unsupported, see [#6](https://github.com/skuro/puml-mode/issues/6)**
- PNG
- Unicode ASCII art
Default key bindings

View File

@ -6,7 +6,7 @@
;; Author: Zhang Weize (zwz)
;; Maintainer: Carlo Sciolla (skuro)
;; Keywords: uml plantuml ascii
;; Version: 0.5
;; Version: 0.6
;; You can redistribute this program and/or modify it under the terms
;; of the GNU General Public License as published by the Free Software
@ -120,8 +120,7 @@
(defun puml-output-type ()
"Detects the best output type to use for generated diagrams."
(cond ((image-type-available-p 'svg) 'svg)
; TODO: PNG is not yet supported, see issue #6
((image-type-available-p 'png) 'utxt)
((image-type-available-p 'png) 'png)
('utxt)))
(defun puml-is-image-output-p ()
@ -151,7 +150,9 @@
(when b
(kill-buffer b)))
(let ((process-connection-type nil)
(buf (get-buffer-create puml-preview-buffer)))
(buf (get-buffer-create puml-preview-buffer))
(coding-system-for-read 'binary)
(coding-system-for-write 'binary))
(let ((ps (start-process "PUML" buf
"java" "-jar" (shell-quote-argument puml-plantuml-jar-path)
(puml-output-type-opt) "-p")))