Added functionality for running plantuml as a executable

Added functionality for running plantuml as a executable

Added functionality for running plantuml as a executable, not as jar
This commit is contained in:
Felix Weilbach 2019-03-31 14:35:25 +02:00
parent 2b84a2df52
commit f4ba436d17
1 changed files with 23 additions and 8 deletions

View File

@ -93,6 +93,16 @@
keymap) keymap)
"Keymap for plantuml-mode.") "Keymap for plantuml-mode.")
(defcustom plantuml-run-as-executable nil
"Run plantuml as normal executable. Not as a jar."
:type 'boolean
:group 'plantuml)
(defcustom plantuml-executable-path "plantuml"
"Path to the plantuml executable."
:type 'string
:group 'plantuml)
(defcustom plantuml-java-command "java" (defcustom plantuml-java-command "java"
"The java command used to execute PlantUML." "The java command used to execute PlantUML."
:type 'string :type 'string
@ -164,7 +174,7 @@
(defun plantuml-init () (defun plantuml-init ()
"Initialize the keywords or builtins from the cmdline language output." "Initialize the keywords or builtins from the cmdline language output."
(unless (or (eq system-type 'cygwin) (file-exists-p plantuml-jar-path)) (unless (or (eq system-type 'cygwin) (file-exists-p plantuml-jar-path) plantuml-run-as-executable)
(error "Could not find plantuml.jar at %s" plantuml-jar-path)) (error "Could not find plantuml.jar at %s" plantuml-jar-path))
(with-temp-buffer (with-temp-buffer
(let ((cmd-args (append (list plantuml-java-command nil t nil) (let ((cmd-args (append (list plantuml-java-command nil t nil)
@ -248,13 +258,18 @@ default output type for new buffers."
(defun plantuml-start-process (buf) (defun plantuml-start-process (buf)
"Run PlantUML as an Emacs process and puts the output into the given buffer (as BUF)." "Run PlantUML as an Emacs process and puts the output into the given buffer (as BUF)."
(apply #'start-process (if plantuml-run-as-executable
"PLANTUML" buf plantuml-java-command (apply #'start-process
`(,@plantuml-java-args "PLANTUML" buf plantuml-executable-path
,(expand-file-name plantuml-jar-path) `(,(plantuml-output-type-opt)
,(plantuml-output-type-opt) "-p"))
,@plantuml-jar-args (apply #'start-process
"-p"))) "PLANTUML" buf plantuml-java-command
`(,@plantuml-java-args
,(expand-file-name plantuml-jar-path)
,(plantuml-output-type-opt)
,@plantuml-jar-args
"-p"))))
(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)