Greetings again.

Ihor Radchenko <[email protected]> writes:

>> -(defcustom org-ditaa-jar-option "-jar"
>> -  "Option for the ditaa jar file.
>> -Do not leave leading or trailing spaces in this string."
>> -  :group 'org-babel
>> -  :version "24.1"
>> -  :type 'string)
>
> You completely removed this defcustom.  Note that it is intentional
> and aims to address some reported bug. See
> https://list.orgmode.org/orgmode/CABwL-UjJFXfH_2KsJSx9CJnvEMbwRy9AtFzADykKc5AEC=0...@mail.gmail.com/

I can not grasp the purpose of this defcustom.

First, documentation of org-ditaa-jar-option states

"Do not leave leading or trailing spaces in this string."

But when it is used, it is surrounded by both a leading and a trailing
space, which to me defeats the intent of the documentation:

(cmd (concat org-babel-ditaa-java-cmd
             " " java " " org-ditaa-jar-option " "

Second, in the thread where this feature was discussed, the initial
solution suggested was to prepend an absolute path "c:/cygwin" to
org-ditaa-jar-path (well, the absolute path was actually prepended to
three different paths):

https://list.orgmode.org/orgmode/cabwl-ui11i+qoxehyrpse2oeho0cbpqrjlcio63enzi06b6...@mail.gmail.com/

(cmd (concat "java " java " -jar c:/cygwin"
      (shell-quote-argument
       (expand-file-name org-ditaa-jar-path))
      " " cmdline
      " c:/cygwin" (org-babel-process-file-name in-file)
      " c:/cygwin" (org-babel-process-file-name out-file))))

Notice that in that suggestion, " -jar c:/cygwin" takes the role of the
current org-ditaa-jar-option, and does _not_ have a trailing space
attached to it. But, most importantly, org-ditaa-jar-path is a defcustom
in itself, so is there a reason the absolute path could not be specified
directly using org-ditaa-jar-path?

Looking back at the commit where the option was introduced

[jarmo org-mode]$ git show --name-only d3a45bd72
commit d3a45bd7221578e9e3f4ca08b8ee9d0d1a5e9bbc
Author: Bastien Guerry <[email protected]>
Date:   Wed Jan 4 11:22:28 2012 +0100

    ob-ditaa.el: New option `org-ditaa-jar-option'.
    
    * ob-ditaa.el (org-ditaa-jar-path): Make a defcustom.
    (org-ditaa-jar-option): New option.
    (org-babel-execute:ditaa): Use it.
    
    Thanks to Waldemar Reusch for reporting this need.
    
[jarmo org-mode]$ git show d3a45bd72:lisp/ob-ditaa.el

I can see that org-ditaa-jar-path already existed as a defcustom (but
its default value was nil):

(defcustom org-ditaa-jar-path nil
  "Path for the ditaa jar file."
  :group 'org-babel
  :type 'string)

So, overall I think that

1. this defcustom (org-ditaa-jar-option) does not fulfill its original
   purpose because of the trailing space attached to it automatically

2. the original issue can be solved by using org-ditaa-jar-path;
   furthermore, because of the trailing space issue, I suspect that
   users who currently solve this problem in fact use org-ditaa-jar-path
   instead of org-ditaa-jar-option

Therefore, If I have undestood this correctly

1. removing the defcustom (org-ditaa-jar-option) would probably not break
   any user code
2. fixing org-ditaa-jar-option to fulfill its original purpose (by
   removing the automatically attached trailing space) might break some
   user code if org-ditaa-jar-option is in fact used by someone
3. safest choice would probably be to make org-ditaa-jar-option an
   obsolete variable and use it istead of "-jar" if defined.

What is your decision?

All the best,

Jarmo


Reply via email to