GNU bug report logs -
#17351
Trunk emacs splats .emacs.desktop at startup
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Sat, 26 Apr 2014 18:09:02 UTC
Severity: important
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 17351 <at> debbugs.gnu.org (full text, mbox):
>> This would keep the desktop file open all the time,
>> and users might not like to see it in the buffer list.
>
> So read it into an invisible buffer, set buffer-file-name, and enable
> auto-save-mode.
auto-save-mode doesn't seem necessary because the contents of the
desktop file buffer has to be generated at the given time interval
anyway, so at the end it can be saved as well like in this patch:
=== modified file 'lisp/desktop.el'
--- lisp/desktop.el 2014-06-06 23:38:40 +0000
+++ lisp/desktop.el 2014-06-23 22:45:20 +0000
@@ -1038,8 +1038,15 @@ (defun desktop-save (dirname &optional r
(point))))
(checksum (and beg (md5 (current-buffer) beg (point-max) 'emacs-mule))))
(unless (and checksum (equal checksum desktop-file-checksum))
- (let ((coding-system-for-write 'emacs-mule))
- (write-region (point-min) (point-max) (desktop-full-file-name) nil 'nomessage))
+ (let ((coding-system-for-write 'emacs-mule)
+ (buffer-string (buffer-string)))
+ (with-current-buffer (find-file-noselect (desktop-full-file-name))
+ ;; Make the buffer invisible
+ (unless (eq (aref (buffer-name) 0) ?\s)
+ (rename-buffer (concat " " (buffer-name))))
+ (erase-buffer)
+ (insert buffer-string)
+ (save-buffer)))
(setq desktop-file-checksum checksum)
;; We remember when it was modified (which is presumably just now).
(setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))))))))))
This bug report was last modified 10 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.