doomemacs / doomemacs/core

Default value of desktop-base-file-name is incompatible with doom/quickload-session

Open
#7,580 1 comment 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [X] The issue can be reproduced on the **latest** available commit of Doom.

- [X] The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

After `M-x doom/quicksave-session`, the saved session can be loaded (exactly once) by `M-x doom/quickload-session`.

### Current behavior

Nothing happens, but `doom/quickload-session` messages that loading was a success.

The cause is the default value of `desktop-base-file-name` in desktop.el: `.emacs.desktop`. `doom/quickload-session` calls `doom-load-session`, which calls `restart-emacs--restore-frames-using-desktop` from restart-emacs.el with the `file` argument set to `desktop-base-file-name`. This function assumes `file` has a file extension: it sets `desktop-base-file-name` to the results of `(file-name-base file)`, which converts ".emacs.desktop" to ".emacs". Then it calls `desktop-read`. `desktop-read` calls `desktop-full-file-name`, which returns an incorrect path based on the mangled `desktop-base-file-name`, and passes the results to `file-exists-p`, and the chain of function calls fails silently. `doom/quickload-session` reports a message that the session was restored.

### Steps to reproduce

1. `M-x doom/quicksave-session`
2. Delete at least one buffer/window to enable you to visually verify if the session loads.
3. `M-x doom/quickload-session` reports "Session restored. Welcome back," despite note loading the saved session. The saved session file is not deleted, as it should be on success.

### System Information

https://pastebin.com/KjKTEEJd

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.