2017-07-05 02:33:41 +02:00
|
|
|
;;; org/org-babel/config.el -*- lexical-binding: t; -*-
|
2017-04-11 08:28:02 -04:00
|
|
|
|
2017-07-05 02:33:41 +02:00
|
|
|
(add-hook 'org-load-hook #'+org-babel|init t)
|
2017-04-11 08:28:02 -04:00
|
|
|
|
2017-07-05 02:33:41 +02:00
|
|
|
(defun +org-babel|init ()
|
|
|
|
(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
|
|
|
|
(mapcar (lambda (sym) (cons sym t))
|
|
|
|
'(calc
|
|
|
|
css
|
|
|
|
emacs-lisp
|
|
|
|
haskell
|
|
|
|
js
|
|
|
|
latex
|
|
|
|
ledger
|
|
|
|
lilypond
|
|
|
|
lisp
|
|
|
|
matlab
|
|
|
|
plantuml
|
|
|
|
python
|
2017-07-05 02:33:41 +02:00
|
|
|
restclient ; ob-restclient
|
2017-04-11 08:28:02 -04:00
|
|
|
ruby
|
2017-07-05 02:33:41 +02:00
|
|
|
rust ; ob-rust
|
2017-07-16 04:28:53 +02:00
|
|
|
shell
|
2017-04-11 08:28:02 -04:00
|
|
|
sqlite
|
2017-07-05 02:33:41 +02:00
|
|
|
sql-mode ; ob-sql-mode
|
|
|
|
translate ; ob-translate
|
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))
|
|
|
|
collect p))
|
2017-04-27 18:03:37 -04:00
|
|
|
|
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
|
|
|
(defun +org|src-mode-remove-header ()
|
2017-07-05 02:33:41 +02:00
|
|
|
"Remove header-line with keybinding help; I know the keybinds."
|
|
|
|
(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))
|