2017-06-10 01:52:44 +02:00
|
|
|
;;; lang/org/+babel.el -*- lexical-binding: t; -*-
|
2017-04-11 08:28:02 -04:00
|
|
|
|
2017-05-19 03:29:00 +02:00
|
|
|
(add-hook '+org-init-hook #'+org|init-babel t)
|
2017-04-11 08:28:02 -04:00
|
|
|
|
|
|
|
(defun +org|init-babel ()
|
|
|
|
(setq org-confirm-babel-evaluate nil ; you don't need my permission
|
|
|
|
org-src-fontify-natively t ; make code pretty
|
|
|
|
org-src-preserve-indentation t
|
|
|
|
org-src-tab-acts-natively t
|
|
|
|
org-src-window-setup 'current-window
|
|
|
|
org-edit-src-content-indentation 0)
|
|
|
|
|
|
|
|
(org-babel-do-load-languages
|
|
|
|
'org-babel-load-languages
|
|
|
|
(mapcar (lambda (sym) (cons sym t))
|
|
|
|
'(calc
|
|
|
|
css
|
|
|
|
emacs-lisp
|
|
|
|
haskell
|
|
|
|
js
|
|
|
|
latex
|
|
|
|
ledger
|
|
|
|
lilypond
|
|
|
|
lisp
|
|
|
|
matlab
|
|
|
|
plantuml
|
|
|
|
python
|
|
|
|
restclient
|
|
|
|
ruby
|
|
|
|
rust
|
|
|
|
sh
|
|
|
|
sqlite
|
|
|
|
sql-mode
|
|
|
|
translate
|
|
|
|
)))
|
|
|
|
|
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
|
|
|
|
;; update...
|
2017-04-27 18:03:37 -04:00
|
|
|
(defun org-babel-get-header (params key &optional others)
|
|
|
|
(delq nil
|
|
|
|
(mapcar
|
2017-05-19 03:29:00 +02:00
|
|
|
(lambda (p) (if (funcall (if others #'not #'identity) (eq (car p) key)) p))
|
2017-04-27 18:03:37 -04:00
|
|
|
params)))
|
|
|
|
|
2017-04-11 08:28:02 -04:00
|
|
|
;; I prefer C-c C-c for confirming over the default C-c '
|
2017-05-13 00:12:23 +02:00
|
|
|
(map! :map org-src-mode-map "C-c C-c" #'org-edit-src-exit)
|
|
|
|
|
2017-04-11 08:28:02 -04:00
|
|
|
;; I know the keybindings, no need for the header line
|
|
|
|
(defun +org|src-mode-remove-header ()
|
|
|
|
(when header-line-format (setq header-line-format nil)))
|
2017-05-19 03:29:00 +02:00
|
|
|
(add-hook 'org-src-mode-hook #'+org|src-mode-remove-header))
|