Rewrite start-process to remove eval-and-compile

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:
Niklas Carlsson 2018-11-28 10:48:30 +01:00
parent b358a53bb0
commit af786a4601
1 changed files with 16 additions and 19 deletions

View File

@ -94,18 +94,15 @@
:type 'string :type 'string
:group 'plantuml) :group 'plantuml)
(eval-and-compile (defcustom plantuml-java-args (list "-Djava.awt.headless=true" "-jar")
(defcustom plantuml-java-args (list "-Djava.awt.headless=true" "-jar") "The parameters passed to `plantuml-java-command' when executing PlantUML."
"The parameters passed to `plantuml-java-command' when executing PlantUML." :type '(repeat string)
:type '(repeat string) :group 'plantuml)
:group 'plantuml))
(defcustom plantuml-jar-args (list "-charset" "UTF-8" )
(eval-and-compile "The parameters passed to `plantuml.jar', when executing PlantUML."
(defcustom plantuml-jar-args (list "-charset" "UTF-8" ) :type '(repeat string)
"The parameters passed to `plantuml.jar', when executing PlantUML." :group 'plantuml)
:type '(repeat string)
:group 'plantuml))
(defcustom plantuml-suppress-deprecation-warning t (defcustom plantuml-suppress-deprecation-warning t
"To silence the deprecation warning when `puml-mode' is found upon loading." "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." "Create the flag to pass to PlantUML to produce the selected output format."
(concat "-t" plantuml-output-type)) (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)." "Run PlantUML as an Emacs process and puts the output into the given buffer (as BUF)."
`(start-process "PLANTUML" ,buf (apply #'start-process
plantuml-java-command "PLANTUML" buf plantuml-java-command
,@plantuml-java-args `(,@plantuml-java-args
(expand-file-name plantuml-jar-path) ,(expand-file-name plantuml-jar-path)
(plantuml-output-type-opt) ,(plantuml-output-type-opt)
,@plantuml-jar-args ,@plantuml-jar-args
"-p")) "-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)