doomemacs/modules/org/org-babel/config.el

53 lines
1.7 KiB
EmacsLisp
Raw Normal View History

;;; org/org-babel/config.el -*- lexical-binding: t; -*-
2017-04-11 20:28:02 +08:00
(add-hook 'org-load-hook #'+org-babel|init t)
2017-04-11 20:28:02 +08: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 20:28:02 +08:00
org-src-tab-acts-natively t
org-src-window-setup 'current-window
org-confirm-babel-evaluate nil) ; you don't need my permission
2017-04-11 20:28:02 +08: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
restclient ; ob-restclient
2017-04-11 20:28:02 +08:00
ruby
rust ; ob-rust
shell
2017-04-11 20:28:02 +08:00
sqlite
sql-mode ; ob-sql-mode
translate ; ob-translate
2017-04-11 20:28:02 +08:00
)))
;; In a recent update, `org-babel-get-header' was removed from org-mode, which
2017-05-19 09:29:00 +08:00
;; is something a fair number of babel plugins use. So until those plugins
;; update, this polyfill will do:
(defun org-babel-get-header (params key &optional others)
(cl-loop with fn = (if others #'not #'identity)
for p in params
if (funcall fn (eq (car p) key))
collect p))
2017-04-11 20:28:02 +08:00
;; 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 20:28:02 +08:00
(defun +org|src-mode-remove-header ()
"Remove header-line with keybinding help; I know the keybinds."
(when header-line-format
(setq header-line-format nil)))
2017-05-19 09:29:00 +08:00
(add-hook 'org-src-mode-hook #'+org|src-mode-remove-header))