4

I have to work on multiple different machines and it would be nice to keep my .emacs file consistent everywhere.

Question: is there a package which allows to update the file at startup from a remote location such as github or via ssh?

Beginner
  • 2,661
  • 3
  • 17
  • 25
  • 1
    Possible duplicates: [What should/shouldn't I do when keeping .emacs and .emacs.d in version control?](http://emacs.stackexchange.com/questions/293/what-should-shouldnt-i-do-when-keeping-emacs-and-emacs-d-in-version-control), [Synchronize packages between different machines](http://emacs.stackexchange.com/questions/408/synchronize-packages-between-different-machines), and, to a lesser extent, [Keeping my .org files in sync across multiple computers](http://emacs.stackexchange.com/questions/2871/keeping-my-org-files-in-sync-across-multiple-computers). – Dan Jan 16 '15 at 12:58

2 Answers2

7

I would do this outside of Emacs, with a wrapper script that pulls the updated config first.

Something like this:

#! /bin/sh
cd ~/.emacs.d && git pull --rebase
exec /usr/bin/emacs "$@"

Then make this executable, name it emacs, and put it on your PATH before the real one.

Another option would be to have init.el do pretty much the same thing: (call-process-shell-command "cd ~/.emacs.d/ && git pull --rebase"), and then proceed to load the other files from under ~/.emacs.d/. The downside of this is that init.el itself will not be reloaded. But if this is all that your init.el does, and you delegate everything else to files loaded from it, that should be fine.

Malabarba
  • 22,878
  • 6
  • 78
  • 163
algernon
  • 161
  • 4
2

Since I presume you are going to be sshing to these machines, I suggest you can take a look at sshrc which lets you take your local dotfiles along when you ssh into any server.

Karthik T
  • 131
  • 2