unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* desktop.el not playing nice
@ 2005-04-17 14:46 Stephan Stahl
  2005-04-17 15:07 ` David Kastrup
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Stephan Stahl @ 2005-04-17 14:46 UTC (permalink / raw)


Hi.

I found that info/emacs-5 is not totaly clear about desktop.el

Currently is says:

----------
   You can save the desktop manually with the command `M-x
desktop-save'.  You can also enable automatic desktop saving when you
exit Emacs: use the Customization buffer (*note Easy Customization::)
to set `desktop-save-mode' to `t' for future sessions, or add this line
in your `~/.emacs' file:

     (desktop-save-mode 1)

   When Emacs starts, it looks for a saved desktop in the current
directory.  Thus, you can have separate saved desktops in different
directories, and the starting directory determines which one Emacs
reloads.  You can save the current desktop and reload one saved in
another directory by typing `M-x desktop-change-dir'.  Typing `M-x
desktop-revert' reverts to the desktop previously reloaded.

   Specify the option `--no-desktop' on the command line when you don't
want it to reload any saved desktop.
----------

Emacs only loads the saved desktop on startup when

(desktop-save-mode 1)

is in .emacs.  Or desktop.el is loaded somehow before after-init-hook
is run.

When that is the case and i start emacs with --no-desktop it seems
clear to me that i do not want to USE or ALTER the saved desktop.
However when i try to exit emacs i get asked where the desktop file
should be saved.  I can not exit emacs without this step unless i
disable desktop-save-mode.  This seems wrong to me because i said
--no-desktop and saving could overwrite my old desktop file.  I work
around this by starting

emacs --no-desktop --eval "(customize-set-variable 'desktop-enable nil)"

but this seems like a pitfall for emacs starters.  Maybe --no-desktop
should disable desktop-save-mode?

What do others think?
-- 
Stephan Stahl

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

* Re: desktop.el not playing nice
  2005-04-17 14:46 desktop.el not playing nice Stephan Stahl
@ 2005-04-17 15:07 ` David Kastrup
  2005-04-17 16:24 ` Robert J. Chassell
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: David Kastrup @ 2005-04-17 15:07 UTC (permalink / raw)
  Cc: emacs-devel

"Stephan Stahl" <stahl@eos.franken.de> writes:

> --no-desktop and saving could overwrite my old desktop file.  I work
> around this by starting
>
> emacs --no-desktop --eval "(customize-set-variable 'desktop-enable
> nil)"
>
> but this seems like a pitfall for emacs starters.  Maybe
> --no-desktop should disable desktop-save-mode?
>
> What do others think?

Sounds like a no-brainer.  Seconded.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: desktop.el not playing nice
  2005-04-17 14:46 desktop.el not playing nice Stephan Stahl
  2005-04-17 15:07 ` David Kastrup
@ 2005-04-17 16:24 ` Robert J. Chassell
  2005-04-18 13:56   ` Richard Stallman
  2005-04-17 21:06 ` Lars Hansen
  2005-04-18 18:36 ` Lars Hansen
  3 siblings, 1 reply; 13+ messages in thread
From: Robert J. Chassell @ 2005-04-17 16:24 UTC (permalink / raw)


Stephan Stahl asks

   Maybe --no-desktop should disable desktop-save-mode?

Yes.  I have run into the same problem:  when I start an instance of
Emacs with --no-desktop, I want neither to use nor to alter my saved
desktop.  I want that instance of Emacs to ignore my ~/.emacs.desktop
file entirely.

But when I start a regular instance of Emacs, I do want to be able to
load my saved desktop.

-- 
    Robert J. Chassell                         
    bob@rattlesnake.com                         GnuPG Key ID: 004B4AC8
    http://www.rattlesnake.com                  http://www.teak.cc

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

* Re: desktop.el not playing nice
  2005-04-17 14:46 desktop.el not playing nice Stephan Stahl
  2005-04-17 15:07 ` David Kastrup
  2005-04-17 16:24 ` Robert J. Chassell
@ 2005-04-17 21:06 ` Lars Hansen
  2005-04-17 21:22   ` David Kastrup
  2005-04-18 21:06   ` Richard Stallman
  2005-04-18 18:36 ` Lars Hansen
  3 siblings, 2 replies; 13+ messages in thread
From: Lars Hansen @ 2005-04-17 21:06 UTC (permalink / raw)
  Cc: emacs-devel

Stephan Stahl wrote:

>   Specify the option `--no-desktop' on the command line when you don't
>want it to reload any saved desktop.
>  
>
IMHO this describes clearly what the --no-desktop flag does. But you may 
be right the the flag should do something different.

I can make --no-desktop disabel desktop-save-mode as you propose.
If some people don't like the flag to change desktop-save-mode, I could 
add a second flag --no-desktop-load that only inhibits desktop loading.

What do people like best:
1. Just change --no-desktop to disabel desktop-save-mode.
2. Change --no-desktop to disabel desktop-save-mode and introduce a 
second flag --no-desktop-load.
3. Something else.

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

* Re: desktop.el not playing nice
  2005-04-17 21:06 ` Lars Hansen
