From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Hang on incomplete input Date: Thu, 01 Dec 2011 13:18:53 -0500 Message-ID: <6231.1322763533@alphaville.americas.hpqcorp.net> References: <21A5E1E970CD46459ECBE86D6CC4B28C52E23B34@spexch01.WindLogics.local> <87mxbdkxwo.fsf@gmail.com> <21A5E1E970CD46459ECBE86D6CC4B28C52E23B99@spexch01.WindLogics.local> <10546.1322752884@alphaville.dokosmarshall.org> <21A5E1E970CD46459ECBE86D6CC4B28C52E23C26@spexch01.WindLogics.local> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWBDz-0006JF-9G for emacs-orgmode@gnu.org; Thu, 01 Dec 2011 13:19:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWBDv-0001YU-F7 for emacs-orgmode@gnu.org; Thu, 01 Dec 2011 13:19:11 -0500 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]:33633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWBDu-0001XD-Se for emacs-orgmode@gnu.org; Thu, 01 Dec 2011 13:19:07 -0500 In-Reply-To: Message from Ken Williams of "Thu, 01 Dec 2011 11:22:21 CST." <21A5E1E970CD46459ECBE86D6CC4B28C52E23C26@spexch01.WindLogics.local> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ken Williams Cc: Rafael , nicholas.dokos@hp.com, "emacs-orgmode@gnu.org" Ken Williams wrote: > > > > -----Original Message----- > > From: nick@dokosmarshall.org [mailto:nick@dokosmarshall.org] On Behalf > > Of Nick Dokos > > Sent: Thursday, December 01, 2011 9:21 AM > > > > Forgive my ignorance: how do I check the ESS version? And what does ESS > > have to do with R? I thought this was an R code block, but as you can > > probably tell, I'm an ignoRamus. > > ESS is the mechanism by which org-mode interfaces with a running R process. > Ok, thanks! I must have set it up at some point, but I had completely forgotten about it. The README says it's 5.11. > And I think I left out a crucial piece of information in my first message: = > I run R in a session buffer, my full .org file looks like this: > > ################################### > #+TITLE: Test doc > #+AUTHOR: Ken Williams > #+BABEL: :session *Rt* > > * My Header > > Some code: > > #+begin_src R > ddply(x, > #+end_src > ################################### > > With that change, is the hang reproducible? > Yup - I did it twice and got the backtrace at the bottom of this mail both times. One funky thing is that it only happens every second C-c C-c for me. Note also that #+BABEL: is obsolete for versions of org more recent than Oct. 20 or so. You seem to still be running 7.7 from late July or early August, so you should still be OK, but when you next upgrade, you will need to make changes to your files. I had to change it to #+PROPERTIES: ... for my org version. A good starting point on this change is Eric Schulte's message entitled "Standardized code block syntax and Property Accumulation merged into Master" Nick > > > If that does not bear fruit, you can M-x toggle-debug-on-quit, run the co= > de > > block and press C-g to get a backtrace. Rinse, repeat to see whether you > > always stop at the same point. It's somewhat hit-or-miss but it can be > > effective sometimes. > > I could *SWEAR* I had tried C-g to abort the running R command (and C-c C-c= > , and C-c C-g, and about a dozen other things), but couldn't get it to reac= > t. Now it aborts as desired. I must have not actually tried a simple C-g.= > I can never remember which keys abort which aspect of operation. > > When I'm armed with that C-g, the hang is a much smaller issue! > > -Ken > > > CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the inte= > nded recipient(s) and may contain confidential and privileged information. = > Any unauthorized review, use, disclosure or distribution of any kind is str= > ictly prohibited. If you are not the intended recipient, please contact the= > sender via reply e-mail and destroy all copies of the original message. Th= > ank you. > Backtrace: Debugger entered--Lisp error: (quit) file-exists-p("/tmp/babel-5986bN8/R-5986N_O") (not (file-exists-p file)) (while (not (file-exists-p file)) (sit-for (or period 0.25))) org-babel-comint-eval-invisibly-and-wait-for-file("*Rt*" "/tmp/babel-5986bN8/R-5986N_O" "{function(object,transfer.file){object;invisible(if(inherits(try({tfile<-tempfile();write.table(object,file=tfile,sep=\"\\t\",na=\"nil\",row.names=FALSE,col.names=FALSE,quote=FALSE);file.rename(tfile,transfer.file)},silent=TRUE),\"try-error\")){if(!file.exists(transfer.file))file.create(transfer.file)})}}(object=.Last.value,transfer.file=\"/tmp/babel-5986bN8/R-5986N_O\")") (let ((tmp-file (org-babel-temp-file "R-"))) (org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file (format org-babel-R-write-object-command (if row-names-p "TRUE" "FALSE") (if column-names-p (if row-names-p "NA" "TRUE") "FALSE") ".Last.value" (org-babel-process-file-name tmp-file (quote noquote)))) (org-babel-R-process-value-result (org-babel-import-elisp-from-file tmp-file (quote (16))) column-names-p)) (cond ((eql result-type (quote value)) (with-temp-buffer (insert (org-babel-chomp body)) (let ((ess-local-process-name (process-name (get-buffer-process session)))) (ess-eval-buffer nil))) (let ((tmp-file (org-babel-temp-file "R-"))) (org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file (format org-babel-R-write-object-command (if row-names-p "TRUE" "FALSE") (if column-names-p (if row-names-p "NA" "TRUE") "FALSE") ".Last.value" (org-babel-process-file-name tmp-file (quote noquote)))) (org-babel-R-process-value-result (org-babel-import-elisp-from-file tmp-file (quote (16))) column-names-p))) ((eql result-type (quote output)) (mapconcat (function org-babel-chomp) (butlast (delq nil (mapcar (lambda (line) (when ... line)) (mapcar (lambda ... ...) (org-babel-comint-with-output ... ... ...))))) "\n"))) (case result-type (value (with-temp-buffer (insert (org-babel-chomp body)) (let ((ess-local-process-name (process-name (get-buffer-process session)))) (ess-eval-buffer nil))) (let ((tmp-file (org-babel-temp-file "R-"))) (org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file (format org-babel-R-write-object-command (if row-names-p "TRUE" "FALSE") (if column-names-p (if row-names-p "NA" "TRUE") "FALSE") ".Last.value" (org-babel-process-file-name tmp-file (quote noquote)))) (org-babel-R-process-value-result (org-babel-import-elisp-from-file tmp-file (quote (16))) column-names-p))) (output (mapconcat (function org-babel-chomp) (butlast (delq nil (mapcar (lambda (line) (when ... line)) (mapcar (lambda ... ...) (org-babel-comint-with-output ... ... ...))))) "\n"))) org-babel-R-evaluate-session("*Rt*" "ddply(x," value nil nil) (if session (org-babel-R-evaluate-session session body result-type column-names-p row-names-p) (org-babel-R-evaluate-external-process body result-type column-names-p row-names-p)) org-babel-R-evaluate("*Rt*" "ddply(x," value nil nil) (let* ((result-type (cdr (assoc :result-type params))) (session (org-babel-R-initiate-session (cdr (assoc :session params)) params)) (colnames-p (cdr (assoc :colnames params))) (rownames-p (cdr (assoc :rownames params))) (graphics-file (org-babel-R-graphical-output-file params)) (full-body (org-babel-expand-body:R body params graphics-file)) (result (org-babel-R-evaluate session full-body result-type (or (equal "yes" colnames-p) (org-babel-pick-name (cdr (assoc :colname-names params)) colnames-p)) (or (equal "yes" rownames-p) (org-babel-pick-name (cdr (assoc :rowname-names params)) rownames-p))))) (if graphics-file nil result)) (save-excursion (let* ((result-type (cdr (assoc :result-type params))) (session (org-babel-R-initiate-session (cdr (assoc :session params)) params)) (colnames-p (cdr (assoc :colnames params))) (rownames-p (cdr (assoc :rownames params))) (graphics-file (org-babel-R-graphical-output-file params)) (full-body (org-babel-expand-body:R body params graphics-file)) (result (org-babel-R-evaluate session full-body result-type (or (equal "yes" colnames-p) (org-babel-pick-name (cdr ...) colnames-p)) (or (equal "yes" rownames-p) (org-babel-pick-name (cdr ...) rownames-p))))) (if graphics-file nil result))) org-babel-execute:R("ddply(x," ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "") (:exports . "code") (:results . "replace") (:session . "*Rt*") (:padnewline . "yes") (:hlines . "no"))) funcall(org-babel-execute:R "ddply(x," ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "") (:exports . "code") (:results . "replace") (:session . "*Rt*") (:padnewline . "yes") (:hlines . "no"))) ((lambda (result) (if (and (eq (cdr (assoc :result-type params)) (quote value)) (or (member "vector" result-params) (member "table" result-params)) (not (listp result))) (list (list result)) result)) (funcall cmd body params)) (setq result ((lambda (result) (if (and (eq (cdr (assoc :result-type params)) (quote value)) (or (member "vector" result-params) (member "table" result-params)) (not (listp result))) (list (list result)) result)) (funcall cmd body params))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if (and (eq (cdr ...) (quote value)) (or (member "vector" result-params) (member "table" result-params)) (not (listp result))) (list (list result)) result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc :file params)) (insert (org-babel-format-result result (cdr (assoc :sep ...)))))) (setq result (cdr (assoc :file params)) )) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result) (progn (fset (quote call-process-region) (function* (lambda (&rest args) (block call-process-region (apply (quote org-babel-tramp-handle-call-process-region) args))))) (flet ((lang-check (f) (let ((f (intern ...))) (when (fboundp f) f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name (cdr (assoc lang org-src-lang-modes)))) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambd a (result) (if (and (eq ... ...) (or ... ...) (not ...)) (list (list result)) result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc : file params)) (insert (org-babel-format-result result (cdr ...))))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (unwind-protect (progn (fset (quote call-process-region) (function* (lambda (&rest args) (block call-process-region (apply (quote org-babel-tramp-handle-call-process-region) args))))) (flet ((lang-check (f) (let ((f ...)) (when (fboundp f) f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name (cdr ...))) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if (and . .. ... ...) (list ...) result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc :file params)) (insert (org-babel-format-result result . ..)))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (if --cl-letf-bound-- (fset (quote call-process-region) --cl-letf-save--) (fmakunbound (quote call-process-region)))) (let* ((--cl-letf-bound-- (fboundp (quote call-process-region))) (--cl-letf-save-- (and --cl-letf-bound-- (symbol-function (quote call-process-region))))) (unwind-protect (progn (fset (quote call-process-region) (function* (lambda (&rest args) (block call-process-region (apply ... args))))) (flet ((lang-check (f) (let (...) (when ... f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name ...)) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if ... ... result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr ...) (insert ...))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (if --cl-letf-bound-- (fset (quote call-process-region) --cl-letf-save--) (fmakunbound (quote call-process-region))))) (letf (((symbol-function (quote call-process-region)) (function* (lambda (&rest args) (block call-process-region (apply (quote org-babel-tramp-handle-call-process-region) args)))))) (flet ((lang-check (f) (let ((f (intern ...))) (when (fboundp f) f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name (cdr (assoc lang org-src-lang-modes)))) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if (and (eq ... ...) (or ... ...) (not ...)) (list (list result)) result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc :file params)) (insert (org-babel-format-result result (cdr ...))))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (letf* (((symbol-function (quote call-process-region)) (function* (lambda (&rest args) (block call-process-region (apply (quote org-babel-tramp-handle-call-process-region) args)))))) (flet ((lang-check (f) (let ((f (intern ...))) (when (fboundp f) f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name (cdr (assoc lang org-src-lang-modes)))) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if (and (eq ... ...) (or ... ...) (not ...)) (list (list result)) result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-fil e (cdr (assoc :file params)) (insert (org-babel-format-result result (cdr ...))))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (flet ((call-process-region (&rest args) (apply (quote org-babel-tramp-handle-call-process-region) args))) (flet ((lang-check (f) (let ((f (intern ...))) (when (fboundp f) f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name (cdr (assoc lang org-src-lang-modes)))) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if (and (eq ... ...) (or ... ...) (not ...)) (lis t (list result)) result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc :file params)) (insert (org-babel-format-result result (cdr .. .))))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (unwind-protect (flet ((call-process-region (&rest args) (apply (quote org-babel-tramp-handle-call-process-region) args))) (flet ((lang-check (f) (let ((f ...)) (when (fboundp f) f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name (cdr ...))) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if (and ... ... ...) (list ...) result)) (funcall cmd body params))) ( when (cdr (assoc :file params)) (when result (with-temp-file (cdr (assoc :file params)) (insert (org-babel-format-result result ...)))) (setq result (cdr (assoc :file params)))) (org-babel-i nsert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (setq call-process-region (quote org-babel-call-process-region-original))) (let* ((lang (nth 0 info)) (params (if params (org-babel-process-params (org-babel-merge-params (nth 2 info) params)) (nth 2 info))) (cache\? (and (not arg) (cdr (assoc :cache params)) (string= "yes" (cdr (assoc :cache params))))) (result-params (cdr (assoc :result-params params))) (new-hash (when cache\? (org-babel-sha1-hash info))) (old-hash (when cache\? (org-babel-current-result-hash))) (body (setf (nth 1 info) (let ((noweb (cdr ...))) (if (and noweb (or ... ...)) (org-babel-expand-noweb-references info) (nth 1 info))))) (dir (cdr (assoc :dir params))) (default-directory (or (and dir (file-name-as-directory dir)) default-directory)) (org-babel-call-process-region-original (if (boundp (quote org-babel-call-process-region-original)) org-babel-call-process-region-original (symbol-functi on (quote call-process-region)))) (indent (car (last info))) result cmd) (unwind-protect (flet ((call-process-region (&rest args) (apply (quote org-babel-tramp-handle-call-process-region) ar gs))) (flet ((lang-check (f) (let (...) (when ... f)))) (setq cmd (or (lang-check lang) (lang-check (symbol-name ...)) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" (nth 4 info)) "")) (setq result ((lambda (result) (if ... ... result)) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file (cdr ...) (insert ...))) (setq result (cdr (assoc :file params)))) (org-babel-insert-result resu lt result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (setq call-process-region (quote org-babel-call-process-region-original)))) (progn (let* ((lang (nth 0 info)) (params (if params (org-babel-process-params (org-babel-merge-params (nth 2 info) params)) (nth 2 info))) (cache\? (and (not arg) (cdr (assoc :cache params)) (string= "yes" (cdr (assoc :cache params))))) (result-params (cdr (assoc :result-params params))) (new-hash (when cache\? (org-babel-sha1-hash info))) (old-hash (when cache\? (org-babel-current-result-hash))) (body (setf (nth 1 info) (let ((noweb ...)) (if (and noweb ...) (org-babel-expand-noweb-references info) (nth 1 info))))) (dir (cdr (assoc :dir params))) (default-directory (or (and dir (file-name-as-directory dir)) default-directory)) (org-babel-call-process-region-original (if (boundp (quote org-babel-call-process-region-original)) org-babel-call-process-region-original (symbol-function (quot e call-process-region)))) (indent (car (last info))) result cmd) (unwind-protect (flet ((call-process-region (&rest args) (apply (quote org-babel-tramp-handle-call-process-region) args))) (f let ((lang-check (f) (let ... ...))) (setq cmd (or (lang-check lang) (lang-check ...) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" ...)) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" ...) "")) (setq result ((lambda ... ...) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file ... ...)) (setq result (cdr ...))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (setq call -process-region (quote org-babel-call-process-region-original))))) (if (org-babel-confirm-evaluate info) (progn (let* ((lang (nth 0 info)) (params (if params (org-babel-process-params (org-babel-merge-params ... params)) (nth 2 info))) (cache\? (and (not arg) (cdr (assoc :cache params)) (string= "yes" (cdr ...)))) (result-params (cdr (assoc :result-params params))) (new-hash (when cache\? (org-babel-sha1-hash info))) (old-hash (when cache\? (org-babel-current-result-hash))) (body (setf (nth 1 info) (let (...) (if ... ... ...)))) (dir (cdr (assoc :dir params))) (default-directory (or (and dir (file-name-as-directory dir)) default-directory)) (org-babel-call-process-region-original (if (boundp (quote org-babel-call-process-region-original)) org-babel-call-process-region-original (symbol-function (quote call-process-region)))) (indent (car (last info))) re sult cmd) (unwind-protect (flet ((call-process-region (&rest args) (apply ... args))) (flet ((lang-check ... ...)) (setq cmd (or ... ... ...))) (if (and (not arg) new-hash (equal new-hash ol d-hash)) (save-excursion (goto-char ...) (end-of-line 1) (forward-char 1) (setq result ...) (message ...) result) (message "executing %s code block%s..." (capitalize lang) (if ... ... "")) (setq result (... ...)) (when (cdr ...) (when result ...) (setq result ...)) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (setq call-process-region (quote org-babel-call-process-region-original)))))) (when (org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (params (if params (org-babel-process-params (org-babel-merge-params (nth 2 info) params)) (nth 2 info))) (cache\? (and (not arg) (cdr (assoc :cache params)) (string= "yes" (cdr (assoc :cache params))))) (result-params (cdr (assoc :result-params params))) (new-hash (when cache\? (org-babel-sha1-hash info))) (old-hash (when cache\? (org-babel-current-result-hash))) (body (setf (nth 1 info) (let ((noweb ...)) (if (and noweb ...) (org-babel-expand-noweb-references info) (nth 1 info))))) (dir (cdr (assoc :dir params))) (default-directory (or (and dir (file-name-as-directory dir)) default-directory)) (org-babel-call-process-region-original (if (boundp (quote org-babel-call-process-region-original)) org-babel-call-process-regio n-original (symbol-function (quote call-process-region)))) (indent (car (last info))) result cmd) (unwind-protect (flet ((call-process-region (&rest args) (apply (quote org-babel-tramp-handl e-call-process-region) args))) (flet ((lang-check (f) (let ... ...))) (setq cmd (or (lang-check lang) (lang-check ...) (error "No org-babel-execute function for %s!" lang)))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char (org-babel-where-is-src-block-result nil info)) (end-of-line 1) (forward-char 1) (setq result (org-babel-read-result)) (message (replace-regexp-in-string "%" "%%" ...)) result) (message "executing %s code block%s..." (capitalize lang) (if (nth 4 info) (format " (%s)" ...) "")) (setq result ((lambda ... ...) (funcall cmd body params))) (when (cdr (assoc :file params)) (when result (with-temp-file ... ...)) (setq result (cdr ...))) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-e xecute-hook)) result)) (setq call-process-region (quote org-babel-call-process-region-original))))) (let ((info (or info (org-babel-get-src-block-info)))) (when (org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (params (if params (org-babel-process-params (org-babel-merge-params ... params)) (nth 2 info))) (cache\? (and (not arg) (cdr (assoc :cache params)) (string= "yes" (cdr ...)))) (result-params (cdr (assoc :result-params params))) (new-hash (when cache\? (org-babel-sha1-hash info))) (old-hash (when cache\? (org-babel-current-result-hash))) (body (setf (nth 1 info) (let (...) (if ... ... ...)))) (dir (cdr (assoc :dir params))) (default-directory (or (and dir (file-name-as-directory dir)) default-directory)) (org-babel-call-process-region-original (if (boundp (quote org-babel-call-process-region-original)) org-babel-call-process-region-original (symbol-function (quote cal l-process-region)))) (indent (car (last info))) result cmd) (unwind-protect (flet ((call-process-region (&rest args) (apply ... args))) (flet ((lang-check ... ...)) (setq cmd (or ... ... ... ))) (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char ...) (end-of-line 1) (forward-char 1) (setq result ...) (message ...) result) (message "executing %s code block%s..." (capitalize lang) (if ... ... "")) (setq result (... ...)) (when (cdr ...) (when result ...) (setq result ...)) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)) (setq call-process-region (quote org-babel-call-process-region-original)))))) org-babel-execute-src-block(nil ("R" "ddply(x," ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "") (:exports . "code") (:results . "replace") (:session . "*Rt*") (:padnewline . "yes") (:hlines . "no")) "" nil 0)) (progn (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg info) t) (if info (progn (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg info) t) nil) (let ((info (org-babel-get-src-block-info))) (if info (progn (org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block current-prefix-arg info) t) nil)) org-babel-execute-src-block-maybe() (or (org-babel-execute-src-block-maybe) (org-babel-lob-execute-maybe)) org-babel-execute-maybe() (if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-execute-maybe)) (unless org-babel-no-eval-on-ctrl-c-ctrl-c (org-babel-execute-maybe)) org-babel-execute-safely-maybe() run-hook-with-args-until-success(org-babel-execute-safely-maybe) (cond ((or (and (boundp (quote org-clock-overlays)) org-clock-overlays) org-occur-highlights org-latex-fragment-image-overlays) (and (boundp (quote org-clock-overlays)) (org-clock-remove-overlays)) (org-remove-occur-highlights) (org-remove-latex-fragment-image-overlays) (message "Temporary highlights/overlays removed from current buffer")) ((and (local-variable-p (quote org-finish-function) (current-buffer)) (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success (quote org-ctrl-c-ctrl-c-hook))) ((or (looking-at org-property-start-re) (org-at-property-p)) (call-interactively (quote org-property-action))) ((org-on-target-p) (call-interactively (quote org-update-radio-target-regexp))) ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]") (or ( org-on-heading-p) (org-at-item-p))) (call-interactively (quote org-update-statistics-cookies))) ((org-on-heading-p) (call-interactively (quote org-set-tags))) ((org-at-table\.el-p) (message "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg (call-interactively (quote org-table-recalculate)) (org-table-maybe-recalculate-line)) (call-interactively (quote org-table-align)) (orgtbl-send-table (quote maybe))) ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (call-interactively (quote org-footnote-action))) ((org-at-item-checkbox-p) (let* ((cbox (match-string 1)) (struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-entry-get nil "ORDERED")) (firstp (= (org-list-get-top-point struct) (point-at-bol))) block-item) (org-list-set-checkbox (point-at-bol) struct (cond ((equal arg (quote ...)) "[-]") ((equal arg (quote ...)) nil ) ((equal "[X]" cbox) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (setq block-item (org-list-struct-fix-box struct parents prevs ordere dp)) (when block-item (message "Checkboxes were removed due to unchecked box at line %d" (org-current-line block-item))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe) (when firstp (org-list-send-list (quote maybe))))) ((org-at-item-p) (let* ((struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (firstp (= (org-list-get-top-point struct) (point-at-bol)))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (when arg (org-list-set-checkbox (point-at-bol) struct "[ ]") (org-list-struct-fix-box struct parents prevs)) (org-list-struct-apply-struct struct old-struct) (when arg (org-update-checkbox-count-maybe)) (when firstp (org-list-send-list (qu ote maybe))))) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) (beginning-of-line 1) (save-excursion (org-update-dblock))) ((save-excursion (beginning-of-line 1) (lo oking-at "[ ]*#\\+\\([A-Z]+\\)")) (cond ((equal (match-string 1) "TBLFM") (save-excursion (beginning-of-line 1) (skip-chars-backward " \n ") (if (org-at-table-p) (org-call-with-arg (quote org-table-recalculate) (or arg t))))) (t (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (org-save-outline-visibility (quote use-markers) (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) (t (or (run-hook-with-args-until-success (quote org-ctrl-c-ctrl-c-final-hook)) (error "C-c C-c can do nothing useful at this location")))) (let ((org-enable-table-editor t)) (cond ((or (and (boundp (quote org-clock-overlays)) org-clock-overlays) org-occur-highlights org-latex-fragment-image-overlays) (and (boundp (quote org-clock-overlays)) (org-clock-remove-overlays)) (org-remove-occur-highlights) (org-remove-latex-fragment-image-overlays) (message "Temporary highlights/overlays removed from current buffer")) ((and (local-variable-p (quote org-finish-function) (current-buffer)) (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success (quote org-ctrl-c-ctrl-c-hook))) ((or (looking-at org-property-start-re) (org-at-property-p)) (call-interactively (quote org-property-action))) ((org-on-target-p) (call-interactively (quote org-update-radio-target-regexp))) ((and (org-in-regexp "\\[\\([0 -9]*%\\|[0-9]*/[0-9]*\\)\\]") (or (org-on-heading-p) (org-at-item-p))) (call-interactively (quote org-update-statistics-cookies))) ((org-on-heading-p) (call-interactively (quote org-set-tags ))) ((org-at-table\.el-p) (message "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg (call-interactively (quote org-table-recalculate)) (org-table-maybe-recalculate-line)) (call-interactively (quote org-table-align)) (orgtbl-send-table (quote maybe))) ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (call-interactively (quote org-footnote-action))) ((org-at-item-checkbox-p) (let* ((cbox (match-string 1)) (struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-entry-get nil "ORDERED")) (firstp (= (org-list-get-top-point struct) (point-at-bol))) block-item) (org-list-set-checkbox (point-at-bol) struct (cond ((equal arg ...) "[-]") ( (equal arg ...) nil) ((equal "[X]" cbox) "[ ]") (t "[X]"))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (setq block-item (org-list-struct-fix-box struct p arents prevs orderedp)) (when block-item (message "Checkboxes were removed due to unchecked box at line %d" (org-current-line block-item))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe) (when firstp (org-list-send-list (quote maybe))))) ((org-at-item-p) (let* ((struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (firstp (= (org-list-get-top-point struct) (point-at-bol)))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (when arg (org-list-set-checkbox (point-at-bol) struct "[ ]") (org-list-struct-fix-box struct parents prevs)) (org-list-struct-apply-struct struct old-struct) (when arg (org-update-checkbox-count-maybe)) (when firstp (org -list-send-list (quote maybe))))) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) (beginning-of-line 1) (save-excursion (org-update-dblock))) ((save-excursion (begin ning-of-line 1) (looking-at "[ ]*#\\+\\([A-Z]+\\)")) (cond ((equal (match-string 1) "TBLFM") (save-excursion (beginning-of-line 1) (skip-chars-backward " \n ") (if (org-at-table-p) (org-call-with-arg ... ...)))) (t (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (org-save-outline-visibility (quote use-markers) (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) (t (or (run-hook-with-args-until-success (quote org-ctrl-c-ctrl-c-final-hook)) (error "C-c C-c can do nothing useful at this location"))))) org-ctrl-c-ctrl-c(nil) call-interactively(org-ctrl-c-ctrl-c nil nil)