I'm converting my dotfiles to org-babel files because I really enjoyed rewriting my Emacs configuration in it, and I have a function for the
init.org that automatically tangles it whenever I save. However, I haven't been successful in making the
.org files in say
~/.dotfiles to do the same automatically. I have this function currently:
(defun my/tangle-dotfiles () "If the current file is in '~/.dotfiles', the code blocks are tangled" (when (equal (buffer-file-name) (expand-file-name "~/.dotfiles/tmux.org")) (org-babel-tangle) (message "Dotfile tangled"))) (add-hook 'after-save-hook #'my/tangle-dotfiles)
However, this only works for the specific file I name, not for any org file. Using
*.org doesn't work either, nor have I figured out how to extract the directory name from both the buffer and directory and do it that way.
I also asked on the #emacs on Freenode but nobody answered me there. Any help or pointer on where to begin would be highly appreciated.