0

I use emacs in different tmux sessions. Each time I run new emacs instance it says:

Warning: desktop file appears to be in use by PID <pid>. Using it may cause conflicts. Use it anyway? (y or n)

Is there standard way to save desktop per each tmux(screen) session?

0

As is stated in the warning, the desktop file is locked by emacs (you can see a .emacs.desktop.lock file alongside .emacs.desktop), otherwise free access to the file by multiple emacs instances can lead to a race condition.

How to solve this depends on your needs:

  1. most likely, you want to save all desktop info (from different tmux sessions) in the same place, then you just need to start emacs in daemon mode, by either starting emacs with emacs --daemon or evaluating (server-start) somewhere like init file. Then in tmux session cli, you edit files with emacsclient, I personally do alias e="emacsclient -n". Now you essentially use one same emacs instance howmany times you emacsclient, so it can hold the lock itself with no problem.

  2. rare case is that you want different desktops for different tmux session etc.. Then you may start real emacs instances like you formerly do, but set different desktop-basefilename each time you start one. Something like emacs --eval '(setq desktop-basefilename "tmux-1")'

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.