[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: delete-file default to buffer-file-name if non-nil
From: |
Drew Adams |
Subject: |
RE: delete-file default to buffer-file-name if non-nil |
Date: |
Mon, 17 May 2010 07:56:59 -0700 |
> > A better approach is to let the user decide the behavior.
> > I have this option (FWIW):
> >
> > | When the default value argument to functions such as
> > | `completing-read', `read-file-name', `read-from-minibuffer', and
> > | `read-string' is non-nil and the initial-input argument is nil or
> > | "", the default value can be added to the prompt as a hint or
> > | inserted into the minibuffer as the initial input.
>
> IIUC this is not using the initial-contents argument (more to the
> point, it's only active if this arg is nil, i.e. if the
> caller properly treats it a deprecated). So this is perfectly
> compatible with initial-contents's obsolescence.
Yes, that option is only about using the default value.
But it was the general idea that it can sometimes be useful to put a value into
the minibuffer that I was trying to get across. I believe that feature can be
useful for the user (hence the default-value option) and in some cases it can be
useful for particular commands (using INIT-VALUE).
The latter cases are admittedly exceptions - I do not propose using INIT-VALUE
often. `delete-file' is a case in point. IMO, if the default file name is put in
the minibuffer as init value it is less likely that a user will inadvertently
hit RET and end up accidentally deleting the file.
You might disagree, but I think that putting the name in the minibuffer draws
more attention to it than just putting it in the prompt - particularly if
INIT-VALUE is seldom used. It is a good compromise between doing nothing
(default in prompt only) and requiring confirmation each time. It gives a little
more protection against accident than just mentioning the file in the prompt,
but it adds no confirmation delay/annoyance.
AFAIK, `delete-file' is not bound to any key by default. Anyone calling it
interactively is doing so either via M-x, via a user-defined key, or via some
other command that calls it interactively. I expect that requiring confirmation
would defeat the aim of quick interaction.
Remember too: `delete-file' has been around since Day One with exactly the same
user interaction. That's a long time for something "dangerous" to be tolerated.
How many people actually use it interactively? Of those, how many have reported
problems due to the danger in question? Versus: how many of those interactive
users would be annoyed by needing to confirm?
I mentioned two suggestions: (1) put file name in minibuffer or (2) require
confirmation. I didn't see any other suggestions mentioned. I still think #1 is
better overall than #2.
- delete-file default to buffer-file-name if non-nil, Deniz Dogan, 2010/05/15
- Re: delete-file default to buffer-file-name if non-nil, Davis Herring, 2010/05/15
- Re: delete-file default to buffer-file-name if non-nil, Deniz Dogan, 2010/05/15
- Re: delete-file default to buffer-file-name if non-nil, Richard Stallman, 2010/05/16
- RE: delete-file default to buffer-file-name if non-nil, Drew Adams, 2010/05/16
- Re: delete-file default to buffer-file-name if non-nil, Juri Linkov, 2010/05/16
- RE: delete-file default to buffer-file-name if non-nil, Drew Adams, 2010/05/16
- Re: delete-file default to buffer-file-name if non-nil, Stefan Monnier, 2010/05/17
- RE: delete-file default to buffer-file-name if non-nil,
Drew Adams <=
- Re: delete-file default to buffer-file-name if non-nil, Deniz Dogan, 2010/05/17
- Re: delete-file default to buffer-file-name if non-nil, Juri Linkov, 2010/05/17
- Re: delete-file default to buffer-file-name if non-nil, Juri Linkov, 2010/05/18
- Re: delete-file default to buffer-file-name if non-nil, Richard Stallman, 2010/05/17