From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Trouble evaluating R source code blocks with C-c C-c Date: Sun, 29 May 2016 18:18:20 -0700 Message-ID: References: <2BE21056-50D3-49CE-8B0D-5467D182B7B5@agrarianresearch.org> <2E8B017B-F4AB-454D-81A1-E61F55F4F958@agrarianresearch.org> <5F862231-C04A-4BF6-8A2A-2377AF000374@agrarianresearch.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7Bqe-00084L-2V for emacs-orgmode@gnu.org; Sun, 29 May 2016 21:18:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7BqY-00064E-UT for emacs-orgmode@gnu.org; Sun, 29 May 2016 21:18:27 -0400 Received: from iport-bcv1-out.ucsd.edu ([132.239.0.119]:38900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7BqY-00064A-LJ for emacs-orgmode@gnu.org; Sun, 29 May 2016 21:18:22 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Vikas Rawal Cc: William Denton , org-mode mailing list 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