As the title says, I want a number of things to happen when I open an org-mode file: I want a Racket REPL session to start (as in a code block :session mysess1) and I want various Racket environment-library things to happen, e.g., initialize (require math). I've thought about Emacs local file variables, but not sure how it can first start a particular named REPL session, then run the (require math). There is also the org mode tag #+STARTUP, but again I'm not sure how that would happen. Any ideas?


I would make a named src block that sets up the racket env you want.

Then, use a local variable to go to that block and execute it. Maybe something like this:;

#+name: setup
#+BEGIN_SRC racket :session mysess1
(require math)

# Local Variables:
# eval: (progn (org-babel-goto-named-src-block "setup") (org-babel-execute-src-block))
# End:

You will probably get pestered with getting asked to evaluate the local variable when you open the file, but I think this will do what you want.

| improve this answer | |
  • BTW, what is your org-mode racket setup? – John Kitchin Dec 18 '16 at 21:13
  • Org mode version 9.0.2; Racket v6.7; Geiser 20161202.1657. – 147pm Dec 19 '16 at 1:33
  • Actually, I just got a File local-variables error: (error No org-babel-execute function for racket!) – 147pm Dec 19 '16 at 1:40
  • That makes sense. There isn't an ob-racket that I know of. – John Kitchin Dec 19 '16 at 1:45
  • I am trying to setup github.com/hasu/emacs-ob-racket, but, honestly, I have not yet got it working – logc Feb 11 '19 at 20:36

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.