In org-mode, attempting to execute the following block...


...gives the error message org-babel-execute-src-block: No org-babel-execute function for R!. I have followed the instructions in https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html. My .emacs contains:

(require 'ess-site)
 '((R . t)))

Here's the content of my Messages buffer.

Loading /etc/emacs/site-start.d/00debian.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
org-babel-execute-src-block: No org-babel-execute function for R!

I have looked at the answers to No org-babel-execute function for calc? and "no org-babel-execute function for c" and "no-org-babel-execute function for c++" but they did not solve my problem.

EDIT: Forgot to mention that I'm on Debian and have installed ess.

EDIT: I did exit emacs and restart it. And just to make sure that the current version of .emacs is being picked up, I made a tiny change to it, which took effect as expected.

EDIT: I'm using GNU Emacs 25.2.2.

EDIT: Here's my entire .emacs file, in case it helps. I've made a few changes to it while experimenting with this problem. I added Haskell to the list of languages to see if the problem was specific to R, but I'm getting the "No org-babel-execute function for haskell!" message when I try to execute a Haskell block.

;; No startup screen
(setq inhibit-startup-screen t)

;; No toolbar
(tool-bar-mode -1)

;; Open my emacs "cheat sheet"
(defun wombat-emacs-help ()
  (find-file "~/néal/eolas/emacs.txt"))

;; CUA
(cua-mode t)

;; Use a bar for the cursor
(set-default 'cursor-type 'box)
;; box, hollow, bar, or hbar

;; Set location for custom scripts.
(add-to-list 'load-path "~/emacs.d")

;; My custom key bindings
(global-set-key (kbd "C-s") (quote save-buffer))
(global-set-key (kbd "C-r") (quote query-replace))
(global-set-key (kbd "C-f") (quote isearch-forward))
(global-set-key (kbd "C-f") 'isearch-forward)
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
(global-set-key (kbd "C-S-f") (quote isearch-backward))
(define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
(global-set-key (kbd "C-#") (quote comment-dwim))
(global-set-key (kbd "C-a") (quote mark-whole-buffer))
;; (global-set-key (kbd "<f12>") (quote browse-apropos-url-on-region))
;; (global-set-key (kbd "C-SPC") (quote hippie-expand))
(global-set-key (kbd "C-?") (quote wombat-emacs-help))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-switchb)

;; open with single window
(add-hook 'emacs-startup-hook 'delete-other-windows)

;; Show column-number in the mode line
(column-number-mode 1)

;; Highlight current line

;; Margin (fill column)
(setq-default fill-column 72)

;; Margin indicator
(require 'fill-column-indicator)
(setq fci-rule-width 1)
(setq fci-rule-color "lightblue")
(add-hook 'awk-mode-hook 'fci-mode)
(add-hook 'c++-mode-hook 'fci-mode)
(add-hook 'c-mode-hook 'fci-mode)
(add-hook 'emacs-lisp-mode-hook 'fci-mode)
(add-hook 'erlang-mode-hook 'fci-mode)
(add-hook 'haskell-mode-hook 'fci-mode)
(add-hook 'java-mode-hook 'fci-mode)
(add-hook 'makefile-mode-hook 'fci-mode)
(add-hook 'python-mode-hook 'fci-mode)
(add-hook 'shell-script-mode-hook 'fci-mode)
(add-hook 'text-mode-hook 'fci-mode)

;; (setq amys-launch-directory default-directory)
;; (autoload 'whe "whe" "Wombat haskell stuff" t nil)

;; Longer "Buffers" menu
(setq buffers-menu-max-size 50)

;; Highlight matching parentheses

;; Haskell unicode source candy
(setq haskell-font-lock-symbols t)

;; ;; Haskell indentation
;; (add-hook 'haskell-mode-hook 'haskell-indentation-mode)

;; Use Hasktags
(let ((my-stack-path (expand-file-name "~/.local/bin")))
  (setenv "PATH" (concat my-stack-path path-separator (getenv "PATH")))
  (add-to-list 'exec-path my-stack-path))
(custom-set-variables '(haskell-tags-on-save t)

;; Stylish Haskell
 '(haskell-stylish-on-save t))

;; R
;; (require 'org)
;; (require 'org-install)
;; (require 'ess-site)
   (R . t)
   (dot . t)
   (haskell . t)
   (python . t)
   (sh . t)

;; Repos
(require 'package) ;; This is built-in
(add-to-list 'package-archives
             '("gnu" . "http://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
             '("melpa-stable" . "http://stable.melpa.org/packages/") t)
;; (package-refresh-contents)

;; Find out the major mode associated with a buffer.
(defun buffer-mode (&optional buffer-or-name)
  "Returns the major mode associated with a buffer.
If buffer-or-name is nil return current buffer's mode."
  (buffer-local-value 'major-mode
   (if buffer-or-name (get-buffer buffer-or-name) (current-buffer))))

;; Remove trailing whitespace
(defun remove-trailing-whitespace ()
    (goto-char (point-min))
    (while (re-search-forward "[ \t]+$" nil t)
      (replace-match "" nil nil)))
(defun add-remove-trailing-whitespace-hook ()
  (add-hook 'local-write-file-hooks 'remove-trailing-whitespace))

(add-hook 'awk-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'c++-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'c-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'emacs-lisp-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'erlang-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'haskell-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'java-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'makefile-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'python-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'shell-script-mode-hook 'add-remove-trailing-whitespace-hook)
(add-hook 'text-mode-hook 'add-remove-trailing-whitespace-hook)

EDIT: Just to rule out the obvious, I do have R and Haskell installed on my system.

  • I assume you've re-evaluated your .emacs file? I just added the org-babel-do-load-languages section to mine, evaluated it, and do not get the No org-babel-execute function for R error. I get a different error because R is not installed on my system, which is expected. – shoshin Nov 20 '18 at 17:14
  • It would also be good to know what version of Emacs you are using. – shoshin Nov 20 '18 at 17:18
  • @GrantShangreaux I added the answers to the end of my post. – mhwombat Nov 20 '18 at 17:21
  • 2
    can you verify, that the languages are loaded correctly with M-x describe-variable <RET> org-babel-load-languages. – bombadil Nov 20 '18 at 18:13
  • 1
    I was going to suggest also trying to evaluate just the (org-babel-do-load-languages ...) function call while Emacs is running. If you evaluate it and it works, it might just be an issue with the order things are set up in your config. – shoshin Nov 20 '18 at 19:10

I was able to reproduce the behavior with your .emacs file. I found one syntax error that I thought might be the issue:

(custom-set-variables '(haskell-tags-on-save t)

that line is missing a closing paren. however, adding it did not solve the problem. I had to move the org-babel-do-load-languages call above the fill-column-indicator section in order for babel to work properly.

I eventually figured out why after commenting out these two lines:

(setq inhibit-startup-screen t)
(add-hook 'emacs-startup-hook 'delete-other-windows)

Loading .emacs was failing because there was no such package as fill-column-indicator on my system. I couldn't find it anywhere in the repositories, but assuming you have it installed, loading the file would still fail at that missing paren on the line I mentioned before. I'm guessing nothing after that point in your file is evaluated properly.

I found a third error, which is the org babel language sh has been renamed to shell so you'll also need to change that line from (sh .t) to (shell . t). I hope this helps!

p.s. there are some linting functions for emacs-lisp which might help catch errors like missing parens, elint-current-buffer, and elint-file specifically.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.