emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete-file default to buffer-file-name if non-nil


From: Juri Linkov
Subject: Re: delete-file default to buffer-file-name if non-nil
Date: Mon, 17 May 2010 02:09:31 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

>>     M-x delete-file RET does attempt to delete the current buffer's
>>     file or its directory if it has no file.  Personally, I find this
>>     default sort of dangerous, although at least C-x C-w often
>>     fixes it.
>>
>> It seems dangerous to me too.
>
> But it seems the most appropriate default value, in terms of what one might 
> want
> to delete. Don't you think so?

I think `read-file-name' should not use the default value when it is
not visible either in the prompt (displayed with the standard text
" (default filename): ") or in the minibuffer.

> If it is also dangerous, then some reasonable way should be found to deal
> with the danger - as opposed to simply changing the default value.
>
> Two (alternative) solutions that come to mind:
>
> 1. Insert the default value in the minibuffer. This assumes that the
> greatest danger is hitting RET without seeing what the file to be
> deleted is.

The argument INITIAL-CONTENTS is obsolete and should not be used.
It's possible to insert the default value to the minibuffer with `M-n'.

> 2. Require confirmation if RET is hit with no file name in the minibuffer.

Deleting from Dired requires confirmation, so perhaps `delete-file'
should require confirmation too.

-- 
Juri Linkov
http://www.jurta.org/emacs/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]