Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [desktop]

For questions related to saving and restoring Emacs session data with `desktop-save-mode` and related functions.

Filter by
Sorted by
Tagged with
43 votes
4 answers
10k views

Why can't I list the contents of Desktop on macos using dired?

When I do C-x C-f on ~/Desktop/ in macos Catalina, I get the following error. Listing directory failed but 'access-file' worked I can list the directory for just ~. I'm new to Emacs and know little ...
user avatar
16 votes
3 answers
833 views

Daemon mode: Defer interactive prompts on startup?

(Note that, title to the contrary, this question is not the same as How to start in daemon mode and suppress interactive dialogs?, as that question was "answered" by the submitter eliminating what was ...
Trey's user avatar
  • 905
12 votes
2 answers
2k views

Using DeskTop for basic project management

I would like to use DeskTop for basic project management, i.e. opening a set of buffers and restore histories depending on the project I am working on. Is this possible, i.e. having one desktop file ...
Rainer's user avatar
  • 907
12 votes
1 answer
910 views

Remembering history between sessions in Inferior Emacs Lisp Mode

I can't make Emacs remember the history for *ielm* buffers between sessions. As far as I can tell, such history is recorded in the buffer-local variable comint-input-ring. Therefore I have added the ...
Eleno's user avatar
  • 1,448
11 votes
2 answers
2k views

Using desktop-mode with Emacs Daemon

I am using emacs 24.3 (ubuntu 14.10) and would like the daemon to participate in the graphical desktop session lifecycle while using desktop-mode. I went through http://www.emacswiki.org/emacs/...
Andreas Steffan's user avatar
11 votes
1 answer
1k views

Emacs desktop-save-mode - only save desktop when previous desktop was fully restored

I have the following in my .emacs: (desktop-save-mode 1) (setq desktop-restore-eager 10) (setq desktop-save t) Often I have a lot of buffers open (100 or so), then this really helps - as emacs is ...
Christian Herenz's user avatar
9 votes
1 answer
2k views

desktop-save-mode fails to save window layout

I use Emacs 24.5.1 on OS X in terminal mode. I intend to use desktop-save-mode to save and restore window layout (i.e. positions of buffer windows) upon exiting and starting Emacs. From this answer ...
skyork's user avatar
  • 231
8 votes
4 answers
8k views

Speed up Emacs start-up time

I have seen this thread but my problem is an order of magnitude larger. Also, a newbie, I did not understand much of what was being discussed there. So, this new question. I am running Emacs 25.2.2 ...
deshmukh's user avatar
  • 1,912
7 votes
3 answers
3k views

Handle stale desktop lock files after emacs/system crash

If Emacs or the system crashes when desktop-save-mode is active, Emacs leaves a stale desktop lock file. The next time the desktop is loaded (from another Emacs process ID), loading is interrupted ...
Håkon Hægland's user avatar
6 votes
2 answers
802 views

How to start lsp-mode connections lazily after desktop is restored?

I have configured lsp-mode as follows: (use-package lsp-mode :straight t :init (setq lsp-keymap-prefix "C-c l") :hook ((python-mode . lsp)) :commands lsp) I am also using desktop-...
Jouni K. Seppänen's user avatar
6 votes
1 answer
170 views

How can one restore buffers on startup in correct order?

I use desktop-save-mode in order to restore buffers on startup. However, the buffer which is visible immediately after startup is *scratch*, *Messages*, .bbdb, etc. I am not interested in those. Is ...
Torsten Bronger's user avatar
5 votes
1 answer
325 views

Why is the `buffer-undo-list` excluded from `(buffer-local-variables)`?

I am modifying desktop.el to support restoring the buffer-undo-list, and am push-ing that list at the tail end of the function desktop-buffer-info because the buffer-undo-list is not included in the ...
lawlist's user avatar
  • 19.2k
5 votes
1 answer
374 views

How to restore windows registers from saved desktop

I save a few different windows registers using M-x r w and then save the entire desktop with M-x desktop-save. I then restart Emacs and load the desktop using M-x desktop-read. If I do M-x r j do ...
Mikael Springer's user avatar
4 votes
2 answers
2k views

How to use a fixed desktop save directory name with desktop-save-mode?

I would like to use a standard desktop save file when using Emacs as a server (with Emacsclient) and use no desktop save file (or optionally, another desktop save file) when running a regular Emacs ...
Håkon Hægland's user avatar
4 votes
1 answer
607 views

Restoring Emacs desktops with daemon + clients

How to use Emacs desktop functionality with emacs daemon + emacsclient instances? I've enabled (desktop-save-mode 1) in my init file, and when I start the daemon I see messages like this: Desktop: 1 ...
Galder Zamarreño's user avatar
4 votes
0 answers
104 views

How to have desktop-mode restore only the <n> most recently used buffers

I currently have in my config: (desktop-save-mode 1) (setq desktop-restore-eager 10) Which on startup, will eagerly restore 10 buffers, and then when Emacs is idle, restore all the others. Is there ...
Lee H's user avatar
  • 2,737
4 votes
0 answers
461 views

Restore desktop frames for Emacs server

The version of desktop.el that comes with Emacs 24.4 allows restoring frames as well as windows and buffers. This works fine for an Emacs server (i.e., daemon) with at least one open frame. However, a ...
holocronweaver's user avatar
3 votes
1 answer
568 views

How to save and restore the association of a window to buffer across Emacs sessions?

I have a window layout with three windows and I would like Emacs to remember the buffers even if the buffers don't exist after restart. Context: I am using Spacemacs for Clojure development. In ...
Witek's user avatar
  • 355
3 votes
1 answer
239 views

How to save modified buffers when changing desktop?

I am using desktop-save-mode and desktop-change-dir to handle multiple desktops. This works fine, except for the case when I have modified some buffers, and then run desktop-change-dir before having ...
Håkon Hægland's user avatar
3 votes
1 answer
248 views

Emacs 24.4 in OS X 10.10 is not restoring windows configuration (desktop)

I read that Emacs 24.4 should restore the desktop by default. It works perfectly except that the window configuration is not retained. It is saved because I can clearly read it in the desktop file, ...
gurghet's user avatar
  • 131
3 votes
0 answers
182 views

Can desktop sessions be used to save and restore shell buffers?

Is it possible to use desktop-save-mode to save and partially restore my shell buffers? I realize shell buffers have quite a bit of state that isn't under the direct control of emacs, so specifically ...
Nicholas Bishop's user avatar
3 votes
0 answers
223 views

Do I need session mode if I use desktop mode?

I found old mail in my mailbox: Date: 2010-09-13 17:41:21+0300 Mon (require 'session) (add-hook 'after-init-hook 'session-initialize) Now I am using desktop mode: (setq desktop-base-file-name "....
gavenkoa's user avatar
  • 3,452
2 votes
3 answers
89 views

Why do desktops depend on folders?

I think, it'd make a lot more sense to have desktops be identified by names (like bookmarks). If it's deemed desirable that they can be stored in different locations, it'd make sense to select what ...
UTF-8's user avatar
  • 915
2 votes
1 answer
829 views

How to make emacs prompt yes or no to save the session when desktop-save-mode is on?

I started to use emacs a few days ago and still getting the hang of it. desktop-save-mode is really handy at times as I don't have to reopen all the files that I had already opened in my previous ...
Chakravarthy Raghunandan's user avatar
2 votes
1 answer
270 views

How to make desktop-save store relative paths?

Perhaps I'm kind of misusing that feature – but I find desktop files rather handy to be kept with projects. Clearly, it doesn't make much sense then to store absolute paths for the files to be ...
leftaroundabout's user avatar
2 votes
1 answer
92 views

Is desktop restore expected to override --no-window-system?

When I run emacs -nw (--no-window-system) emacs (v29.1 on macOS v13.6.1) initially begins running in the terminal window, with the terminal clearing and the modeline appearing at the bottom. Quite ...
cpcallen's user avatar
  • 213
2 votes
1 answer
263 views

desktop-save-mode: prevent emacs from showing each buffer on start-up

If you use desktop-save-mode, and have several hundred buffers saved, when you start emacs, emacs cycles through these buffers and shows each of them for a split second. Can this be prevented?
Marius Hofert's user avatar
2 votes
1 answer
282 views

Periodic desktop save

How can I have emacs save my desktop periodically, so it will persist even if I do not exit with C-c C-x in desktop-save-mode or save manually?
Toothrot's user avatar
  • 3,264
2 votes
0 answers
53 views

Restoring windows with Desktop when running Emacs inside a terminal? [duplicate]

Maybe a silly question: I'm using desktop for saving Emacs' sessions. I've set (setq desktop-restore-frames t) (desktop-save-mode 0) So windows and frames state is supposed to be saved, and I'm ...
amitr's user avatar
  • 121
2 votes
0 answers
40 views

How to get desktop-read to ignore/modify frame size?

I'm using (desktop-save-mode 1) to save a session which I then reload, but logging in remotely from a different machine with a different resolution display. Something stored in the desktop winds up ...
Norman Ramsey's user avatar
2 votes
0 answers
177 views

reopening emacsclient -t with desktop-save-mode doesn't save buffers/frames in place [duplicate]

I added (desktop-save-mode 1) to my custom.el towards the end to save buffers and frames. But I primarily use emacs --daemon and start an emacsclient -t. For some reason, if I use just Emacs the ...
jkhdf's user avatar
  • 21
2 votes
1 answer
163 views

How to not load font faces from desktop files?

I use desktop-save and desktop-change-dir a lot. Recently, I upgraded my hardware and now have a screen with way more DPI. This forced me to increase the font size in emacs. Unfortunately, all my ...
Jonas Schäfer's user avatar
1 vote
3 answers
1k views

How to prompt to ask for confirmation when C-x C-c in emacsclient?

I use (setq desktop-save 'ask) in my init.el, so every time I C-x C-c to exit Emacs, it will prompt to ask if saving desktop or not; I use this trick to avoid accidentally exiting Emacs. But after ...
CodyChan's user avatar
  • 2,649
1 vote
1 answer
191 views

Limit number of files saved by emacs in desktop-save

I tend not to delete buffers in emacs, so over time, the number of buffers tends to grow to a hundred or more. (At the moment, *Buffer List* has 144 lines.) Many of these files are java files, and ...
Troy Daniels's user avatar
1 vote
1 answer
63 views

Why does a certain file always gets opened on startup?

I'm using desktop-save-mode to automatically open the files that I had opened in the last session. This mode should also remember the files that I closed so that it no longer opens them in the next ...
Ricardo's user avatar
  • 131
1 vote
1 answer
207 views

Open another emacs and cause conflicts

I have a GUI emacs running as the major working area, When I reading articles from web, need to open a emacs as a tool to keep note; Web on the left and new emacs on the right, Usually, get ...
Alice's user avatar
  • 219
1 vote
1 answer
495 views

Configuring the number of buffers saved by ido, using ido-use-virtual-buffers?

I really love the ability to quickly navigate to files opened in old editing sessions that desktop provides. However, there are a few things I don't like about it so I'd like to stop using it if ...
Croad Langshan's user avatar
1 vote
1 answer
108 views

POSIX signal handler in Emacs Lisp

Does Emacs allow it to implement POSIX signal handling in Lisp? Specifically, I would like to handle SIGTERM to finish desktop-mode related things.
Andreas Steffan's user avatar
1 vote
1 answer
440 views

Closing emacs results in "Current desktop was not loaded from a file" even though desktop-save-mode was set before start

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-...
topkek's user avatar
  • 89
1 vote
1 answer
328 views

Make Emacs systemd service kill when logging out/shutting down

I am trying to use desktop-save-mode together with emacs daemon. ;; save desktop before quitting (add-hook 'kill-emacs-hook (lambda () (desktop-save "~/.emacs.d/"))) But when I log out of the ...
Daanturo's user avatar
  • 180
1 vote
1 answer
354 views

Help? - Freeze up to 10 seconds happening on windows when exiting (kill-emacs) when desktop-save-mode and back-button-mode are enabled

I've spent a full working day trying to somehow resolve this, no luck, so I'm turning to this place hoping for help. Recently I started experiencing freeze of something like up to 10 seconds when ...
Lauris's user avatar
  • 111
1 vote
1 answer
85 views

What is missing to show the desktop-dirname in the frame title? [duplicate]

I tried to get the value of desktop-dirname into the title of a frame: (setq frame-title-format '("%b Desktop: " (car (last (split-string desktop-dirname "/" t))))) The (...
Markus's user avatar
  • 481
1 vote
1 answer
165 views

Emacs reopens all frames in current virtual desktop, not in each correct one

I am using emacs for OSX (GUI, not the terminal). I use desktop-save in order to save my workflow when closing emacs. All works fine except when I use OSX virtual desktop: if I open emacs in "Virtual ...
Nisba's user avatar
  • 905
1 vote
1 answer
445 views

Save and load different desktop files based on the mode

I would like to keep distinct desktop files in order to be able resume sessions based on the mode. When I open Emacs it should load the desktop file for the mode it starts with and when I run, say, M-...
Arch Stanton's user avatar
  • 1,657
1 vote
1 answer
151 views

Bug in Emacs 29.0.60 or is there a way to prevent moving the Emacs position on restart?

Emacs allows to store the state of its GUI in a .desktop file which on next start of Emacs restores its last state. It should preserve its size, position and arrangement of the tabs and windows (it ...
Claudio's user avatar
  • 475
1 vote
0 answers
62 views

saving cloned buffers in workspaces/desktops/perspectives etc

i would like to be able to save a window (in emacs terms) layout with cloned buffers. i don't need it to save a series of buffers, i just need to be able to load a complex window layout when i work on ...
martian's user avatar
  • 548
1 vote
1 answer
37 views

How can I display desktop-dirname in the modeline (or elsewhere)?

I often get confused about the current desktop I'm using. Currently, I have to call (display-variable desktop-dirname) to see in which desktop I'm working. It would be much nicer, if the current ...
Markus Grunwald's user avatar
1 vote
0 answers
53 views

X Session Desktop integration

When I run Emacs under an X11 session manager, it provides a RestartCommand="emacs25 --smid=ef85455de14b4e6a8a8c39dae106b554 --chdir=/some/dir". I would like it to open the same files as last time, ...
Egil Möller's user avatar
1 vote
0 answers
162 views

Save my Emacs registry entries without having to use desktop-save

I frequently create registry entries which I wish to keep across Sessions. Emacs does not save registry entries across sessions. This can be done by using desktop-save, but the downside is that ...
Edman's user avatar
  • 1,229
1 vote
1 answer
159 views

window-configuration-change-hook false positives from desktop-mode

I'm trying to use window-configuration-change-hook in a package to perform some action when a buffer becomes visible for the first time. It works, however when starting Emacs, desktop-mode calls ...
Muir's user avatar
  • 321