]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid problems when calling desktop-read twice
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Dec 2020 17:53:55 +0000 (18:53 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Dec 2020 17:53:55 +0000 (18:53 +0100)
* lisp/desktop.el (desktop-read): Don't reload the desktop file if
it's already been loaded, because the later query may lead to
desktop-dirname being set to nil (bug#9765).

lisp/desktop.el

index 7a7f1d07c93bfafd476346e1369fe0141587b381..4be330375da1679dc39b8588f59f0df454bba570 100644 (file)
@@ -1222,7 +1222,13 @@ This function is a no-op when Emacs is running in batch mode.
 It returns t if a desktop file was loaded, nil otherwise.
 \n(fn DIRNAME)"
   (interactive "i\nP")
-  (unless noninteractive
+  (if (or noninteractive
+          (and (desktop-owner)
+               (= (desktop-owner) (emacs-pid))))
+      (message "Not reloading the desktop%s"
+               (if noninteractive
+                   ""
+                 "; already loaded"))
     (setq desktop-dirname
           (file-name-as-directory
            (expand-file-name