From: Erik Iverson <eriki@ccbr.umn.edu>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [babel] writing my .Rprofile in orgmode, issue with emacsclient
Date: Wed, 02 Jun 2010 00:12:33 -0500 [thread overview]
Message-ID: <4C05E841.7070003@ccbr.umn.edu> (raw)
Hello,
In the spirit of the examples of writing your .emacs file in orgmode, I wrote my
.Rprofile (R's startup file) in orgmode. I do have one issue where I have no
idea what is going wrong, and would appreciate any information!
Basic setup, GNU Emacs 23.1, latest git org-mode, running on Linux. I start
emacs with emacs --daemon on startup, and always just use emacsclient to do
everything. So for my org-mode .Rprofile,
1) I create a ~/.Rprofile.org file that uses org-mode syntax and includes all R
code in R source blocks that will be tangled into a .Rprofile.R file.
2) In my actual .Rprofile, I have the following, which actually works. The
basic idea was taken from
http://orgmode.org/worg/org-contrib/babel/reference.php#sec-6 . I simply want
to tangle the .Rprofile.org file from (1) above into .Rprofile.R and source it.
I know the lisp isn't as simple as it could be, since I adapted it from the more
complex setup referenced, but this actually works for me.
#BEGIN .Rprofile
invisible(system("emacsclient -t --eval \"(progn
(add-to-list 'load-path (expand-file-name \\\"~/lisp/org-mode/lisp/\\\"))
(add-to-list 'load-path (expand-file-name \\\"~/lisp/org-mode/contrib/lisp/\\\"))
(require 'org)(require 'org-exp)(require 'org-babel)
(mapc (lambda (file)
(find-file (expand-file-name file \\\"/home/erik\\\"))
(org-babel-tangle)) '(\\\".Rprofile.org\\\")))\"", intern = TRUE,
ignore.stderr = TRUE))
source("~/.Rprofile.R")
#END .Rprofile
Then I do 'M-x R' in emacs, and R tangles the org-mode file, sources the result,
and everything works. This even works without the '-t' option given above to
emacsclient.
The problem is when I try to C-c C-c on an R source block in an org-mode file.
My issue is, that *without* the '-t' option to emacsclient, (-t says it "opens a
new emacs frame on the current terminal"), org-babel-execute-src-block hangs
when I press C-c C-c in an R code block using the above setup. It definitely
relates to the emacsclient call in my .Rprofile, because I can simply comment
that system call out of my .Rprofile and all is well. If I use :session,
everything is fine.
The best lead I have is that if I change org-babel-R-evaluate in the following
way, my setup also works without the -t option:
Give the R call in the following line
(point-min) (point-max) "R --no-save" nil 'replace (current-buffer)))
the --vanilla option. Obviously this just doesn't run my problematic .Rprofile,
but the point is that this is the exact location in the chain of calls where
it's getting 'stuck'. Emacs just hangs with the 'busy' mouse cursor until I C-g.
If I watch the system process list, the R process does get started, and a new
(2nd) instance of emacsclient is also started, but it doesn't return.
Like I said, I have 'fixed' this with -t, but I really want to know why it
wasn't working in the first place, and if this is really a fix. Notice how I
have to also ignore.stderr = TRUE in my 'system' R call, because if I don't, all
my org-babel output contains
#+results:
: emacsclient: could not get terminal name
...further output...
if my source block has :results output as opposed to :results value.
I just don't get why my setup works with M-x R but not with
org-babel-execute-src-block, there is some interaction between those two and I
can't see what it is.
Sorry for the long post, I hope my question makes sense!
Best Regards,
Erik Iverson
next reply other threads:[~2010-06-02 5:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 5:12 Erik Iverson [this message]
2010-06-04 18:29 ` [babel] writing my .Rprofile in orgmode, issue with emacsclient Eric Schulte
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C05E841.7070003@ccbr.umn.edu \
--to=eriki@ccbr.umn.edu \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.