Open desktop session by name from command line?
patrickkidd opened this issue · comments
Hello! Excellent package you've done. Is there a way to load a desktop session by name form the command line? Something like:
emacs --eval "(desktop-load my-session-name)"
I am no lisp expert.
Thanks!
Something like this should work:
emacs --eval '(desktop-load "my-session-name")'
However, you need double quotes around the eval
argument if you want to use it in a shell function which takes a desktop session file name as its argument. Repeating here my suggested solution from the StackOverflow thread:
emd () {
cd $HOME/Sites/"$1" &&
emacs --eval "(progn (require 'desktop+) (desktop-load \"$1-desktop-name\"))" &
}
Yes, this is the correct way to wrap it inside a shell function.
Like I said in the StackOverflow thread, require
ing the package isn't necessary (as desktop-load
is autoloaded), but it doesn't hurt either.
This has all worked well for me. I'm looking forward to the day when I am in one emacs session 100%, but this will be great in the meantime.
Thanks again for the great package.