Paul Sexton <psex...@xnet.co.nz> writes: > I have an org-mode document that uses a lot of R code (via babel). I have > found > that using inline code blocks, ie src_R{...}, within org tables works > "erratically", often either causing emacs to hang during latex export, or > producing a table where random cells containing 'nil' instead of the result I > get when I manually evaluate the inline code block via C-c C-c. >
If you can find a minimal example which reliably reproduces this error please do share it on the list so we can try to put together a fix. > > I am therefore in the process of converting many of these tables back to > 'plain' > org, ie replacing the inline code blocks with their results. > I guess the only other option may be to create the entire table from a code block, which is probably not practical. > > My question is: is there any way to automate this? Ideally I would like to > press > a key with the cursor on an inline block, and have the block replaced with its > eval result, rather than have the result appear in the minibuffer. > The following function could be bound to a key, and should do the job if called with the point on the src_lang portion of the inline code block. #+begin_src emacs-lisp (defun replace-inline-block () (interactive) (if (save-excursion (re-search-backward "[ \f\t\n\r\v]" nil t) (looking-at org-babel-inline-src-block-regexp)) (replace-match ((lambda (el) (if (stringp el) el (format "%S" el))) (org-babel-execute-src-block)) nil nil nil 1) (error "not inside of an inline source block."))) #+end_src Cheers -- Eric > > Paul > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode