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

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Wed, 22 Oct 2008 10:05:05 UTC

Severity: minor

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1226 in the body.
You can then email your comments to 1226 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Desktop holds second Emacs session hostage;
	C-x C-c doesn't work properly.
Date: Wed, 22 Oct 2008 10:07:13 +0000
(i) With desktop enabled, start emacs.

(ii) Start a second emacs session.

Emacs2 detects Emacs1 and the danger of contention over .emacs.desktop.
It prompts thusly:

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

(iii) Type n.

(iv) Attempt C-c C-x.

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.

Even worse, accepting the prompt's default directory, ~/, might
overwrite the real .emacs.desktop.

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Message #8 received at 1226 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Lawrence Mitchell <wence <at> gmx.li>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
Date: Wed, 22 Oct 2008 12:12:28 +0100
Alan Mackenzie wrote:
> (i) With desktop enabled, start emacs.

> (ii) Start a second emacs session.

> Emacs2 detects Emacs1 and the danger of contention over .emacs.desktop.
> It prompts thusly:

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

> (iii) Type n.

> (iv) Attempt C-c C-x.

> 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?

-- 
Lawrence Mitchell <wence <at> gmx.li>




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #13 received at 1226 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Lawrence Mitchell <wence <at> gmx.li>
Cc: 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage;
	C-x C-c doesn't work properly.
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 <wence <at> gmx.li>

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Message #16 received at 1226 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
Date: Wed, 22 Oct 2008 21:12:29 -0400
Alan Mackenzie wrote:

> 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.

Another choice is of course just to turn off desktop-save-mode, then exit.

> This is a bug.

What should it do instead?

i) Not turn on desktop-save-mode if you answer no to the initial
question:

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

ii) Or should this question offer a third alternative, eg "(q) -
disable desktop-save-mode for this session"?

iii) Or should the prompt

    Directory for desktop file: ~/"

somehow offer an option to turn off desktop-save-mode?

iv) Something else?

> Even worse, accepting the prompt's default directory, ~/, might
> overwrite the real .emacs.desktop.

If you try it, you will find you get adequate warning about overwriting
the existing desktop.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Message #19 received at 1226 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>, 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
Date: Wed, 22 Oct 2008 21:15:48 -0400
Glenn Morris wrote (on Wed, 22 Oct 2008 at 21:12 -0400):

> If you try it, you will find you get adequate warning about overwriting
> the existing desktop.

And if you answer "no" to the prompt about overwriting, Emacs exits
without saving the desktop (admittedly, perhaps a slightly obscure way
to get this functionality). So I don't see that you are being held
hostage here.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #24 received at 1226 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage;
	C-x C-c doesn't work properly.
Date: Thu, 23 Oct 2008 09:38:32 +0000
Hi, Glenn!

On Wed, Oct 22, 2008 at 09:12:29PM -0400, Glenn Morris wrote:
> Alan Mackenzie wrote:

> > 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.

> Another choice is of course just to turn off desktop-save-mode, then
> exit.

I suppose so.  You have to have a cool head to think of this, though.

> > This is a bug.

> What should it do instead?

> i) Not turn on desktop-save-mode if you answer no to the initial
> question:

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

> ii) Or should this question offer a third alternative, eg "(q) -
> disable desktop-save-mode for this session"?

> iii) Or should the prompt

>     Directory for desktop file: ~/"

> somehow offer an option to turn off desktop-save-mode?

> iv) Something else?

I think Lawrence Mitchell's suggestion of what should happen is right:
first prompt "save desktop (y/n): ", and after getting a y, prompt for a
directory to save in.

> > Even worse, accepting the prompt's default directory, ~/, might
> > overwrite the real .emacs.desktop.

> If you try it, you will find you get adequate warning about overwriting
> the existing desktop.

OK.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1226; Package emacs. Full text and rfc822 format available.

Message #27 received at 1226 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
Date: Thu, 23 Oct 2008 15:25:14 -0400
Alan Mackenzie wrote:

> I think Lawrence Mitchell's suggestion of what should happen is right:
> first prompt "save desktop (y/n): ", and after getting a y, prompt for a
> directory to save in.

It sounds like you want the variable desktop-save to have another option:

ask-if-old    -- ask if desktop file exists, otherwise just save.

Or perhaps one of the existing ask, ask-if-exists options?




Severity set to `minor' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Thu, 26 Feb 2009 04:05:06 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1226; Package emacs. (Wed, 06 Jul 2011 02:10:02 GMT) Full text and rfc822 format available.

Message #32 received at 1226 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Glenn Morris <rgm <at> gnu.org>, 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c
	doesn't work properly.
Date: Wed, 6 Jul 2011 04:08:29 +0200
On Thu, Oct 23, 2008 at 11:38, Alan Mackenzie <acm <at> muc.de> wrote:

> I think Lawrence Mitchell's suggestion of what should happen is right:
> first prompt "save desktop (y/n): ", and after getting a y, prompt for a
> directory to save in.

This is the behavior after revno:100049, I think. Could you please
check whether it does work as expected?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#1226; Package emacs. (Fri, 08 Jul 2011 20:51:02 GMT) Full text and rfc822 format available.

Message #35 received at 1226 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 1226 <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c
	doesn't work properly.
Date: Fri, 8 Jul 2011 20:48:00 +0000
Hi, Juanma,

On Wed, Jul 06, 2011 at 04:08:29AM +0200, Juanma Barranquero wrote:
> On Thu, Oct 23, 2008 at 11:38, Alan Mackenzie <acm <at> muc.de> wrote:

> > I think Lawrence Mitchell's suggestion of what should happen is right:
> > first prompt "save desktop (y/n): ", and after getting a y, prompt for a
> > directory to save in.

> This is the behavior after revno:100049, I think. Could you please
> check whether it does work as expected?

That's perfect!  Thanks.

>     Juanma

-- 
Alan Mackenzie (Nuremberg, Germany).




Reply sent to Juanma Barranquero <lekktu <at> gmail.com>:
You have taken responsibility. (Fri, 08 Jul 2011 23:19:02 GMT) Full text and rfc822 format available.

Notification sent to Alan Mackenzie <acm <at> muc.de>:
bug acknowledged by developer. (Fri, 08 Jul 2011 23:19:02 GMT) Full text and rfc822 format available.

Message #40 received at 1226-done <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Glenn Morris <rgm <at> gnu.org>, 1226-done <at> debbugs.gnu.org
Subject: Re: bug#1226: Desktop holds second Emacs session hostage; C-x C-c
	doesn't work properly.
Date: Sat, 9 Jul 2011 01:18:03 +0200
On Fri, Jul 8, 2011 at 22:48, Alan Mackenzie <acm <at> muc.de> wrote:

> That's perfect!  Thanks.

I'm closing this one, then.

Thanks,

    Juanma




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 06 Aug 2011 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 327 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.