I have set the following things in my .el file (not init.el):

(setq desktop-dirname         "~/.emacs.d/desktop/"
  desktop-base-file-name      "emacs.desktop"
  desktop-base-lock-name      "lock"
  desktop-path                (list desktop-dirname)
  desktop-save                t
  desktop-files-not-to-save   "^$" ;reload tramp paths
  desktop-load-locked-desktop nil
  desktop-auto-save-timeout   30)

(desktop-save-mode 1)

Although the desktop file is saved/updated to ~/.emacs.d/desktop the following happens. When I try to close emacs I get the following message:

"Current desktop was not loaded from a file. Overwrite this desktop file?"

Even if I choose to overwrite it (and close emacs), the exact same thing happens the next time closing emacs.

  • Is that all there is to the recipe to repro the problem? Do you see the same thing if you start Emacs using emacs -Q (no init file) and you then use that code? Seems like we're missing some info.
    – Drew
    Nov 30 '20 at 18:24
  • Probably a noob question but if I start emacs without an init file, how should I test the issue?
    – topkek
    Nov 30 '20 at 18:55
  • Start Emacs without an init file, then do whatever you would do in your init file that's needed to repro the problem - and only that stuff (no extra stuff from your init file). Tell us step by step what you see and what you expected to see instead.
    – Drew
    Nov 30 '20 at 20:18
  • I don't get it... There are 3 options: -I either have all the options set like in my post and get the message and it does not work correctly -I don't set them just (desktop-save-mode 1) and I get prompted every single time where I want to save my desktop -I disable desktop saving. I don't even do anything else just edit my .el file (which is then read by init.el) and that's it.
    – topkek
    Dec 2 '20 at 12:59

This is the result of not including (desktop-read) in your setup.


(desktop-save-mode 1)

But rather do both of these:

(desktop-save-mode 1)

(desktop-read) is the thing that "reads current desktop from a file".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.