all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
@ 2008-10-22 10:07 Alan Mackenzie
  2008-10-22 11:12 ` Lawrence Mitchell
  2008-10-23  1:12 ` Glenn Morris
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Mackenzie @ 2008-10-22 10:07 UTC (permalink / raw)
  To: bug-gnu-emacs

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







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-22 10:07 bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly Alan Mackenzie
@ 2008-10-22 11:12 ` Lawrence Mitchell
  2008-10-22 12:48   ` Alan Mackenzie
  2008-10-23  1:12 ` Glenn Morris
  1 sibling, 1 reply; 10+ messages in thread
From: Lawrence Mitchell @ 2008-10-22 11:12 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1226

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@gmx.li>






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-22 11:12 ` Lawrence Mitchell
@ 2008-10-22 12:48   ` Alan Mackenzie
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Mackenzie @ 2008-10-22 12:48 UTC (permalink / raw)
  To: Lawrence Mitchell; +Cc: 1226

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@gmx.li>

-- 
Alan Mackenzie (Nuremberg, Germany).






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-22 10:07 bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly Alan Mackenzie
  2008-10-22 11:12 ` Lawrence Mitchell
@ 2008-10-23  1:12 ` Glenn Morris
  2008-10-23  1:15   ` Glenn Morris
  2008-10-23  9:38   ` Alan Mackenzie
  1 sibling, 2 replies; 10+ messages in thread
From: Glenn Morris @ 2008-10-23  1:12 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1226

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.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-23  1:12 ` Glenn Morris
@ 2008-10-23  1:15   ` Glenn Morris
  2008-10-23  9:38   ` Alan Mackenzie
  1 sibling, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2008-10-23  1:15 UTC (permalink / raw)
  To: Alan Mackenzie, 1226


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.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-23  1:12 ` Glenn Morris
  2008-10-23  1:15   ` Glenn Morris
@ 2008-10-23  9:38   ` Alan Mackenzie
  2008-10-23 19:25     ` Glenn Morris
  2011-07-06  2:08     ` Juanma Barranquero
  1 sibling, 2 replies; 10+ messages in thread
From: Alan Mackenzie @ 2008-10-23  9:38 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 1226

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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-23  9:38   ` Alan Mackenzie
@ 2008-10-23 19:25     ` Glenn Morris
  2011-07-06  2:08     ` Juanma Barranquero
  1 sibling, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2008-10-23 19:25 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1226

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?






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2008-10-23  9:38   ` Alan Mackenzie
  2008-10-23 19:25     ` Glenn Morris
@ 2011-07-06  2:08     ` Juanma Barranquero
  2011-07-08 20:48       ` Alan Mackenzie
  1 sibling, 1 reply; 10+ messages in thread
From: Juanma Barranquero @ 2011-07-06  2:08 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1226

On Thu, Oct 23, 2008 at 11:38, Alan Mackenzie <acm@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2011-07-06  2:08     ` Juanma Barranquero
@ 2011-07-08 20:48       ` Alan Mackenzie
  2011-07-08 23:18         ` Juanma Barranquero
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Mackenzie @ 2011-07-08 20:48 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 1226

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly.
  2011-07-08 20:48       ` Alan Mackenzie
@ 2011-07-08 23:18         ` Juanma Barranquero
  0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2011-07-08 23:18 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 1226-done

On Fri, Jul 8, 2011 at 22:48, Alan Mackenzie <acm@muc.de> wrote:

> That's perfect!  Thanks.

I'm closing this one, then.

Thanks,

    Juanma





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-07-08 23:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 10:07 bug#1226: Desktop holds second Emacs session hostage; C-x C-c doesn't work properly Alan Mackenzie
2008-10-22 11:12 ` Lawrence Mitchell
2008-10-22 12:48   ` Alan Mackenzie
2008-10-23  1:12 ` Glenn Morris
2008-10-23  1:15   ` Glenn Morris
2008-10-23  9:38   ` Alan Mackenzie
2008-10-23 19:25     ` Glenn Morris
2011-07-06  2:08     ` Juanma Barranquero
2011-07-08 20:48       ` Alan Mackenzie
2011-07-08 23:18         ` Juanma Barranquero

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.