Subject: bug#41007: 26.3; desktop-save and reloading

From: Drew Adams <[email-masked]>
Date: Fri, 1 May 2020 13:37:26 -0700 (PDT)

> Other problem, and this is likely just unfamiliarity, but if you do
> desktop-save it asks you where to save it. If you do desktop-read, it
> doesn't ask. Docs say (desktop-read &optional DIRNAME) but that's not
> exposed interactively that I can see.

FWIW, and just in case it helps -

`desktop-read' is poorly designed, IMHO.  Or at
least some other read-a-desktop function should
be available.

desktop.el uses a desktop file to save state,
and it reads a desktop file to restore state.
But the desktop UI does not provide any function
(let alone a command) for reading a desktop file
by providing its file name.  (That's unusual for
Emacs, BTW.)

I remedied this long ago for library Bookmark+,
by adding command `bmkp-desktop-read`, which
does take a desktop file name as argument.

This is important for Bookmark+, as it lets
you easily create bookmarks to restore any
number of desktops, with their files located
anywhere (including multiple files in the same
directory).

But it should be important more generally for
Emacs, IMO.  The current (and original) design
of desktop.el assumes, in effect, that you have
at most one desktop file per directory.  And it
therefore bases its UI on the current directory,
not on an arbitrarily located desktop file.

IOW, the UI design does not really fit the
functional design, in the sense that a desktop
_file_ is what is needed.  In reality, a
desktop file can be anywhere, but nothing in
the UI suggests or supports that.

If you care about this (and I know it's not
directly related to the problem you reported)
then you can always copy the code for
`bmkp-desktop-read` and use that.  There's
really nothing in its definition that is
particularly bookmark-oriented, so it can
trivially be adapted for general use.

https://www.emacswiki.org/emacs/BookmarkPlus