Mercurial > emacs
changeset 70644:75ac416582c4
(desktop-save): Use with-temp-buffer.
author | Lars Hansen <larsh@soem.dk> |
---|---|
date | Sat, 13 May 2006 13:31:41 +0000 |
parents | 6d2e3853b2fc |
children | b081f2f67743 |
files | lisp/desktop.el |
diffstat | 1 files changed, 34 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/desktop.el Sat May 13 10:52:41 2006 +0000 +++ b/lisp/desktop.el Sat May 13 13:31:41 2006 +0000 @@ -763,45 +763,42 @@ (setq locals (cdr locals))) ll))) (buffer-list))) - (eager desktop-restore-eager) - (buf (get-buffer-create "*desktop*"))) - (set-buffer buf) - (erase-buffer) - - (insert - ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n" - desktop-header - ";; Created " (current-time-string) "\n" - ";; Desktop file format version " desktop-file-version "\n" - ";; Emacs version " emacs-version "\n\n" - ";; Global section:\n") - (mapc (function desktop-outvar) desktop-globals-to-save) - (if (memq 'kill-ring desktop-globals-to-save) + (eager desktop-restore-eager)) + (with-temp-buffer (insert - "(setq kill-ring-yank-pointer (nthcdr " - (int-to-string (- (length kill-ring) (length kill-ring-yank-pointer))) - " kill-ring))\n")) + ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n" + desktop-header + ";; Created " (current-time-string) "\n" + ";; Desktop file format version " desktop-file-version "\n" + ";; Emacs version " emacs-version "\n\n" + ";; Global section:\n") + (mapc (function desktop-outvar) desktop-globals-to-save) + (if (memq 'kill-ring desktop-globals-to-save) + (insert + "(setq kill-ring-yank-pointer (nthcdr " + (int-to-string (- (length kill-ring) (length kill-ring-yank-pointer))) + " kill-ring))\n")) - (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n") - (mapc #'(lambda (l) - (when (apply 'desktop-save-buffer-p l) - (insert "(" - (if (or (not (integerp eager)) - (unless (zerop eager) - (setq eager (1- eager)) - t)) - "desktop-create-buffer" - "desktop-append-buffer-args") - " " - desktop-file-version) - (mapc #'(lambda (e) - (insert "\n " (desktop-value-to-string e))) - l) - (insert ")\n\n"))) - info) - (setq default-directory dirname) - (let ((coding-system-for-write 'emacs-mule)) - (write-region (point-min) (point-max) filename nil 'nomessage)))) + (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n") + (mapc #'(lambda (l) + (when (apply 'desktop-save-buffer-p l) + (insert "(" + (if (or (not (integerp eager)) + (unless (zerop eager) + (setq eager (1- eager)) + t)) + "desktop-create-buffer" + "desktop-append-buffer-args") + " " + desktop-file-version) + (mapc #'(lambda (e) + (insert "\n " (desktop-value-to-string e))) + l) + (insert ")\n\n"))) + info) + (setq default-directory dirname) + (let ((coding-system-for-write 'emacs-mule)) + (write-region (point-min) (point-max) filename nil 'nomessage))))) (setq desktop-dirname dirname)) ;; ----------------------------------------------------------------------------