Fix org source block language execution

This commit is contained in:
Camden Dixie O'Brien 2021-01-01 00:00:36 +00:00
parent e83e8218fd
commit 7c1e0a4391

View File

@ -248,13 +248,31 @@
=babel= lets us evaluate Org documents containing source blocks!
I've left the enabling of this for most languages to the section
for that language, but I'll add Emacs Lisp and shell here.
for that language, but I'll add Shell and Elisp here.
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)))
(shell . t)))
#+end_src
The interface org-babel exposes is a little annoying as later in
this config we'll want to preserve the prior value of
[[help:org-babel-load-languages][org-babel-load-languages]] when enabling another language. However,
~org-babel-do-load-languages~ /sets the passed symbol to the passed
value/ with [[help:set-default][set-default]] before going through the pairs in
~org-babel-load-languages~. Don't ask me why, seems like an
obviously bad design. Workaround is to define a function here to
use later so at least it won't /look/ ugly.
#+begin_src emacs-lisp
(defun enable-org-babel-lang (lang)
"Enable executing source block in the passed language in
org-mode. Doesn't affect other enabled languages."
(org-babel-do-load-languages
'org-babel-load-languages
(append org-babel-load-languages `((,lang . t)))))
#+end_src
By default trying to execute a source block prompts you, which is
@ -608,13 +626,10 @@
#+end_src
**** Source blocks
To enable execution of CL source blocks in Org mode, add an item
to [[help:org-babel-load-languages][org-babel-load-languages]].
Enable execution of CL source blocks in Org mode:
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((lisp . t)))
(enable-org-babel-lang 'lisp)
#+end_src
*** Paredit
@ -843,8 +858,7 @@
diagrams):
#+begin_src emacs-lisp
(add-to-list 'org-babel-load-languages
'(mermaid . t))
(enable-org-babel-lang 'mermaid)
#+end_src
* Tool Integrations