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

From: Stefan Monnier <[email-masked]>
Date: Mon, 12 Mar 2012 14:14:31 -0400

>>>> 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.

Yes, and that should be user-emacs-directory instead.

> 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;

We agree on this case.

> but not when you start in /some/other/place

Here I disagree.  If a desktop file is found somewhere up from
/some/other/place, then we should use it, but otherwise desktop-dirname
should be set to user-emacs-directory.

> (you could never have more than one desktop then; I make use of
> multiple desktops).

You could still have them.  The user would simply have to explicitly
save it in /some/other/place.

> 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).

That'd be OK as well.

> 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.

FWIW, I think that ".el" should be reserved for files containing Elisp
code, rather than any Elisp data; IOW it should be intended for `load'
rather than for `read'.  Not sure what to use for Elisp data,
tho... maybe ".eld"?

        Stefan