Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting approach! Think you can provide us with a small working example, especially the 'deploy' part?


This 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


Thanks. 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: