From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop. Date: Wed, 2 Dec 2015 12:35:31 +0000 Message-ID: <20151202123531.GB2318@acm.fritz.box> References: <20151127083837.GB1782@acm.fritz.box> <83r3jbstgq.fsf@gnu.org> <20151201121940.GA2611@acm.fritz.box> <83a8pukwdq.fsf@gnu.org> <20151201170138.GB2611@acm.fritz.box> <9d7e9acc-9c9f-4a10-afcc-989e16f8e6a5@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1449059671 31620 80.91.229.3 (2 Dec 2015 12:34:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Dec 2015 12:34:31 +0000 (UTC) Cc: 22025@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 02 13:34:19 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a46bv-0004H1-O0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Dec 2015 13:34:15 +0100 Original-Received: from localhost ([::1]:57771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a46bt-0000AL-Sm for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Dec 2015 07:34:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a46bp-0000AD-Li for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2015 07:34:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a46bj-0004Zf-4C for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2015 07:34:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a46bi-0004ZX-VL for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2015 07:34:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a46bi-0008L1-Gi for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2015 07:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Dec 2015 12:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22025 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22025-submit@debbugs.gnu.org id=B22025.144905960931998 (code B ref 22025); Wed, 02 Dec 2015 12:34:02 +0000 Original-Received: (at 22025) by debbugs.gnu.org; 2 Dec 2015 12:33:29 +0000 Original-Received: from localhost ([127.0.0.1]:35742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a46bA-0008K1-DC for submit@debbugs.gnu.org; Wed, 02 Dec 2015 07:33:28 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:65103) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a46b7-0008Jr-EN for 22025@debbugs.gnu.org; Wed, 02 Dec 2015 07:33:26 -0500 Original-Received: (qmail 16086 invoked by uid 3782); 2 Dec 2015 12:33:24 -0000 Original-Received: from acm.muc.de (p548A535B.dip0.t-ipconnect.de [84.138.83.91]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 02 Dec 2015 13:33:23 +0100 Original-Received: (qmail 2550 invoked by uid 1000); 2 Dec 2015 12:35:31 -0000 Content-Disposition: inline In-Reply-To: <9d7e9acc-9c9f-4a10-afcc-989e16f8e6a5@default> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:109525 Archived-At: Hello, Drew. On Tue, Dec 01, 2015 at 09:46:57AM -0800, Drew Adams wrote: > > 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. Thanks. I didn't know about this. As a matter of interest, where is the source for Bookmark+? > > "- 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. I have just a single desktop file. The idea of having lots of them, and switching between them is a new one to me. A big problem with the desktop idea is that of gradually accumulating files which must be explicitly closed at some point. I'm guessing that with lots of smaller desktop files, you can just delete an entire desktop when you've finished using it. > 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. OK. > 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. Here, I begin to get a little sceptical. How will being able to store desktop files "anywhere" actually be useful? It seems to me that the typical desktop file of many will, in fact, be associated with a particular directory, the directory where work is actually being done for some particular topic. Being able to store it "anywhere" would add complexity to desktop.el, and I don't think that extra complexity has yet been justified. > 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. In the new desktop format, the central function `desktop-create' now has an extra argument. Since `desktop-create' is written to the desktop file as a function call, it has too many arguments for the old version of desktop.el in Emacs <= 24.5. There is no nice and easy way to deal with this. > HTH. -- Alan Mackenzie (Nuremberg, Germany).