Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[VM] vm-mark-folder-modified-p

7 views
Skip to first unread message

Julian Bradfield

unread,
Nov 11, 2012, 5:19:52 AM11/11/12
to viewma...@nongnu.org
Returning to the problem noted a while ago of VM marking a read-only
folder modified when it upgrades attribute data:
Is there *any* case in which vm-mark-folder-modified-p should work on
a read-only folder?

Uday Reddy

unread,
Nov 12, 2012, 3:26:57 AM11/12/12
to Julian Bradfield, viewma...@nongnu.org
Rethinking this issue, I think there has been a general misunderstanding of
what it means for a folder to be visited read-only. As the doc string of
`vm-visit-folder' says, visiting a folder read-only just means that "no
attribute changes, messages additions or deletions will be allowed in the
visited folder." It does NOT mean that the folder buffer will not be
modified or that the folder on disk will be preserved.

(There might also have been a traditional view that vm is just an Emacs mode
for viewing a mail folder on disk. That view is not valid any more. There
could be changes made to the cached data headers, messages might move in and
out of the IMAP cache folders etc. VM is evolving into a mail-reading
front-end that can transparently handle a variety of message stores at the
back end. A mail folder on disk is just one possible back end.)

If people want read-only folders to be preserved on disk, the best way to
achieve it is via `vm-quit'. As I have mentioned earlier
`vm-quit-no-change' can be used to quit folders without saving to disk. If
that is too much trouble to use, I can modify the standard `vm-quit' to
refrain from saving read-only folders. That might in fact be the best
solution for the kind of things you want to do.

Cheers,
Uday




Julian Bradfield

unread,
Nov 12, 2012, 4:33:24 AM11/12/12
to viewma...@nongnu.org
Uday writes:
>Rethinking this issue, I think there has been a general misunderstanding of
>what it means for a folder to be visited read-only. As the doc string of
>`vm-visit-folder' says, visiting a folder read-only just means that "no
>attribute changes, messages additions or deletions will be allowed in the
>visited folder." It does NOT mean that the folder buffer will not be
>modified or that the folder on disk will be preserved.

I see the point: from vm's point of view, it may treat the data as
read-only, but change the meta-data, just as visiting a file read-only
may update its last access time.
However, I would expect most people to associate vm visiting a folder
read-only with emacs visiting a file read-only with opening a file
read-only.
Perhaps there should be a variable: vm-read-only-includes-metadata or
something!

Uday Reddy

unread,
Nov 12, 2012, 4:46:58 AM11/12/12
to Julian Bradfield, viewma...@nongnu.org
Julian Bradfield writes:

> I see the point: from vm's point of view, it may treat the data as
> read-only, but change the meta-data, just as visiting a file read-only
> may update its last access time.
> However, I would expect most people to associate vm visiting a folder
> read-only with emacs visiting a file read-only with opening a file
> read-only.
> Perhaps there should be a variable: vm-read-only-includes-metadata or
> something!

I have now modified `vm-quit' in the trunk to silently discard any changes
to the folder ("meta-data") if the folder is read-only.

There are a couple of things about this that worry me.

1. If you do vm-toggle-read-only for some reason or other, you might put the
folder in read-only mode. If you forget that you have done so and quit the
folder, the changes that were made before putting it in read-only mode would
be lost. So, vm-toggle-read-only has now become a mildly unsafe operation.

2. I think I have seen `vm-save-message' write the message to a visited
folder inside VM instead of the folder on disk. (I think I have enjoyed
this 'feature' on occasion when I was on a slow network.) I don't know what
happens if that folder has been visited read-only. Can somebody please
check this situation?

Cheers,
Uday






Julian Bradfield

unread,
Nov 12, 2012, 7:47:50 AM11/12/12
to viewma...@nongnu.org
On 2012-11-12, Uday Reddy <usr.vm...@gmail.com> wrote:
> I have now modified `vm-quit' in the trunk to silently discard any changes
> to the folder ("meta-data") if the folder is read-only.
>
> There are a couple of things about this that worry me.
>
> 1. If you do vm-toggle-read-only for some reason or other, you might put the
> folder in read-only mode. If you forget that you have done so and quit the
> folder, the changes that were made before putting it in read-only mode would
> be lost. So, vm-toggle-read-only has now become a mildly unsafe operation.

This worries me too. I don't think one should confuse modification and
read-only. VM is an Emacs package, and people know how read-only and
modification interact in Emacs - it should be the same in VM.
I think I'll stick with my approach.


Patrick P Murphy

unread,
Nov 13, 2012, 9:04:42 AM11/13/12
to viewma...@nongnu.org
On Mon, 12 Nov 2012 09:46:58 +0000, Uday Reddy <usr.vm...@gmail.com> said:

> I have now modified `vm-quit' in the trunk to silently discard any
> changes to the folder ("meta-data") if the folder is read-only.

> There are a couple of things about this that worry me.

> 1. If you do vm-toggle-read-only for some reason or other, you might
> put the folder in read-only mode. If you forget that you have done so
> and quit the folder, the changes that were made before putting it in
> read-only mode would be lost. So, vm-toggle-read-only has now become
> a mildly unsafe operation.

Would a warning (inside vm-toggle-read-only) to the user be prudent
under this situation? Something along the lines of "WARNING: you have
unsaved changes; marking this folder read-only may lose them" or similar
would certainly be enough to remind me that I'm, well, doing something
stupid :-)

Just a thought.

- Pat

--
Patrick P. Murphy, Ph.D. Webmaster (East), Computing Security Manager
http://www.nrao.edu/~pmurphy/ http://chien-noir.com/maze.shtml

Kurt Hackenberg

unread,
Nov 13, 2012, 7:01:43 PM11/13/12
to

Uday Reddy <usr.vm...@gmail.com> wrote:

>Rethinking this issue, I think there has been a general misunderstanding of
>what it means for a folder to be visited read-only. As the doc string of
>`vm-visit-folder' says, visiting a folder read-only just means that "no
>attribute changes, messages additions or deletions will be allowed in the
>visited folder." It does NOT mean that the folder buffer will not be
>modified or that the folder on disk will be preserved.

Huh. I kind of think it should mean that nothing changes -- no
attribute changes, nothing. No changes in the displayed attributes,
either.

>(There might also have been a traditional view that vm is just an Emacs mode
>for viewing a mail folder on disk. That view is not valid any more. There
>could be changes made to the cached data headers, messages might move in and
>out of the IMAP cache folders etc. VM is evolving into a mail-reading
>front-end that can transparently handle a variety of message stores at the
>back end. A mail folder on disk is just one possible back end.)

Read-only and cache are two separate things. The cache could change
as the master copy on the IMAP server changes, and VM could display
those changes, without VM changing anything at the server itself.

Uday Reddy

unread,
Nov 19, 2012, 4:03:55 AM11/19/12
to Patrick P Murphy, viewma...@nongnu.org
Patrick P Murphy writes:

> Would a warning (inside vm-toggle-read-only) to the user be prudent
> under this situation? Something along the lines of "WARNING: you have
> unsaved changes; marking this folder read-only may lose them" or similar
> would certainly be enough to remind me that I'm, well, doing something
> stupid :-)

Good idea. I have now added a warning, as well as a doc string for
`vm-toggle-read-only' that explains the issue.

"If the current VM folder is read-only, make it modifiable.

This command can also be used to make a modifiable folder read-only.
However it is unsafe to do so because any previous modifications will
be discarded when the folder is quit. You should first save the
current changes of the folder before making it read-only."

Cheers,
Uday

0 new messages