> Visuwesh <[email protected]> writes:
> 
> > ob-gnuplot does not use the local filename for remote :dir 
> > headers.  To reproduce, evaluate
> >
> >     #+BEGIN_SRC gnuplot :dir /ssh:USER@HOST:~/some/dir p sin(x) 
> >     #+END_SRC
> >
> > and look at the *gnuplot* buffer for the cd line.  It should say
> >
> >     cd "/ssh:USER@HOST:~/some/dir"
> >
> > instead of
> >
> >     cd "~/some/dir"
> >
> > Following patch fixes the issue on my end:
> >
> > diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
> > index 1fe99dd16..330a9a1f0 100644
> > --- a/lisp/ob-gnuplot.el
> > +++ b/lisp/ob-gnuplot.el
> > @@ -193,7 +193,7 @@ (defun org-babel-expand-body:gnuplot (body 
> > params)
> >        (when epilogue (setq body (concat body "\n" epilogue)))
> >        ;; Setting the directory needs to be done first so that
> >        ;; subsequent 'output' directive goes to the right place.
> > -      (when directory (funcall add-to-body (format "cd '%s'" 
> > directory))))
> > +      (when directory (funcall add-to-body (format "cd '%s'" 
> > (file-local-name directory)))))
> >      body))
> 
> It seems to offending line was added in commit 1187538a2 and 
> discussed in this thread: 
> https://list.orgmode.org/[email protected]
> 
> Unfortunately those resources gave me very little insight.
> 
> At some point I should figure out how to test TRAMP stuff.  At the 
> moment I don't do any SSH'ing.
> 
> According to babel documentation, we're not supposed to use ":dir" 
> at all except for setting 'default-directory'.  In theory, babel 
> should already be running the gnuplot command with the working 
> directory set to the 'default-directory' which should be set to 
> ":dir".  This means that "cd" command should not be needed at all.
> 
> Could you try simply removing that line and see if that still 
> works?  That would be a better solution. 

It wouldn't work because the *gnuplot* buffer is reused.  Creating it
anew each time a source block would be extremely inefficient over TRAMP.

Also please CC since I do not follow the list.

Reply via email to