GNU bug report logs - #77797
31.0.50; Visit an empty file on creating it

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Mon, 14 Apr 2025 11:59:02 UTC

Severity: normal

Found in version 31.0.50

Full log


Message #11 received at 77797 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77797 <at> debbugs.gnu.org
Subject: Re: bug#77797: 31.0.50; Visit an empty file on creating it
Date: Mon, 14 Apr 2025 17:14:03 +0200
On Mon, 14 Apr 2025 16:38:21 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> Date: Mon, 14 Apr 2025 13:57:59 +0200
>> From:  Stephen Berman via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> To create an empty file (and perhaps also one or more parent
>> directories) and then immediately visit the file (e.g., to yank some
>> copied text into it), you currently have to type `M-x make-empty-file',
>> enter the file name (possibly with parent directories), and then type
>> `C-x C-f M-p'.
>
> 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?

> The make-empty-file command exists for cases where the only desired
> outcome is to make an empty file.  Not if the user wants to create a
> _new_ _non-empty_ file.

I think the above use case is valid.  (Just yesterday I had occasion to
do that and not being able to (without being queried about the
subdirectory) is what prompted me to propose the feature.)

>> As a more convenient alternative to invoking two commands, I propose
>> that invoking `make-empty-file' with a prefix argument should create
>> and visit the empty file.  Here is a simple backward compatible
>> patch to do this:
>
> I don't necessarily object, but please note that this is non-Emacs'y.

I didn't mean to offend you :-)

Since you don't necessarily object, what's the next step?

Steve Berman




This bug report was last modified 62 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.