emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Austin F. Frank" <austin.frank@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: with-parsed-tramp-file-name
Date: Thu, 30 Sep 2010 09:28:57 -0400	[thread overview]
Message-ID: <m01v8bicme.fsf@gmail.com> (raw)
In-Reply-To: 87sk0rr57k.fsf@stats.ox.ac.uk


[-- Attachment #1.1: Type: text/plain, Size: 6635 bytes --]

On Thu, Sep 30 2010, Dan Davison wrote:

> Just btw, I use Org every day at the moment (with emacs24) to execute
> code (mostly R) on remote machines. The method I use is to store all
> Org files locally, and use the :dir header argument to specify the
> machine on which to run R, e.g.

At some point I was (naively?) worried about the portability of this
kind of path.  Additionally, I do sometimes want to run things locally,
like if I'm offline.  Because a file that is opened over TRAMP usually
transparently starts processes over TRAMP, and because it's less typing,
and because of my untested portability concern, I have stuck to using
the edit-and-execute over TRAMP method, with all paths defined relative
to the edited file.

> #+babel:   :dir /davison@oak.well.ox.ac.uk:~/bench
> [...]
> #+begin_src R
> system("hostname", intern=TRUE)
> #+end_src
>
> #+results:
> : oak
>
> Do you get the same error evaluating R remotely using this method?

I do, when using the previously-reported config file.

> What's your emacs version?

GNU Emacs 24.0.50.7 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)
of 2010-09-30

> I don't see tramp-sh in emacs23; I do see it in emacs24.

Yup, I use emacs24 built from a checkout from the git mirror of the bzr
sources.

> How about we test this simple source block:
>
> #+begin_src R
> system("hostname", intern=TRUE)
> #+end_src
>
> in a file on the remote machine opened using C-x C-f with the
> /user@machine:path/to/file syntax, with this minimal config:
>
> (add-to-list 'load-path "/PATH/TO/ess/lisp")
> (require 'ess-site)
> (add-to-list 'load-path "/PATH/TO/org-mode/lisp")
> (require 'org-install)
> (setq debug-on-error t)
> (org-babel-do-load-languages
>  'org-babel-load-languages
>  '((R . t)))
>
> I suspect part of the problem is to do with those (require tramp...)
> lines in your config. Could you try without those lines, and without
>
> (add-to-list 'tramp-remote-path 'tramp-own-remote-path)

I can try this for debugging, but I do need that configuration option
eventually.  I build R and install R packages within my home directory
on the server in question.  Without 'tramp-own-remote-path my R packages
aren't found by the R process.  Also, this

> Instead, could you try
>
> (setq org-babel-R-command "/PATH/TO/R/EXECUTABLE --slave --no-save")

is not a portable solution, as on my local machine I use
/usr/local/bin/R and on the remote machine I use ~/bin/R.  I suppose I
could setup a conditional assignment based on host name, but since I
already know 'tramp-own-remote-path works, that's my preferred option.
Also, all of the results below are unchanged when I explicitly set the
org-babel-R-command.

Results:

1.  This file, opened locally:
--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
(require 'ess-site)
(add-to-list 'load-path (expand-file-name "~/src.remote/org-mode/lisp"))
(require 'org-install)
(setq debug-on-error t)
(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)))
#+end_src

#+results:
| (R . t) |

#+begin_src R :dir /bcs:~/
system("hostname", intern=TRUE)
#+end_src
--8<---------------cut here---------------end--------------->8---
    
Gives this backtrace:
#v+
Debugger entered--Lisp error: (void-function org-babel-temp-file)
  org-babel-temp-file("R-")
  org-babel-R-evaluate-external-process("system(\"hostname\", intern=TRUE)" value nil nil)
  org-babel-R-evaluate(nil "system(\"hostname\", intern=TRUE)" value nil nil)
  org-babel-execute:R("system(\"hostname\", intern=TRUE)\n" ((:cache . "no") (:comments . "") (:dir . "/bcs:~/") (:exports . "code") (:hlines . "no") (:noweb . "no") (:results . "replace") (:session . "none") (:shebang . "") (:tangle . "no")))
  org-babel-execute-src-block(nil ("R" "system(\"hostname\", intern=TRUE)\n" ((:cache . "no") (:comments . "") (:dir . "/bcs:~/") (:exports . "code") (:hlines . "no") (:noweb . "no") (:results . "replace") (:session . "none") (:shebang . "") (:tangle . "no")) "" nil nil 0))
  org-babel-execute-src-block-maybe()
  run-hook-with-args-until-success(org-babel-execute-src-block-maybe)
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
#v-
This is also true if I explicitly set `org-babel-R-command' in the
emacs-lisp source block, as well as if I explicitly (require 'ob).  This
feels to me like it isn't even getting to the point where the TRAMP
errors could arise.

>> If I manually load ob.el by M-x load-file with Location as
>> /path/to/ob.el then C-c C-c works. But (require 'ob) is not
>> working. Am I missing something?

With the above minimal config file edited locally with a remote
execution directory, I get the same as Noruul.  The above error
disappears if I (load-file "~/src.remote/org-mode/lisp/ob.el").  I also
no longer get the TRAMP error I originally reported.

> Noruul, what does (featurep 'ob) evaluate to before you manually attempt
> the (require 'ob) ? And what goes wrong when you do the require?

(featurep 'ob) reports `t' for me, before a (require 'ob).
(fboundp #'org-babel-temp-file) and
(fboundp #'with-parsed-tramp-file-name) both return nil.  After I
explicitly load, org-babel-tempfile is defined (but this does NOT work
with just (require 'ob), as reported by Noruul).  After I (require
'tramp), (fboundp #'with-parsed-tramp-file-name) is `t'.  After I
(require 'tramp-sh), (boundp 'tramp-remote-path) is `t'.

It looks to me like there are two issues affecting my original report.

The first is that with (require 'org-install) and even with (require
'ob), certain babel-related functions aren't being exported (don't know
if that's the right term).

The second is that I _need_ to be able to add 'tramp-own-remote-path to
'tramp-remote-path, which at least on my system requires doing (require
'tramp) and (require 'tramp-sh).  That is, presumably, a TRAMP bug.

Some interaction with explicitly requiring the tramp packages and then
trying to use org-babel's remote functions seems to be messing things
up.

> If (part of) this is an issue of tramp differences between emacs23 and
> 24 then the tramp author Michael Albinus has already been extremely
> helpful on several occasions with tramp issues and I am confident he
> will be able to advise.

Thanks for all of your help already.  I'm sure we'll chase this down.

/au

-- 
Austin Frank
http://aufrank.net
GPG Public Key (D7398C2F): http://aufrank.net/personal.asc

[-- Attachment #1.2: Type: application/pgp-signature, Size: 194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-09-30 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-29 23:08 [babel] with-parsed-tramp-file-name Austin F. Frank
2010-09-30  6:52 ` with-parsed-tramp-file-name Noorul Islam K M
2010-09-30  8:44   ` with-parsed-tramp-file-name Dan Davison
2010-09-30 13:28     ` Austin F. Frank [this message]
2010-10-14 12:21       ` with-parsed-tramp-file-name Dan Davison

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=m01v8bicme.fsf@gmail.com \
    --to=austin.frank@gmail.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).