From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#17351: Trunk emacs splats .emacs.desktop at startup Date: Mon, 23 Jun 2014 02:01:16 +0300 Organization: JURTA Message-ID: <87y4wo5ynb.fsf@mail.jurta.org> References: <20140426180427.GA2944@acm.acm> <87eh0jji5s.fsf@mail.jurta.org> <20140427091555.GA3091@acm.acm> <87fvkzf6bi.fsf@mail.jurta.org> <1ud2e177bf.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1403479769 22149 80.91.229.3 (22 Jun 2014 23:29:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Jun 2014 23:29:29 +0000 (UTC) Cc: Alan Mackenzie , 17351@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 23 01:29:21 2014 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 1WyrCL-0003bV-83 for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Jun 2014 01:29:21 +0200 Original-Received: from localhost ([::1]:50483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyrCK-0001NK-MZ for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Jun 2014 19:29:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyrCA-0001MG-G8 for bug-gnu-emacs@gnu.org; Sun, 22 Jun 2014 19:29:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WyrC3-0004IF-0K for bug-gnu-emacs@gnu.org; Sun, 22 Jun 2014 19:29:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyrC2-0004I7-Ta for bug-gnu-emacs@gnu.org; Sun, 22 Jun 2014 19:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WyrC2-0007bG-E6 for bug-gnu-emacs@gnu.org; Sun, 22 Jun 2014 19:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Jun 2014 23:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17351 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17351-submit@debbugs.gnu.org id=B17351.140347968329132 (code B ref 17351); Sun, 22 Jun 2014 23:29:02 +0000 Original-Received: (at 17351) by debbugs.gnu.org; 22 Jun 2014 23:28:03 +0000 Original-Received: from localhost ([127.0.0.1]:57429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WyrB5-0007Zo-03 for submit@debbugs.gnu.org; Sun, 22 Jun 2014 19:28:03 -0400 Original-Received: from alc-vshost7.dreamhost.com ([69.163.216.107]:46632 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WyrAz-0007ZJ-WE for 17351@debbugs.gnu.org; Sun, 22 Jun 2014 19:27:59 -0400 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 97E0C30978B24D; Sun, 22 Jun 2014 16:27:55 -0700 (PDT) In-Reply-To: <1ud2e177bf.fsf@fencepost.gnu.org> (Glenn Morris's message of "Sun, 22 Jun 2014 03:05:24 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) 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: 140.186.70.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:90680 Archived-At: > As a stopgap, how about disabling the autosave (with a warning, eg > "error loading desktop; automatic save disabled until next manual save") > if there were errors loading the desktop at startup? It's not clear where to catch errors and handle them, because they can occur everywhere and it's better to leave the default error processing that enters the debugger. But without such warning message, it's possible to disable autosaving when loading desktop with a simple patch below. > More generally, why does the autosaving actually save directly into the > real desktop file? Why doesn't it use the normal autosave mechanism, ie > write to a #desktop# file? Naively, it seems like this would be both > simpler to implement and give better results. This would keep the desktop file open all the time, and users might not like to see it in the buffer list. If this is not desirable then a backup copy needs to be saved once per session after reading the desktop. === modified file 'lisp/desktop.el' --- lisp/desktop.el 2014-06-06 23:38:40 +0000 +++ lisp/desktop.el 2014-06-22 22:52:31 +0000 @@ -174,11 +174,8 @@ (define-minor-mode desktop-save-mode :global t :group 'desktop (if desktop-save-mode - (when (and (integerp desktop-auto-save-timeout) - (> desktop-auto-save-timeout 0)) - (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer)) - (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (desktop-auto-save-cancel-timer))) + (desktop-auto-save-enable) + (desktop-auto-save-disable))) (defun desktop-save-mode-off () "Disable `desktop-save-mode'. Provided for use in hooks." @@ -219,9 +216,8 @@ (defcustom desktop-auto-save-timeout aut (set-default symbol value) (ignore-errors (if (and (integerp value) (> value 0)) - (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (desktop-auto-save-cancel-timer)))) + (desktop-auto-save-enable value) + (desktop-auto-save-disable)))) :group 'desktop :version "24.4") @@ -1132,6 +1128,7 @@ (defun desktop-read (&optional dirname) (unless desktop-dirname (message "Desktop file in use; not loaded."))) (desktop-lazy-abort) + (desktop-auto-save-disable) ;; Evaluate desktop buffer and remember when it was modified. (load (desktop-full-file-name) t t t) (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) @@ -1184,6 +1181,7 @@ (defun desktop-read (&optional dirname) (set-window-prev-buffers window nil) (set-window-next-buffers window nil)))) (setq desktop-saved-frameset nil) + (desktop-auto-save-enable) t)) ;; No desktop file found. (desktop-clear) @@ -1230,6 +1228,15 @@ (defun desktop-save-in-desktop-dir () ;; Auto-Saving. (defvar desktop-auto-save-timer nil) +(defun desktop-auto-save-enable (&optional timeout) + (when (and (integerp (or timeout desktop-auto-save-timeout)) + (> (or timeout desktop-auto-save-timeout) 0)) + (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer))) + +(defun desktop-auto-save-disable () + (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) + (desktop-auto-save-cancel-timer)) + (defun desktop-auto-save () "Save the desktop periodically. Called by the timer created in `desktop-auto-save-set-timer'."