Subject: Re: bug#77797: 31.0.50; Visit an empty file on creating it

From: Stefan Kangas <[email-masked]>
Date: Tue, 15 Apr 2025 09:11:40 -0500

Stephen Berman <[email-masked]> writes:

> On Tue, 15 Apr 2025 09:28:07 +0300 Eli Zaretskii <[email-masked]> wrote:
>
>>> From: Stefan Kangas <[email-masked]>
>>> Date: Mon, 14 Apr 2025 16:06:04 -0500
>>> Cc: [email-masked]
>>>
>>> >> That's backwards: in Emacs, you type "C-x C-f NEWFILE RET", then edit
>>> >> it, then save it.  IOW, you don't create an empty file first, because
>>> >> that's not useful.
>>> >
>>> > It's useful in the case I noted above: yanking text into a buffer that
>>> > you want to save to a file, and in particular if you want the file to be
>>> > in a not-yet-existing subdirectory.  In that case, with `C-x C-f' when
>>> > you type `C-x C-s' you are queried (from `basic-save-buffer') and have
>>> > to confirm that the subdirectory should be created, while with
>>> > `make-empty-file' it already has been created.  Or have I overlooked an
>>> > option to suppress the confirmation query?
>>>
>>> Maybe we should add an option to suppress the query?  Either as a
>>> defcustom or a prefix argument, or something.  Not sure which is best,
>>> because I actually prefer the query, myself.
>>
>> Same here: I prefer the query because it many times saves me from
>> creating files with wrong names and/or in wrong directorties, due to
>> simple typos.
>
> I agree, and consequently think an option is too blunt.  A prefix
> argument would be better, but as I wrote in my reply to Eshel Yaron, I
> prefer adding that to make-empty-file.

Yeah, I guess it would be situational, so a defcustom is too blunt.

I won't object to your proposal, unless anyone else can think of a
better use for a prefix argument for that `make-empty-file`.