all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Question about handling file deletion
Date: Thu, 27 Jun 2013 00:36:57 +0200	[thread overview]
Message-ID: <87mwqc5wja.fsf@rosalinde.fritz.box> (raw)
In-Reply-To: <jwvip116j3q.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 26 Jun 2013 10:33:19 -0400")

On Wed, 26 Jun 2013 10:33:19 -0400 Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>> in the new version of todo-mode.el (see bug#14688).  If someone deletes
>> a todo file using e.g. Dired and then gets an error in Todo mode and
>> reports it as a bug, is it kosher for me reply "If it hurts, don't do
>> that.  Use todo-delete-file." and close the bug?  (That command doesn't
>
> There's no rule, but usually it's OK for Emacs to misbehave slightly in
> such circumstances, tho it's also usually he case that Emacs tries to
> handle such cases gracefully.
>
> IOW it depends: should it be obvious to the user that just "rm"ing the
> file will lead to an error?
> E.g. can she still see a reference to the file somewhere else)?  If the
> remaining ("dangling") reference to the lost file is not shown to the
> user, than Emacs should work harder to try and handle the
> disappearance seamlessly.

I'm not sure I understand what you mean by "reference to the lost file".
The Todo mode state includes a list of all todo files, which is exposed
to users for e.g. minibuffer completion.  If a file is deleted from
outside of Todo mode, this list won't be updated, so in that sense it
contains a "reference to the lost file", which the user can see.  But
while the user presumably knows the file is missing, Todo mode doesn't,
and that can lead to errors, especially if a live buffer is still
holding the content of the deleted file and the user calls a Todo
command to manipulate the buffer.  This problem can be avoided with a
todo-delete-file command which updates the file list.  But that doesn't
help if it's possible to delete a file behind Todo mode's back.  What
would help is a delete-file-hook, but that doesn't exist AFAIK.  The
only other alternative I can think of is to build the needed checks into
each Todo command that could manipulate a file or a buffer visiting a
file.

Do other packages go to such lengths?  Some don't, e.g., if you delete a
mail file without telling Gnus, Gnus will try to open it and signal an
error (and not what you might think: gnus-request-expire-articles: Wrong
type argument: stringp, nil).  I guess it's taken for granted that
you're only supposed to delete mail files by using commands provided by
the mail client.  I would like the same kind of assumption to be made
for Todo mode; but maybe that's asking too much.

Steve Berman



  reply	other threads:[~2013-06-26 22:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26 12:22 Question about handling file deletion Stephen Berman
2013-06-26 14:33 ` Stefan Monnier
2013-06-26 22:36   ` Stephen Berman [this message]
2013-06-27  1:42     ` Stefan Monnier
2013-06-28  8:36       ` Stephen Berman
2013-06-28 22:40         ` Stefan Monnier
2013-06-29 13:37 ` Timur Aydin
2013-06-29 22:44   ` Stephen Berman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwqc5wja.fsf@rosalinde.fritz.box \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.