Subject: Re: bug#10977: detail from .xession-errors concerning .desktop extension of ~./emacs.desktop

From: Glenn Morris <[email-masked]>
Date: Mon, 12 Mar 2012 12:42:52 -0400

Stefan Monnier wrote:

>>> I think the necessary change would be to make desktop-read set
>>> desktop-dirname to user-emacs-directory if no existing desktop is found
>>> in any of those three locations (and no DIRNAME arg was specified).
>
> Agreed.
>
>> Only in the case where "." = "~", I should have said.
>
> Disagreed.  I would agree to special case the "."="~" in the sense of
> ignoring "." from desktop-path when "." is "~" (so that
> user-emacs-directory takes precedence over ~), but special casing it
> when setting desktop-dirname doesn't seem to bring us anything.

echo '(desktop-save-mode 1)' >| ~/.emacs
emacs
C-h v desktop-dirname

You'll find it set to the value of PWD. This controls where the desktop
gets saved on exit. I'm saying that when you start in HOME, Emacs should
prefer to save in user-emacs-directory rather than PWD; but not when you
start in /some/other/place (you could never have more than one desktop
then; I make use of multiple desktops).

Another option:
Save all desktops to ~/.emacs.d/desktops/; either with the directory
name encoded in the name of the desktop file, or have an index file that
maps starting directories to desktop files. That would also allow for
named desktops (desktop-project1, desktop-project2, etc).

PS I've also changed my mind and think that .desktop.el would be a
better name than .emacs.desktop. Would need compat code to load
.emacs.desktop if it exists, but prefer saving to .desktop.el.