all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#17873: 24.4.50; `desktop-save'
@ 2014-06-29 16:47 Drew Adams
  2014-06-29 23:59 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2014-06-29 16:47 UTC (permalink / raw)
  To: 17873

1. The doc string says:

 If AUTO-SAVE is non-nil, compare the saved contents to the one last saved,
 and don't save the buffer if they are the same.

Saved contents of what?  One what last saved?  Saved contents cannot be
compared to "the one" anything.

I think you mean "compare the current desktop information to that in the
desktop file."  If you are avoiding saving (because the contents are the
same) then you cannot speak of comparing the "saved contents" - the
contents have not yet been saved.

And what buffer?  This is about saving a desktop in a desktop-file.
There is no notion of a buffer here - at the user level.  The code puts
the desktop info into a buffer (which then might get saved), but that is
implementation-level.

What `desktop-save' does needs to be described at a user level (what,
not how, unless that is important to users).  Just say that if the
desktop information has not changed since it was last saved then the
file is not rewritten.

2. I also have a question about the behavior: Why is writing the
file even when the content is unchanged the default behavior?  Why the
need to specify AUTO-SAVE instead of an optional SAVE-EVEN-IF-NO-CHANGE?
Is this just for backward compatibility?  (Before AUTO-SAVE was
introduced the behavior was to update the file even if the desktop
info was not changed.)

In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-06-17 on ODIEONE
Bzr revision: 117359 monnier@iro.umontreal.ca-20140617193358-2t1nl1te9gc2mqrx
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/snapshot/trunk
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
 LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''





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

* bug#17873: 24.4.50; `desktop-save'
  2014-06-29 16:47 bug#17873: 24.4.50; `desktop-save' Drew Adams
@ 2014-06-29 23:59 ` Juri Linkov
  2014-06-30  2:10   ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2014-06-29 23:59 UTC (permalink / raw)
  To: Drew Adams; +Cc: 17873

> 1. The doc string says:
>
>  If AUTO-SAVE is non-nil, compare the saved contents to the one last saved,
>  and don't save the buffer if they are the same.
>
> Saved contents of what?  One what last saved?  Saved contents cannot be
> compared to "the one" anything.
>
> I think you mean "compare the current desktop information to that in the
> desktop file."  If you are avoiding saving (because the contents are the
> same) then you cannot speak of comparing the "saved contents" - the
> contents have not yet been saved.
>
> And what buffer?  This is about saving a desktop in a desktop-file.
> There is no notion of a buffer here - at the user level.  The code puts
> the desktop info into a buffer (which then might get saved), but that is
> implementation-level.
>
> What `desktop-save' does needs to be described at a user level (what,
> not how, unless that is important to users).  Just say that if the
> desktop information has not changed since it was last saved then the
> file is not rewritten.

Is this how you propose to fix the docstring?

