emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Trouble evaluating R source code blocks with C-c C-c


From: Charles C. Berry
Subject: Re: [O] Trouble evaluating R source code blocks with C-c C-c
Date: Sun, 29 May 2016 18:18:20 -0700
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]