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.
This commit is contained in:
niklascarlsson 2019-01-07 21:15:41 +01:00 committed by Carlo Sciolla
parent b358a53bb0
commit 49f707b20c
1 changed files with 16 additions and 19 deletions

View File

@ -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)