Loading Lisp file from URL in Emacs

On a given day, I have to login and work from multiple Linux boxes. One thing I find annoying is that every time I make a change to my .emacs file, I have to copy the changes to all the hosts.

There are multiple ways to circumvent this issue. One way I find useful is to maintain my custom file as a gist in github (or any where you can host your .emacs file) and use the following code snippet in the .emacs to load the file from the URL.

(with-temp-buffer
  (shell-command "curl -Ls https://gist.github.com/raw/372f5e3e8aca632d9b82/hello-world.el" (current-buffer))
  (eval-buffer))
Let me explain what this code snippet does:
  1. It creates a temporary buffer.
  2. With the temporary buffer as the current buffer, it fetches the contents of the URL into the current buffer.
  3. It evaluates the current buffer.
  4. Remove the temporary buffer.

If the sample code above works for you, if you eval the "(hello-world)", it will say "hello world" in the mini buffer.

Comments

Anonymous said…
Interesting, but why not just store your .emacs in Dropbox?

Popular posts from this blog

The mysterious ORA-03111 error

Note on allocationSize parameter of @SequenceGenerator while using JPA

xVM's vboxmanage.exe command