Question

I have my init.el stored here: ~/Dropbox/workspaces/emacs/.emacs.d/init.el but when I launch emacs (ie by entering emacs in the terminal), I only get the default emacs. I tried to set up a ".desktop" file, shown below, but it has no effect.

When I run /usr/bin/emacs24 %F -q --load /home/lucas/Dropbox/workspaces/emacs/.emacs.d/init.el from the terminal, my init.el loads properly.

How can I launch emacs easily and get my init.el to load from my Dropbox location? I am running Ubuntu 13.10 (I tried asking this on AskUbuntu, but no responses).

lucas@lucas-ThinkPad-T420:~$ whereis emacs24
emacs24: /usr/bin/emacs24 /etc/emacs24 /usr/bin/X11/emacs24 /usr/share/emacs24 /usr/share/man/man1/emacs24.1.gz

lucas@lucas-ThinkPad-T420:~$ cat .local/applications/emacs24.desktop 
[Desktop Entry]
Version=1.0
Name=GNU Emacs 24
GenericName=Text Editor
Comment=View and edit files
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=/usr/bin/emacs24 %F -q --load /home/lucas/Dropbox/workspaces/emacs/.emacs.d/init.el
TryExec=emacs24
Icon=emacs24
Type=Application
Terminal=false
Categories=Utility;Development;TextEditor;
Was it helpful?

Solution

Place a dummy init file into your $HOME directory, as ~/.emacs with the following contents:

(setq user-emacs-directory (expand-file-name "~/Dropbox/workspaces/emacs/.emacs.d/"))
(load (locate-user-emacs-file "init.el"))

That will not only load your configuration from Dropbox, but also make various Emacs packages save their caches and histories to your Dropbox. For instance, if you are using savehist, you'll have your minibuffer history shared via Dropbox.

OTHER TIPS

When I build Emacs from source, my next step is to create a file called site-start.el and I place it in the lisp directory of the newly built Emacs -- e.g., .../lisp/site-start.el -- the contents of your site-start.el file will be this:

(load-file "/home/lucas/Dropbox/workspaces/emacs/.emacs.d/init.el")

If you are using a build of Emacs that already has a site-start.el, then just add the above code to the bottom of that file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top