docs(Emacs org): better auto tangling of my config files

This commit is contained in:
Lucien Cartier-Tilet 2024-02-07 06:34:06 +01:00
parent 4d25ef6b5b
commit 9c1fe06d26
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 13 additions and 2 deletions

View File

@ -2,5 +2,4 @@
;;; For more information see (info "(emacs) Directory Variables") ;;; For more information see (info "(emacs) Directory Variables")
((org-mode . ((org-list-allow-alphabetical . nil) ((org-mode . ((org-list-allow-alphabetical . nil)
(org-confirm-babel-evaluate . nil) (org-confirm-babel-evaluate . nil))))
(eval . (add-hook 'after-save-hook #'org-babel-tangle)))))

View File

@ -1245,6 +1245,18 @@ which is really nice! However, most of my configuration will be stolen
(org-present-mode-quit . my/org-present-quit))) (org-present-mode-quit . my/org-present-quit)))
#+end_src #+end_src
** Tangle config org files on save
Something really, really useful is tangling all my configuration files
on save. For this, a dedicated function will do the trick.
#+begin_src emacs-lisp
(defun my/tangle-config-file ()
(when (and (eq major-mode 'org-mode)
(f-ancestor-of-p (f-full "~/.nosync/org/config") default-directory))
(org-babel-tangle)))
(add-hook 'after-save-hook #'my/tangle-config-file)
#+end_src
** Visual Configuration ** Visual Configuration
While most modes of Emacs are dedicated to development, and therefore While most modes of Emacs are dedicated to development, and therefore
are much more comfortable with a fixed-pitch font, more literary modes are much more comfortable with a fixed-pitch font, more literary modes