8

First post. I'd like to confirmation whether I sucessfully troubleshooted an install of Emacs, and, if I didn't, direction on where and how to proceed.

My setup:

  • Emacs 24.5
  • Macbook Pro Core Duo (mid-2010)
  • OSX El Cap (10.11.4)

I recently installed Emacs along with Kierian Healy's [https://kieranhealy.org/resources/emacs-starter-kit/](social science starter kit). When I first launched Emacs after the installation I received an error (below) that as far as I could tell, didn't prevent anything from working—although, given that I'm new to Emacs one can never be sure.

Once installed, I received the follwing error message at launch:

Warning (initialization): An error occurred while loading     
`/Users/lmp/.emacs.d/init.el':

File error: Cannot open load file, no such file or directory, ob-shell

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

I launched Emacs from the terminal into debug mode but couldn't for the life of me figure out the backtrace. So I commented out sections of my init.el file until I found the problem line of code:

(org-babel-load-file (expand-file-name "starter-kit.org" dotfiles-dir)) 

So I opened the starter-kit.org file and do the same which leads me to the following code

(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)))

After searching the org-mode website and a few forums, I tried the following that cleared the error:

(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)))

It's my understanding that the . t part of the code is a true/false signifier. But whether removing it from the file was wise or foolish, is what I want to know. Or, to state my question in the clearest of terms:

  1. Did I successfully fix the problem? If not, why not?
  2. Is there anything I should have done instead, or should do in addition to removing the (shell . t)?
7

Did you successfully fix the problem? Sure! ob-shell was flipping out and you stopped loading it. That is, in some sense, a fix!

That said: the chunk of code you found and commented out controls which languages are loaded by org babel, which is a pretty powerful function within org. If you've got any interest in using/evaluating shell code blocks, you'll want to fix the error you got a different way. You're right -- . t associates truth with a value. In this case, it indicates that org should load the shell backend for org source blocks.

All this said: if you want the shell backend running, there isn't reeeeeally enough information in your original post to diagnose what's wrong with it. I can tell you my config file doesn't have (shell . t), but rather (sh . t). One thing to double-check is that you're using a version of Org Mode greater than 8, which you can do with M-x org-version. Beyond that, I've very little to suggest at time of writing.

So! Do you want to use shell source blocks? If yes: more problem solving ahead! If no: you fixed it!

  • Thank you, @Gastove I'm switching to Emacs so that I can write academic papers in org-mode with R code for statistics: so yes, I'll need the shell as far as I can tell. I'll definitely review the babel and shell documentation with care in the coming days. Quick follow up: I tried replacing (shell . t) with (sh . t) and it too clears the error. Are those two functionally the same thing? – Luke M Perez Apr 3 '16 at 13:37
  • Honestly: I would have hoped (shell . t) would work; I know (sh . t) also works, so I suggested it, but I know the loader is a little finicky. – Gastove Apr 4 '16 at 3:27
  • 2
    I can confirm that replacing (shell . t) by (sh . t) in the file ~/.emacs.d/starter-kit-org.org works. At least on my FreeBSD installation. – henning -- reinstate Monica Nov 29 '17 at 23:00
5

I encountered the same problem. I got my fresh new Emacs 25.3 with a built-in org-mode of version 8.2.10. When I started Emacs with my old init file, I got the exactly same thing.

File error: Cannot open load file, no such file or directory, ob-shell

I googled the error message and found this question. Then I changed (shell . t) to (sh . t). It seemed to resolve the error message.

However, some days later, when I tried to really use org-mode, I found the built-in version lacking some feature and updated it to 9.1.4. Then I encountered the following error when reallying executing something in org-mode.

Symbol’s function definition is void: org-babel-get-header

Then I changed (sh . t) back to (shell . t) and resolved the problem.

It seemed to me that the name of ob-sh was changed from ob-sh to ob-shell somewhere between version 8.2.10 and 9.1.4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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