=== modified file 'lisp/desktop.el'
--- lisp/desktop.el	2014-06-24 23:23:41 +0000
+++ lisp/desktop.el	2014-06-29 23:58:41 +0000
@@ -946,8 +946,9 @@ (defun desktop-save (dirname &optional r
   "Save the desktop in a desktop file.
 Parameter DIRNAME specifies where to save the desktop file.
 Optional parameter RELEASE says whether we're done with this desktop.
-If AUTO-SAVE is non-nil, compare the saved contents to the one last saved,
-and don't save the buffer if they are the same."
+If AUTO-SAVE is non-nil, compare the current desktop information
+to that in the desktop file, and if the desktop information has not
+changed since it was last saved then the file is not rewritten."
   (interactive (list
                 ;; Or should we just use (car desktop-path)?
                 (let ((default (if (member "." desktop-path)

> 2. I also have a question about the behavior: Why is writing the
> file even when the content is unchanged the default behavior?  Why the
> need to specify AUTO-SAVE instead of an optional SAVE-EVEN-IF-NO-CHANGE?
> Is this just for backward compatibility?  (Before AUTO-SAVE was
> introduced the behavior was to update the file even if the desktop
> info was not changed.)

When the user executes `M-x desktop-save RET' explicitly, the desktop
has to be saved unconditionally as expected by users, e.g. it will
update the file timestamp, and do other usual things.

The only missing thing that `desktop-save' doesn't do yet is creating
a backup copy, but this is currently under discussion in bug#17351.





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

* bug#17873: 24.4.50; `desktop-save'
  2014-06-29 23:59 ` Juri Linkov
@ 2014-06-30  2:10   ` Drew Adams
  2014-07-02 23:47     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2014-06-30  2:10 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 17873

> > Just say that if the desktop information has not changed since it
> > was last saved then the file is not rewritten.
> 
> Is this how you propose to fix the docstring?
...
> +If AUTO-SAVE is non-nil, compare the current desktop information
> +to that in the desktop file, and if the desktop information has not
> +changed since it was last saved then the file is not rewritten."

Yes (assuming that is the behavior).  But it is slightly better to
stick with the active voice for both parts of the last sentence:

  ...compare... and if the desktop information has not changed since
     ^^^^^^^
  it was last saved then do not rewrite the file.
                         ^^^^^^^^^^^^^^

> > 2. I also have a question about the behavior: Why is writing the
> > file even when the content is unchanged the default behavior?  Why the
> > need to specify AUTO-SAVE instead of an optional SAVE-EVEN-IF-NO-CHANGE?
> > Is this just for backward compatibility?  (Before AUTO-SAVE was
> > introduced the behavior was to update the file even if the desktop
> > info was not changed.)
> 
> When the user executes `M-x desktop-save RET' explicitly, the desktop
> has to be saved unconditionally as expected by users, e.g. it will
> update the file timestamp, and do other usual things.

I see.  That makes sense, I guess.

But depending on what the "other usual things" are, I can see that
it might be good for this to be optional (e.g. dependent on a user
option).

IOW, does a user who asks to save a desktop (perhaps just to make
sure) necessarily care about the timestamp and those other usual
things?  I can see that a user might, but I can guess too that s?he
might not.  Perhaps the option for the case where the content has
not changed could have values `always', `never', and `ask-me'.
Just a thought.  I suppose the desktop file size might play a role
in a user's preference.

> The only missing thing that `desktop-save' doesn't do yet is creating
> a backup copy, but this is currently under discussion in bug#17351.

FWIW, I am not following that thread.  I trust that those
participating in it will DTRT.  But I certainly am in favor of a
user being able to opt for automatic backups of desktop files (or
to opt out).

Probably my only concern in this regard is this: If such a feature
is implemented then I hope that the backup copy for a given desktop
file is related somehow to the name of the file being backed up.
(This is the case for Emacs backup files in general, so I expect
there won't be a problem in this regard.)

I mention this because desktop.el still suffers from an ungainly
design wrt desktop files: it more or less assumes there is at most
one per directory.  Functions such as `desktop-save' and
`desktop-read' do not let you pass a file name (e.g. absolute)
for the file to be saved/read - they rely on the directory name.
To me, that's silly - an unnecessary design limitation (which I
have pointed out before, FWIW).

I use desktops in the form of desktop bookmarks, for instance,
and it is quite common for multiple such bookmarks to reference
desktop files located in the same directory.

It's OK.  I jump through a few minor hoops to get around the
single-file-per-directory design/expectation.  (I define save
and read functions that accept a file name, for instance.)
But I would not want desktops to become further cobbled by a
similar assumption wrt backup files.





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

* bug#17873: 24.4.50; `desktop-save'
  2014-06-30  2:10   ` Drew Adams
@ 2014-07-02 23:47     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2014-07-02 23:47 UTC (permalink / raw)
  To: Drew Adams; +Cc: 17873-done

Version: 24.4

> Yes (assuming that is the behavior).  But it is slightly better to
> stick with the active voice for both parts of the last sentence:
>
>   ...compare... and if the desktop information has not changed since
>      ^^^^^^^
>   it was last saved then do not rewrite the file.
>                          ^^^^^^^^^^^^^^

Thanks, fixed.





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

end of thread, other threads:[~2014-07-02 23:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-29 16:47 bug#17873: 24.4.50; `desktop-save' Drew Adams
2014-06-29 23:59 ` Juri Linkov
2014-06-30  2:10   ` Drew Adams
2014-07-02 23:47     ` Juri Linkov

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.