[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop.
From: |
Drew Adams |
Subject: |
bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop. |
Date: |
Tue, 1 Dec 2015 09:46:57 -0800 (PST) |
> I think (but I don't know for sure) that explicitly invoking
> `desktop-save' is quite rare
I and other Bookmark+ users use it all the time. We create
desktops as bookmarks, and switch among them - any number
of them - by "jumping" to them.
> "- most desktop files will be saved at Emacs shutdown,
Are you sure? My guess is that most users who only do
that content themselves with a single desktop file, or
perhaps 2 or 3. Users of desktop bookmarks might have
dozens of them.
And saving is independent of Emacs shutdown, logically,
and in reality for desktop bookmarks.
IMHO, it is a big mistake to assume that desktops are
used only in the way provided out of the box. This is
one example of that.
Another example:
It is an unfortunate mistake that desktop.el is written in
such a way that it hard-codes an assumption that there is
only one desktop file per directory. The code uses a
desktop directory (argument or global var) everywhere,
instead of a desktop file argument. Yet the directory is
used only to find the file.
The basic functions, such as `desktop-change-dir' and
`desktop-read', assume this, so they don't take a
DESKTOP-FILE as an optional arg. I needed to write simple
wrapper functions for them, to let users have multiple
desktop files in the same directory. There is no reason
why a desktop file must be associated with a directory -
users should be able to store the files anywhere.
For example:
(defun bmkp-desktop-change-dir (desktop-file)
"Change to desktop saved in DESKTOP-FILE.
Kill the desktop as specified by variables `desktop-save-mode' and
`desktop-save'.
Clear the desktop and load DESKTOP-FILE."
(interactive (list (read-file-name "Change to desktop file: ")))
(unless (file-name-absolute-p desktop-file)
(setq desktop-file (expand-file-name desktop-file)))
(let ((desktop-base-file-name (file-name-nondirectory desktop-file))
(desktop-dir (file-name-directory desktop-file))
(desktop-restore-eager t) ; Don't bother with lazy restore.
(desktop-globals-to-save
(bmkp-remove-if
(lambda (elt) (memq elt bmkp-desktop-no-save-vars))
desktop-globals-to-save)))
(bmkp-desktop-kill)
(desktop-clear)
(desktop-read desktop-dir)))
Fiddling to bind `desktop-base-file-name' etc. is silly,
but necessary because of the desktop.el implementation's
assumption about desktop files.
This is the kind of thing that can result from thinking
things like "explicitly invoking `desktop-save' is quite
rare". Don't assume that the originally intended use case
is the only one.
This said, I don't have anything particular to say now about
a change in desktop format or prompting the user (once only)
about upgrading the format used. And I haven't looked at the
proposed change.
FWIW, bookmark.el handles evolution of the bookmark-file
format across 3 versions in a way that is transparent to
users. Dunno whether the format change for desktop files is
similar, but if it is, you might want to take a look at how
bookmark.el handles it. Search bookmark.el for "IMPORTANT
NOTICE" to see a description of the changes and how they are
dealt with.
HTH.
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Alan Mackenzie, 2015/12/01
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Eli Zaretskii, 2015/12/01
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Eli Zaretskii, 2015/12/01
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Alan Mackenzie, 2015/12/02
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Andy Moreton, 2015/12/02
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Eli Zaretskii, 2015/12/02
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Alan Mackenzie, 2015/12/03
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Eli Zaretskii, 2015/12/03
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Drew Adams, 2015/12/03
- bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop., Alan Mackenzie, 2015/12/03