README.org
December 25, 2025 ยท View on GitHub
#+title: org-auto-tangle #+author: Yilkal Argaw
This package (i.e org-auto-tangle) is a very simple emacs package that
allows you to automatically tangle org files on save. This is done by
adding the option #+auto_tangle: t in your org file.
The tangling process happens asynchronously so it will not block your emacs session.
- USAGE
Simply require the package in you emacs init and hook it into org-mode.
#+begin_src emacs-lisp
(require 'org-auto-tangle)
(add-hook 'org-src-mode-hook 'org-auto-tangle-mode)
#+end_src
or you can use use-package
#+begin_src emacs-lisp (use-package org-auto-tangle :load-path "site-lisp/org-auto-tangle/" ;; this line is necessary only if you cloned the repo in your site-lisp directory :defer t :hook (org-src-mode . org-auto-tangle-mode)) #+end_src
If the minor mode is on, it will try to automatically tangle
your org files if they contain a non nil value for the
#+auto_tangle: option.
You can configure auto-tangle as the default behavior for all org buffers by
setting the org-auto-tangle-default variable to t. In this case, you can disable
it for some buffers by setting the #+auto_tangle: option to nil.
The #+auto_tangle: option may also be used to specify variables that should be
preserved in the asynchronous tangling process. For example, if you have
installed a newer version of org-mode or additional Babel processors, using
#+begin_src org #+auto_tangle: vars:load-path #+end_src
will be sure that they are available during tangling. The vars option takes a
colon-separated list so multiple variables may be specified
#+begin_src org #+auto_tangle: vars:calendar-longitude:calendar-latitude:calendar-location-name #+end_src
It is also possible to disable auto-tangling by adding the nil option to the
line without removing any vars list.
#+begin_src org #+auto_tangle: vars:load-path nil #+end_src
Each listed file in =org-auto-tangle-with-files= will be loaded inside the asynchronous Emacs process before tangling begins. This is useful for setting up additional libraries, paths, or environment variables.
#+begin_src emacs-lisp
(setq org-auto-tangle-with-files
'("/.emacs.d/my-env.el"
"/.emacs.d/project-hooks.el"))
#+end_src
-
Babel Auto Tangle Safelist Add a list of files to the safelist to autotangle with noweb evaluation #+begin_src emacs-lisp (setq org-auto-tangle-babel-safelist '( "
/system.org" "/test.org" )) #+end_src -
License
This package (i.e. org-auto-tangle) is licensed under the the 2-Clause BSD License.