From f4ba436d177c92c5e5af1e1e807569bbefccc2f6 Mon Sep 17 00:00:00 2001 From: Felix Weilbach Date: Sun, 31 Mar 2019 14:35:25 +0200 Subject: [PATCH] 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 --- plantuml-mode.el | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/plantuml-mode.el b/plantuml-mode.el index 2cf2cf6..e16a9ee 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -93,6 +93,16 @@ keymap) "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" "The java command used to execute PlantUML." :type 'string @@ -164,7 +174,7 @@ (defun plantuml-init () "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)) (with-temp-buffer (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) "Run PlantUML as an Emacs process and puts the output into the given buffer (as BUF)." - (apply #'start-process - "PLANTUML" buf plantuml-java-command - `(,@plantuml-java-args - ,(expand-file-name plantuml-jar-path) - ,(plantuml-output-type-opt) - ,@plantuml-jar-args - "-p"))) + (if plantuml-run-as-executable + (apply #'start-process + "PLANTUML" buf plantuml-executable-path + `(,(plantuml-output-type-opt) + "-p")) + (apply #'start-process + "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) "Preview diagram from PlantUML sources (as STRING), using prefix (as PREFIX)