3 ms·
Interesting approach! Think you can provide us with a small working example, especially the 'deploy' part?
by mih 11y ago
Interesting approach! Think you can provide us with a small working example, especially the 'deploy' part?
- profsnuggles 11y agoThis is what I came up with over lunch. I'm going to try keeping all my dotfiles in one org file. I have an init hook that runs org-bable-tangle to re-export all the dotfiles after saving. ** Meta If you place the following code into your emacs init when saving the ~/.dotfiles.org file the dotfiles will all be exported. #+BEGIN_SRC emacs-lisp :tangle yes (defun dotfiles-hook () "If the current buffer is '~/.dotfiles.org' the code-blocks are tangled." (when (equal (buffer-file-name) (expand-file-name (concat (getenv "HOME") "/.dotfiles.org"))) (org-babel-tangle))) (add-hook 'after-save-hook 'dotfiles-hook) #+END_SRC ** bashrc #+BEGIN_SRC conf :tangle ~/.bashrc export PATH=$HOME/bin:$PATH #+END_SRC ** tmux #+BEGIN_SRC conf :tangle ~/.tmux.conf unbind C-b set -g prefix C-t bind C-t send-prefix #+END_SRC
- mih 11y agoThanks. Upvoted your solution, but I see some problems with this approach for my workflow: 1. I run emacs-server, so the init file is run only during restarts OR when I manually load it from emacsclient. 2. Re-exporting all dotfiles seems rather redundant. I prefer to selectively export individual dotfiles only when I have made changes to it. That's why I was interested in the 'deploy' part. I am not familiar enough with Babel, but it definitely seems to offer a more centralized way of managing my dotfiles. It's going into TODO.