Jarmo Hurri <jarmo.hu...@iki.fi> writes:

>> Note that I will need to confirm the assignment before I can commit
>> your patch.
>
> My records contain my assignment signed by an FSF person John Sullivan,
> dated 2012-10-12. Should I email a copy of the document to you? The
> document also contains what looks like an id number starting with "RT:",
> but I do not know whether I am allowed to share it.

Never mind that. I missed that you are recorded with your full name in
the copyright file. Your copyright status is fine.

For savannah access, I note that you used a different email host in the
fsf records. Maybe you registered using that address.

> I was slacking because this is an internal function. Hopefully better
> now.

See a couple of suggestions in the attached diff.

>> I am wondering if it makes sense to pass arbitrary encoding
>> here. AFAIU, the encoding specifies input encoding and that's what Org
>> mode controls, not user. In fact, we can even explicitly specific
>> utf-8 in (with-temp-file in-file (insert body)) by let-binding
>> `coding-system-for-write' around. I suspect that users will never use
>> :encoding parameter and if they do, they will run into problems as
>> they can't easily control the encoding ob-ditaa uses to write the
>> file. (Is it even useful to have custom encoding?)
>
> Good question, I have never used it.
>
> The current version specifies encoding via :java in default header args,
> so it is possible for the user to change it. I wanted to provide the
> same functionality, but instead of java pass encoding directly to ditaa
> so that it would be available regardless of whether ditaa is run via the
> ditaa executable or java and jar.
>
> Let me know if you want this functionality to be changed.

IMHO, the right thing to do will be
1. Forcing utf-8 when saving the temporary ditaa input file
2. Passing UTF-8 as default encoding to ditaa

I see no reason why users would need to change this setting.

diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
index 072b4c8df..3f71cfa04 100644
--- a/lisp/ob-ditaa.el
+++ b/lisp/ob-ditaa.el
@@ -136,10 +136,7 @@ (defcustom org-ditaa-eps-jar-path
   :type 'string)
 
 (defun ob-ditaa--ensure-jar-file (file)
-  "Check whether file exists.
-
-Return file if it exists, signal error otherwise. Small internal helper
-function used by ob-ditaa."
+  "Return FILE if it exists, signal error otherwise."
   (if (file-exists-p file)
       file
     (error "(ob-ditaa) Could not find jar file %s" file)))
@@ -151,10 +148,10 @@ (defun org-babel-execute:ditaa (body params)
          (out-file-suffix (file-name-extension out-file))
          ;; backwards-compatibility of :eps and :pdf header arguments
          ;; notice that these take precedence over file type (suffix)
-         (legacy-eps (cdr (assq :eps params))) 
+         (legacy-eps (cdr (assq :eps params)))
          (legacy-pdf (cdr (assq :pdf params))))
     (when (and legacy-eps legacy-pdf)
-      (error "(ob-ditaa) Both :eps and :pdf legacy output types specified."))
+      (error "(ob-ditaa) Both :eps and :pdf legacy output types specified"))
     (let* ((legacy-output-type (or legacy-eps legacy-pdf))
            (eps (or legacy-eps (string= out-file-suffix "eps")))
            (pdf (or legacy-pdf (string= out-file-suffix "pdf")))
@@ -181,6 +178,8 @@ (defun org-babel-execute:ditaa (body params)
                         (when svg (concat " " "--svg"))
                         (when ditaa-encoding (concat " " "-e " ditaa-encoding))
                         " " in-file " " ditaa-out-file)))
+      (unless (or eps pdf svg png)
+        (error "Unknown output file extension: %s" out-file-suffix))
       (with-temp-file in-file (insert body))
       (shell-command cmd)
       (when pdf
-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to