I love to start emacs in daemon mode with my first login and then have the same emacs process for all subsequent logins, be it graphical, on physical console or from the network via ssh.

But there is a problem with this, when using a session to save the last open files and some of this files are encrypted (e.g. with gpg) and ask for the decryption key on load. Then the application is frozen and waits for an input from a disconnected stdin.

How can I defer the question to the first time interactively changing to the buffer?

Or, how can I exclude the encrypted files from the session?

And maybe there is just another solution.

1 Answer 1


Though having not found how to defer the password request, I have learned a lot about desktops.

So to exclude gpg-files from desktop-save there is the variable desktop-files-not-to-save that is documented

Regexp identifying files whose buffers are to be excluded from saving.

The default value as shown in the customize buffer


excludes TRAMP files from being saved. With the following regexp no files ending in .gpg are saved, too


and this is a first pragmatic answer to my problem.

Now I have to learn about the alternatives to desktop mode for Session Management. Maybe there is something more clever ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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