emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Guillaume Buisson (gbuisson)" <gbuisson@cisco.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Fix ob-plantuml over TRAMP
Date: Wed, 24 Nov 2021 16:11:35 +0000	[thread overview]
Message-ID: <0158722C-D64B-4CB7-A25A-8F6FD7D9A2A9@cisco.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

Hi All,

My Emacs Workflow involves connecting to a dev server over SSH so I can use my machines as thin clients and avoid synchronizing files,
for that I do pretty much everything over TRAMP as I don’t want to lose the benefits of GUI Emacs.
While everything mostly works impressively fine, I noticed writing my specifications that ob-plantuml fails to generate diagrams.

It seems to me that there is a redundant check which uses `file-exists-p` even if using TRAMP, the plantuml jar is located on the remote server, so 
it fails with an error even though the command to actually render the diagrams works fine.

The patch I propose involves keeping this check but moving it so it only generates a message instead of failing the whole generation process,
doing so allows to restore the functionality and I can finally generate my sequence diagrams over TRAMP.

For more details, see the attached patch.

--
Guillaume


[-- Attachment #2: 0001-Allow-ob-plantuml-to-work-over-Tramp.patch --]
[-- Type: application/octet-stream, Size: 1402 bytes --]

From 91c07f05988190adf51bbf33fd64f34245bc97be Mon Sep 17 00:00:00 2001
From: Guillaume Buisson <guillaume@gbuisson.com>
Date: Wed, 24 Nov 2021 16:42:31 +0100
Subject: [PATCH] Allow ob-plantuml to work over Tramp

* lisp/ob-plantuml.el (org-babel-plantuml): Modify the jar file check so it doesn't fail the generation,
allowing ob-plantuml to be used with TRAMP setups.

---
 lisp/ob-plantuml.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index fc621600c..e8fff0742 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -116,11 +116,11 @@ This function is called by `org-babel-execute-src-block'."
 	 (java (or (cdr (assq :java params)) ""))
 	 (executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path)
 			   (t "java")))
+         (jar-exists? (or (file-exists-p org-plantuml-jar-path)
+			  (message "Could not find plantuml.jar at %s" org-plantuml-jar-path)))
 	 (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args)
 				((string= "" org-plantuml-jar-path)
 				 (error "`org-plantuml-jar-path' is not set"))
-				((not (file-exists-p org-plantuml-jar-path))
-				 (error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
 				(t (list java
 					 "-jar"
 					 (shell-quote-argument (expand-file-name org-plantuml-jar-path))))))
-- 
2.31.1


             reply	other threads:[~2021-11-25 10:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 16:11 Guillaume Buisson (gbuisson) [this message]
2021-12-02  9:43 ` [PATCH] Fix ob-plantuml over TRAMP Timothy
  -- strict thread matches above, loose matches on Subject: below --
2021-11-24 17:29 guillaume
2021-11-25 12:40 ` Ihor Radchenko

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=0158722C-D64B-4CB7-A25A-8F6FD7D9A2A9@cisco.com \
    --to=gbuisson@cisco.com \
    --cc=emacs-orgmode@gnu.org \
    /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).