From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#22025: Emacs 25 corrupts Emacs 24 .emacs.desktop. Date: Fri, 27 Nov 2015 12:27:54 +0000 Message-ID: References: <20151127083837.GB1782@acm.fritz.box> <83r3jbstgq.fsf@gnu.org> <20151127094718.GC1782@acm.fritz.box> <83io4nspv5.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448627441 13668 80.91.229.3 (27 Nov 2015 12:30:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Nov 2015 12:30:41 +0000 (UTC) To: 22025@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 27 13:30:27 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 1a2IAF-0006gn-RK for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Nov 2015 13:30:12 +0100 Original-Received: from localhost ([::1]:56295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2IAI-0005X3-Hp for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Nov 2015 07:30:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2IAB-0005Qg-Rk for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:30:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2IA8-0003zG-M2 for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:30:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2IA8-0003yy-K5 for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:30:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a2IA7-0005Hy-VI for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:30:04 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <20151127083837.GB1782@acm.fritz.box> Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Nov 2015 12:30:03 +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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144862734420236 (code B ref -1); Fri, 27 Nov 2015 12:30:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Nov 2015 12:29:04 +0000 Original-Received: from localhost ([127.0.0.1]:55228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a2I9A-0005GJ-73 for submit@debbugs.gnu.org; Fri, 27 Nov 2015 07:29:04 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43000) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a2I8p-0005FZ-FT for submit@debbugs.gnu.org; Fri, 27 Nov 2015 07:29:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2I8l-0003Z0-UN for submit@debbugs.gnu.org; Fri, 27 Nov 2015 07:28:43 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:32907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2I8l-0003Yw-RG for submit@debbugs.gnu.org; Fri, 27 Nov 2015 07:28:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2I8h-0002aK-RR for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:28:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2I8b-0003Wr-CE for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:28:35 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:41089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2I8b-0003Wg-6T for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 07:28:29 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a2I8H-0003TS-8k for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2015 13:28:09 +0100 Original-Received: from uk.solarflare.com ([193.34.186.16]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Nov 2015 13:28:09 +0100 Original-Received: from andrewjmoreton by uk.solarflare.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Nov 2015 13:28:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 53 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: uk.solarflare.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) Cancel-Lock: sha1:tKzgw7JCH/OGFm//UNjmFTEp0P8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:109337 Archived-At: On Fri 27 Nov 2015, Eli Zaretskii wrote: >> I think we are enormously cavalier with the .desktop file - no backup of >> any type (such as .emacs.desktop~) is kept, and should there be trouble >> reading .desktop, it is difficult to exit Emacs without having this >> .desktop overwritten. > > Maybe having backups for it would be a good and safe measure, indeed. > At least as an option. Does anyone see any reasons why not? I add this to desktop-save-hook to avoid problems with lost or corrupted desktop files: (defun ajm:backup-desktop-file () "Save a backup of the desktop file." (let* ((version-control t) (delete-old-versions t) (kept-new-versions 8) (kept-old-versions 2) (file (desktop-full-file-name)) (names (find-backup-file-name file)) (backup (pop names))) (when (and (file-exists-p file) backup) (copy-file file backup nil t) (message "Saved backup of desktop file '%s' as '%s'." file backup) (mapc #'delete-file names)))) Doubtless this is hacky and could be improved, but it seems to work for me. >> > Of course, if making that happen is relatively easy, it would be good >> > to have such a compatibility mode. Patches welcome. >> >> I will work on this. I haven't checked recently, but this worked for me the last time I used emacs-25 desktop files with emacs-24: (when (< emacs-major-version 25) (defun ajm:fixup-desktop-create-buffer (args) "Fixup for emacs-24 to use emacs-25 desktop files." (let ((nargs (length args))) (if (> nargs 10) (butlast args (- nargs 10)) args))) (advice-add 'desktop-create-buffer :filter-args 'ajm:fixup-desktop-create-buffer)) With that advice installed, both emacs versions can read either version of desktop file. If emacs-24 reads a version 208 desktop file and then saves a version 206 desktop file, then there may be minor information loss. AndyM