@ 2005-04-17 21:22   ` David Kastrup
  2005-04-17 21:36     ` Lennart Borgman
  2005-04-18 18:42     ` Lars Hansen
  2005-04-18 21:06   ` Richard Stallman
  1 sibling, 2 replies; 13+ messages in thread
From: David Kastrup @ 2005-04-17 21:22 UTC (permalink / raw)
  Cc: Stephan Stahl, emacs-devel

Lars Hansen <larsh@math.ku.dk> writes:

> Stephan Stahl wrote:
>
>>   Specify the option `--no-desktop' on the command line when you don't
>>want it to reload any saved desktop.
>>  
>>
> IMHO this describes clearly what the --no-desktop flag does. But you
> may be right the the flag should do something different.
>
> I can make --no-desktop disabel desktop-save-mode as you propose.
> If some people don't like the flag to change desktop-save-mode, I
> could add a second flag --no-desktop-load that only inhibits desktop
> loading.
>
> What do people like best:
> 1. Just change --no-desktop to disabel desktop-save-mode.

That.  Other effects are too confusing to warrant a separate option:
you can achieve them by setting variables manually.

However, when calling desktop-read explicitly in a --no-desktop
session, desktop-save-mode should probably be reset to the customized
default.  At least I think that is more or less what people would
expect.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: desktop.el not playing nice
  2005-04-17 21:22   ` David Kastrup
@ 2005-04-17 21:36     ` Lennart Borgman
  2005-04-18 18:42     ` Lars Hansen
  1 sibling, 0 replies; 13+ messages in thread
From: Lennart Borgman @ 2005-04-17 21:36 UTC (permalink / raw)
  Cc: emacs-devel

----- Original Message ----- 
From: "David Kastrup" <dak@gnu.org>

> > What do people like best:
> > 1. Just change --no-desktop to disabel desktop-save-mode.
> 
> That.  Other effects are too confusing to warrant a separate option:
> you can achieve them by setting variables manually.
> 
> However, when calling desktop-read explicitly in a --no-desktop
> session, desktop-save-mode should probably be reset to the customized
> default.  At least I think that is more or less what people would
> expect.

I would expect a question about resetting.

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

* Re: desktop.el not playing nice
  2005-04-17 16:24 ` Robert J. Chassell
@ 2005-04-18 13:56   ` Richard Stallman
  2005-04-18 18:16     ` Stephan Stahl
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2005-04-18 13:56 UTC (permalink / raw)
  Cc: emacs-devel

Does this patch give results you like?

*** desktop.el	05 Apr 2005 15:08:34 -0400	1.82
--- desktop.el	18 Apr 2005 01:22:51 -0400	
***************
*** 1031,1037 ****
    '(lambda ()
      (let ((key "--no-desktop"))
        (if (member key command-line-args)
!         (delete key command-line-args)
          (when desktop-save-mode (desktop-read))))))
  
  (provide 'desktop)
--- 1031,1039 ----
    '(lambda ()
      (let ((key "--no-desktop"))
        (if (member key command-line-args)
! 	  (progn
! 	    (delete key command-line-args)
! 	    (desktop-save-mode 0))
          (when desktop-save-mode (desktop-read))))))
  
  (provide 'desktop)

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

* Re: desktop.el not playing nice
  2005-04-18 13:56   ` Richard Stallman
@ 2005-04-18 18:16     ` Stephan Stahl
  2005-04-18 18:54       ` Lars Hansen
  0 siblings, 1 reply; 13+ messages in thread
From: Stephan Stahl @ 2005-04-18 18:16 UTC (permalink / raw)
  Cc: bob, emacs-devel

Richard Stallman said:

> Does this patch give results you like?
>
> *** desktop.el	05 Apr 2005 15:08:34 -0400	1.82
> --- desktop.el	18 Apr 2005 01:22:51 -0400
> ***************
> *** 1031,1037 ****
>     '(lambda ()
>       (let ((key "--no-desktop"))
>         (if (member key command-line-args)
> !         (delete key command-line-args)
>           (when desktop-save-mode (desktop-read))))))
>
>   (provide 'desktop)
> --- 1031,1039 ----
>     '(lambda ()
>       (let ((key "--no-desktop"))
>         (if (member key command-line-args)
> ! 	  (progn
> ! 	    (delete key command-line-args)
> ! 	    (desktop-save-mode 0))
>           (when desktop-save-mode (desktop-read))))))
>
>   (provide 'desktop)

Yes it does.

However as others have pointed out, (desktop-read) at a later time
should reenable desktop-save-mode which it does not right now.

This patch would do it.  If it's clean enough someone should commit
it too.

*** desktop.el	Mon Apr 18 20:04:26 2005	1.82
--- desktop.el	Mon Apr 18 20:13:15 2005
***************
*** 763,769 ****
                       (format ", %d to restore lazily"
                               (length desktop-buffer-args-list))
                     ""))
!         t)
        ;; No desktop file found.
        (desktop-clear)
        (let ((default-directory desktop-dirname))
--- 763,769 ----
                       (format ", %d to restore lazily"
                               (length desktop-buffer-args-list))
                     ""))
