Subject: bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.

From: Alan Mackenzie <[email-masked]>
Date: Wed, 22 Oct 2008 12:48:23 +0000

On Wed, Oct 22, 2008 at 12:12:28PM +0100, Lawrence Mitchell wrote:
> Alan Mackenzie wrote:
> > (i) With desktop enabled, start emacs.

> > (ii) Start a second emacs session.

[ .... ]

> > Emacs2 decides, because desktop is "enabled", that it wants to save a
> > desktop file, and prompts:

> >     "Directory for desktop file: ~/"

> > At this point, C-g aborts the "end Emacs" command.  One now has the
> > unpleasant choice of killing Emacs2 from the (operating system) console
> > or typing in some random directory to dump the empty .emacs.desktop to.

> > This is a bug.

> I cannot reproduce with the following sequence to enable desktop:

> ;; start an emacs that creates a desktop file and quit
> $ emacs -Q --eval '(progn (setq desktop-path (list "/tmp/"))
> (desktop-save-mode 1) (desktop-read) (dired "/tmp/")
> (save-buffers-kill-emacs))'

> ;; now start an emacs to read the desktop file (acquiring a lock)
> $ emacs -Q --eval '(progn (setq desktop-path (list "/tmp/"))
> (desktop-save-mode 1) (desktop-read))' &

> ;; start a second emacs
> $ emacs -Q --eval '(progn (setq desktop-path (list "/tmp/"))
> (desktop-save-mode 1) (desktop-read))'

> ;; This one prompts

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

> ;; I answer "n", the desktop file is not loaded.

> ;; Now I do save-buffers-kill-emacs and am asked:

> Save desktop? (y or n)

> ;; I hit "n", the desktop is not saved and Emacs quits as
>    expected.

> How have you enabled desktop in your emacs session to produce
> this problem?

Sorry, I should have said this.  With a .emacs containing exactly one
line:

    (desktop-save-mode 1)

and with no existing .emacs.desktop, I started Emacs, visited two files,
did M-x desktop-save, and exited Emacs.

Then I started, successively, two Emacs sessions like this:

    /path/to/emacs --no-site-file

, where the emacs was a CVS version from last night.  I tried this (i) on
two Linux tty's; (ii) From an X-Windows (GNOME) terminal, 

> Lawrence Mitchell <[email-masked]>

-- 
Alan Mackenzie (Nuremberg, Germany).