[OS X Emacs] Warning: Desktop file appears to be in use by PID ...

Jack Repenning jrepenning at collab.net
Sun Sep 18 18:59:04 EDT 2011

On Sep 18, 2011, at 4:54 AM, Hofert Jan Marius wrote:

> I have exactly the problem mentioned here [leftover desktop-save lock files]
> Any ideas? 

You're reported a symptom, but given no details of your use or debugging. That makes it hard to comment concisely.

Do you in fact want to use "desktop save" mode at all? This mode (which is the thing that uses that file) arranges that Emacs will start up displaying the same files it was displaying when last it was shut down. If that's not actually interesting to you, then you can turn if off by setting desktop-save to nil (say, in "Options: Customize Emacs: Specific Group: desktop").

If you want desktop-save mode, then you need to debug its configuration. The mode includes some code to clean up this lock file; clearly, this code either is failing, or isn't even running. The best way to do that is to step through desktop.el, confirming all its expectations to see which is not satisfied:

1. "When the desktop module is loaded, the function `desktop-kill' is added to the `kill-emacs-hoook'." So is desktop-kill in kill-emacs-hook? Go to the *scratch* buffer, check in the mode line to be sure it's in Lisp Interaction mode (if not, do M-x lisp-interaction), type "kill-emacs-hook" and press ^J. You should get a list of possibly several function names; desktop-kill should be among them. If it is not, look in your Preferences.el file to see if you're monkeying with kill-emacs-hook (and unknowingly removing desktop-kill).

2. Looking at the defun of desktop-kill, I see a chance or two for it to ask a question, and certain possible answers (or aborting Emacs while it's waiting for an answer) could defeat the unlocking. Do you get questions while shutting down? Do you shut down by some means that might interfere with this question-and-answer dialog? If you have some need to shut down without answering questions, then set desktop-save to t rather than 'ask or several other possibilities (again, the Customize menu is probably the easiest path). Also, be sure that desktop-dirname and desktop-base-file-name are set sensibly.

Jack Repenning
CollabNet Cloud Services
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
office: +1 650.228.2562
twitter: http://twitter.com/jrep

More information about the MacOSX-Emacs mailing list