From 49f707b20cd8f8dc27e4b1f3748a9ef58fb00afe Mon Sep 17 00:00:00 2001 From: niklascarlsson Date: Mon, 7 Jan 2019 21:15:41 +0100 Subject: [PATCH] Rewrite start-process to remove eval-and-compile (#82) Wrapping the defcustoms in eval-and-compile made the code compileable but not customizable for the user. Rewriting the start-process into a function instead of a macro makes it possible to remove the eval-and-compiles. --- plantuml-mode.el | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/plantuml-mode.el b/plantuml-mode.el index 5d471b6..733f95c 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -94,18 +94,15 @@ :type 'string :group 'plantuml) -(eval-and-compile - (defcustom plantuml-java-args (list "-Djava.awt.headless=true" "-jar") - "The parameters passed to `plantuml-java-command' when executing PlantUML." - :type '(repeat string) - :group 'plantuml)) +(defcustom plantuml-java-args (list "-Djava.awt.headless=true" "-jar") + "The parameters passed to `plantuml-java-command' when executing PlantUML." + :type '(repeat string) + :group 'plantuml) - -(eval-and-compile - (defcustom plantuml-jar-args (list "-charset" "UTF-8" ) - "The parameters passed to `plantuml.jar', when executing PlantUML." - :type '(repeat string) - :group 'plantuml)) +(defcustom plantuml-jar-args (list "-charset" "UTF-8" ) + "The parameters passed to `plantuml.jar', when executing PlantUML." + :type '(repeat string) + :group 'plantuml) (defcustom plantuml-suppress-deprecation-warning t "To silence the deprecation warning when `puml-mode' is found upon loading." @@ -245,15 +242,15 @@ default output type for new buffers." "Create the flag to pass to PlantUML to produce the selected output format." (concat "-t" plantuml-output-type)) -(defmacro 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)." - `(start-process "PLANTUML" ,buf - plantuml-java-command - ,@plantuml-java-args - (expand-file-name plantuml-jar-path) - (plantuml-output-type-opt) - ,@plantuml-jar-args - "-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)