2017-12-08 22:59:42 -05:00
|
|
|
;;; lang/org/+babel.el -*- lexical-binding: t; -*-
|
2017-04-11 08:28:02 -04:00
|
|
|
|
2017-11-06 00:51:37 +01:00
|
|
|
(defvar +org-babel-languages
|
|
|
|
'(calc
|
|
|
|
css
|
|
|
|
emacs-lisp
|
|
|
|
haskell
|
|
|
|
js
|
|
|
|
latex
|
|
|
|
ledger
|
|
|
|
lilypond
|
|
|
|
lisp
|
|
|
|
matlab
|
|
|
|
plantuml
|
|
|
|
python
|
|
|
|
restclient ; ob-restclient
|
|
|
|
ruby
|
|
|
|
rust ; ob-rust
|
|
|
|
shell
|
|
|
|
sqlite
|
|
|
|
sql-mode ; ob-sql-mode
|
|
|
|
translate) ; ob-translate
|
|
|
|
"A list of org-babel languages to load.")
|
|
|
|
|
2017-12-08 22:59:42 -05:00
|
|
|
|
2017-12-09 14:42:42 -05:00
|
|
|
(after! org
|
2017-07-05 02:33:41 +02:00
|
|
|
(setq org-src-fontify-natively t ; make code pretty
|
|
|
|
org-src-preserve-indentation t ; use native major-mode indentation
|
2017-04-11 08:28:02 -04:00
|
|
|
org-src-tab-acts-natively t
|
|
|
|
org-src-window-setup 'current-window
|
2017-07-05 02:33:41 +02:00
|
|
|
org-confirm-babel-evaluate nil) ; you don't need my permission
|
2017-04-11 08:28:02 -04:00
|
|
|
|
|
|
|
(org-babel-do-load-languages
|
|
|
|
'org-babel-load-languages
|
2017-11-06 00:51:37 +01:00
|
|
|
(cl-loop for sym in +org-babel-languages
|
|
|
|
collect (cons sym t)))
|
|
|
|
|
|
|
|
;; I prefer C-c C-c for confirming over the default C-c '
|
|
|
|
(map! :map org-src-mode-map "C-c C-c" #'org-edit-src-exit)
|
2017-04-11 08:28:02 -04:00
|
|
|
|
2017-04-27 18:03:37 -04:00
|
|
|
;; In a recent update, `org-babel-get-header' was removed from org-mode, which
|
2017-05-19 03:29:00 +02:00
|
|
|
;; is something a fair number of babel plugins use. So until those plugins
|
2017-07-05 02:33:41 +02:00
|
|
|
;; update, this polyfill will do:
|
2017-04-27 18:03:37 -04:00
|
|
|
(defun org-babel-get-header (params key &optional others)
|
2017-07-05 02:33:41 +02:00
|
|
|
(cl-loop with fn = (if others #'not #'identity)
|
|
|
|
for p in params
|
|
|
|
if (funcall fn (eq (car p) key))
|
2017-12-08 22:59:42 -05:00
|
|
|
collect p)))
|