emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Vikas Rawal <vikaslists@agrarianresearch.org>
Cc: William Denton <wtd@pobox.com>,
	org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Trouble evaluating R source code blocks with C-c C-c
Date: Sun, 29 May 2016 18:18:20 -0700	[thread overview]
Message-ID: <alpine.OSX.2.20.1605291758200.1797@charles-berrys-macbook.local> (raw)
In-Reply-To: <C47DA166-93D0-4990-9EFC-0FDB91222767@agrarianresearch.org>

On Sun, 29 May 2016, Vikas Rawal wrote:

>
>>
>> Vikas, can you edit the `sit-for' to `sleep-for' in
>>
>> `org-babel-comint-eval-invisibly-and-wait-for-file'
>>
>> and `eval-defun' the result and see if that has any effect?
>>
>

> Sorry, given my limited ability with lisp, I do not really
> understand. Could you please spell out what do I have to do.

Vikas,

Copy the src-block at bottom to a *.org file or org-mode buffer. Then
execute it with `C-c C-c y'.

You should see

#+RESULTS:
: org-babel-comint-eval-invisibly-and-wait-for-file

appear afterwards.

Then try running your R code to see if it works reliably.

Does that seem to fix it?

If not, please check the session buffer to see if there were any
warnings or errors.

Chuck


#+BEGIN_SRC emacs-lisp
(defun org-babel-comint-eval-invisibly-and-wait-for-file
   (buffer file string &optional period)
     "Evaluate STRING in BUFFER invisibly.
Don't return until FILE exists.  Code in STRING must ensure that
FILE exists at end of evaluation."
   (unless (org-babel-comint-buffer-livep buffer)
       (error "Buffer %s does not exist or has no process" buffer))
         (if (file-exists-p file) (delete-file file))
    (process-send-string
       (get-buffer-process buffer)
          (if (= (aref string (1- (length string))) ?\n) string (concat string "\n")))
     ;; From Tramp 2.1.19 the following cache flush is not necessary
       (if (file-remote-p default-directory)
               (with-parsed-tramp-file-name default-directory nil
                  (tramp-flush-directory-property v "")))
             (while (not (file-exists-p file)) (sleep-for (or period 0.25))))

#+END_SRC

  reply	other threads:[~2016-05-30  1:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 14:33 Trouble evaluating R source code blocks with C-c C-c Vikas Rawal
2016-05-26 18:52 ` John Hendy
2016-05-28  7:58   ` Vikas Rawal
2016-05-28 14:27     ` William Denton
2016-05-28 16:57       ` Charles C. Berry
2016-05-28 17:01         ` Charles C. Berry
2016-05-29 12:31           ` Vikas Rawal
2016-05-29 13:13           ` Vikas Rawal
2016-05-29 17:58             ` Charles C. Berry
2016-05-30  0:37               ` Vikas Rawal
2016-05-30  1:18                 ` Charles C. Berry [this message]
2016-05-30 10:24                   ` Vikas Rawal
2016-05-30 16:22                     ` Charles C. Berry
2016-05-29  2:02       ` Vikas Rawal

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=alpine.OSX.2.20.1605291758200.1797@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=vikaslists@agrarianresearch.org \
    --cc=wtd@pobox.com \
    /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).