emacs.d/org-babel-tangle-file

35 lines
1.0 KiB
Plaintext
Raw Normal View History

2021-11-30 11:57:07 +01:00
#!/usr/bin/env sh
emacs -Q --batch --eval "
(progn
(require 'org)
(require 'ob-latex)
(defun my-org-eval-blocks-named (infix)
2021-11-30 11:57:07 +01:00
(when (eq major-mode 'org-mode)
(let ((blocks
(org-element-map
(org-element-parse-buffer 'greater-element nil) 'src-block
(lambda (block)
(let ((name (org-element-property :name block)))
(when (and name (string-match-p infix name))
block))))))
2021-11-30 11:57:07 +01:00
(dolist (block blocks)
(goto-char (org-element-property :begin block))
(org-babel-execute-src-block)))))
(add-to-list 'safe-local-eval-forms
'(apply 'my-org-eval-blocks-named '(\"emacs-lisp-setup\")))
(setq org-confirm-babel-evaluate nil)
(setq python-indent-guess-indent-offset nil)
(org-babel-tangle-file \"$1\" \"init.el\" \"emacs-lisp\")
(org-babel-tangle-file \"$1\" \"setup-include.org\" \"org\"))
2021-11-30 11:57:07 +01:00
"
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# sh-basic-offset: 2
# End: