emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Jarmo Hurri <jarmo.hurri@iki.fi>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-ditaa.el: custom var name, ditaa executable, SVG output, and chararacter encoding
Date: Sun, 03 Nov 2024 17:45:01 +0000	[thread overview]
Message-ID: <87msiggqjm.fsf@localhost> (raw)
In-Reply-To: <875xp476pt.fsf@iki.fi>

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

> Please find attached a patch written mainly to allow a ditaa executable
> to be used instead of a JAR file. Assuming that this patch is
> (eventually) accepted, I can also volunteer to be a maintainer for this
> file if one is needed.

Thanks for the patch and for volunteering to be a maintainer!

Note that we will also need to update
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ditaa.html
after we finalize changes in the code.

See some initial comments below.

> -(defcustom org-babel-ditaa-java-cmd "java"

> +(defcustom org-ditaa-java-exec "java"
> +  "Java executable to use when evaluating ditaa blocks using a JAR."
> +  :group 'org-babel
> +  :type 'string)

We generally do not rename variables irreversibly.
Please leave an obsolete alias for `org-babel-ditaa-java-cmd' pointing
to the new variable name. Otherwise, the existing configs that were
using the old variable name will be broken.

> +;;; small helper function returning file if it exists and signalling
> +;;; error otherwise
> +(defun org-ditaa-ensure-jar-file (file)
> +  (if (file-exists-p file)
> +      file
> +    (error "could not find jar file %s" file)))

Rather than writing what the function does in the comment, please do it
in the docstring. We might also make this function internal.

Also, the error sounds very generic. It would be nicer to indicate to
the user that the problem is related to ob-ditaa.
  
> +	 (png (cdr (assq :png params)))
> +	 (svg (cdr (assq :svg params)))
>  	 (eps (cdr (assq :eps params)))

I am wondering if we could instead deprecate the :png/:eps parameters
and instead use the :file extension to decide.

> +      (message cmd)
> +      (shell-command cmd)
> +      (when pdf
> +	(let ((pdf-cmd (concat "epstopdf" " " ditaa-out-file " "
> +		              "-o=" (org-babel-process-file-name out-file))))
> +          (message pdf-cmd)

Why message?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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	other threads:[~2024-11-03 17:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-03 14:05 [PATCH] ob-ditaa.el: custom var name, ditaa executable, SVG output, and chararacter encoding Jarmo Hurri
2024-11-03 17:45 ` Ihor Radchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msiggqjm.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=jarmo.hurri@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).