!         (desktop-save-mode 1))
        ;; No desktop file found.
        (desktop-clear)
        (let ((default-directory desktop-dirname))
-- 
Stephan Stahl

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

* Re: desktop.el not playing nice
  2005-04-17 14:46 desktop.el not playing nice Stephan Stahl
                   ` (2 preceding siblings ...)
  2005-04-17 21:06 ` Lars Hansen
@ 2005-04-18 18:36 ` Lars Hansen
  3 siblings, 0 replies; 13+ messages in thread
From: Lars Hansen @ 2005-04-18 18:36 UTC (permalink / raw)


Stephan Stahl wrote:

>Maybe --no-desktop should disable desktop-save-mode?
>  
>
I just installed a change to make --no-desktop switch off desktop-save mode.

BTW, I now see that RMS have proposed essentially the same patch.

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

* Re: desktop.el not playing nice
  2005-04-17 21:22   ` David Kastrup
  2005-04-17 21:36     ` Lennart Borgman
@ 2005-04-18 18:42     ` Lars Hansen
  1 sibling, 0 replies; 13+ messages in thread
From: Lars Hansen @ 2005-04-18 18:42 UTC (permalink / raw)
  Cc: Stephan Stahl, emacs-devel

David Kastrup wrote:

>However, when calling desktop-read explicitly in a --no-desktop
>session, desktop-save-mode should probably be reset to the customized
>default.  At least I think that is more or less what people would
>expect.
>  
>
I think it would be confusing if desktop-read behaved differently in a 
session started with --no-desktop that in other sessions. If one wants 
desktop saving turned on again, one should use the command 
desktop-save-mode.

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

* Re: desktop.el not playing nice
  2005-04-18 18:16     ` Stephan Stahl
@ 2005-04-18 18:54       ` Lars Hansen
  0 siblings, 0 replies; 13+ messages in thread
From: Lars Hansen @ 2005-04-18 18:54 UTC (permalink / raw)
  Cc: bob, rms, emacs-devel

Stephan Stahl wrote:
> However as others have pointed out, (desktop-read) at a later time
> should reenable desktop-save-mode which it does not right now.

I disagree. The command desktop-read is supposed to reload a saved 
desktop and nothing else, it should never change desktop-save-mode. We 
have the command desktop-save-mode to do that. I believe it would be 
confusing if desktop-read behaved differently when emacs is started with 
--no-desktop.

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

* Re: desktop.el not playing nice
  2005-04-17 21:06 ` Lars Hansen
  2005-04-17 21:22   ` David Kastrup
@ 2005-04-18 21:06   ` Richard Stallman
  2005-04-18 21:23     ` Stephan Stahl
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2005-04-18 21:06 UTC (permalink / raw)
  Cc: stahl, emacs-devel

    1. Just change --no-desktop to disabel desktop-save-mode.

I think that is the right change.  How about this?

*** desktop.el	05 Apr 2005 15:08:34 -0400	1.82
--- desktop.el	18 Apr 2005 01:22:51 -0400	
***************
*** 1031,1037 ****
    '(lambda ()
      (let ((key "--no-desktop"))
        (if (member key command-line-args)
!         (delete key command-line-args)
          (when desktop-save-mode (desktop-read))))))
  
  (provide 'desktop)
--- 1031,1039 ----
    '(lambda ()
      (let ((key "--no-desktop"))
        (if (member key command-line-args)
! 	  (progn
! 	    (delete key command-line-args)
! 	    (desktop-save-mode 0))
          (when desktop-save-mode (desktop-read))))))
  
  (provide 'desktop)

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

* Re: desktop.el not playing nice
  2005-04-18 21:06   ` Richard Stallman
@ 2005-04-18 21:23     ` Stephan Stahl
  0 siblings, 0 replies; 13+ messages in thread
From: Stephan Stahl @ 2005-04-18 21:23 UTC (permalink / raw)
  Cc: Lars Hansen, emacs-devel, stahl

Hi Richard.

Richard Stallman said:

>     1. Just change --no-desktop to disabel desktop-save-mode.
>
> I think that is the right change.  How about this?

Lars Hansen commited a patch that does just this sligthly
diffrent..
-- 
Stephan Stahl

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

end of thread, other threads:[~2005-04-18 21:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-17 14:46 desktop.el not playing nice Stephan Stahl
2005-04-17 15:07 ` David Kastrup
2005-04-17 16:24 ` Robert J. Chassell
2005-04-18 13:56   ` Richard Stallman
2005-04-18 18:16     ` Stephan Stahl
2005-04-18 18:54       ` Lars Hansen
2005-04-17 21:06 ` Lars Hansen
2005-04-17 21:22   ` David Kastrup
2005-04-17 21:36     ` Lennart Borgman
2005-04-18 18:42     ` Lars Hansen
2005-04-18 21:06   ` Richard Stallman
2005-04-18 21:23     ` Stephan Stahl
2005-04-18 18:36 ` Lars Hansen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).