[-- 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
[-- 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: 1435 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
guillaume@gbuisson.com writes: > 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. I disagree that the check is redundant. It is still a good idea to check if plantuml jar exists on server itself. Another question is how to make `file-exists-p' work with TRAMP. > 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. Your patch will break legitimate check for people running plantuml locally. A better way would be checking default-directory and if we are in a remote server, using appropriate check working over TRAMP. Best, Ihor
[-- Attachment #1: Type: text/plain, Size: 904 bytes --] Hi Guillaume, Thanks for picking this up and submitting a patch. Have you considered using `tramp-handle-file-exists-p'? I’m not overly familiar with tramp or this sort of issue, but it looks like it could be exactly what we want. > 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. All the best, Timothy