Mercurial > emacs
changeset 40210:01666fd1b210
(desktop-last-buffer): New variable.
(desktop-create-buffer): Set it.
(desktop-read): Bind it and switch to that buffer.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 23 Oct 2001 13:52:45 +0000 |
parents | 9b3574f65ee0 |
children | 19a89ce104dd |
files | lisp/desktop.el |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/desktop.el Tue Oct 23 12:46:40 2001 +0000 +++ b/lisp/desktop.el Tue Oct 23 13:52:45 2001 +0000 @@ -576,9 +576,17 @@ (setq dirs (cdr dirs))) (setq desktop-dirname (and dirs (expand-file-name (car dirs)))) (if desktop-dirname - (progn + (let ((desktop-last-buffer nil)) + ;; `load-with-code-conversion' calls `eval-buffer' which + ;; contains a `save-excursion', so we end up with the same + ;; buffer before and after the load. This is a problem + ;; when the desktop is read initially when Emacs starts up + ;; because, if we still are in *scratch* after running + ;; `after-init-hook', the splash screen will be displayed. (load (expand-file-name desktop-basefilename desktop-dirname) t t t) + (when desktop-last-buffer + (switch-to-buffer desktop-last-buffer)) (run-hooks 'desktop-delay-hook) (setq desktop-delay-hook nil) (message "Desktop loaded.")) @@ -666,6 +674,10 @@ ;; ---------------------------------------------------------------------------- ;; Create a buffer, load its file, set is mode, ...; called from Desktop file ;; only. + +(defvar desktop-last-buffer nil + "Last buffer read. Dynamically bound in `desktop-read'.") + (defun desktop-create-buffer (ver desktop-buffer-file-name desktop-buffer-name desktop-buffer-major-mode mim pt mk ro desktop-buffer-misc @@ -678,6 +690,7 @@ (setq result (funcall handler)) (setq hlist (cdr hlist))) (when (bufferp result) + (setq desktop-last-buffer result) (set-buffer result) (if (not (equal (buffer-name) desktop-buffer-name)) (rename-buffer desktop-buffer-name))