GNU bug report logs - #77668
[PATCH] Consider the current subdirectory in 'dired-create-empty-file'

Previous Next

Package: emacs;

Reported by: Kasper Gałkowski <kpg <at> posteo.net>

Date: Wed, 9 Apr 2025 08:00:05 UTC

Severity: normal

Tags: patch

Done: Stephen Berman <stephen.berman <at> gmx.net>

To reply to this bug, email your comments to 77668 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Wed, 09 Apr 2025 08:00:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kasper Gałkowski <kpg <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 09 Apr 2025 08:00:05 GMT) Full text and rfc822 format available.

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

From: Kasper Gałkowski <kpg <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Consider the current subdirectory in 'dired-create-empty-file'
Date: Wed, 09 Apr 2025 03:29:42 +0000
[Message part 1 (text/plain, inline)]
Tags: patch


Dear developers,

This small patch changes the 'dired-create-empty-file' command to use
the currently focused/active subdirectory - rather than the
topmost/default one - as the starting dirname for the interactive
prompt. This makes it consistent with 'dired-create-directory'.

Cheers,

  Kasper


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.48, cairo version 1.18.2)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: NixOS 24.11 (Vicuna)

Configured using:
 'configure
 --prefix=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip
 --bindir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/bin
 --sbindir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/sbin
 --includedir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/include
 --mandir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/share/man
 --infodir=/nix/store/nhawn00yywb6py7yzmz8xgrpz5wg32w3-emacs-tip-info/share/info
 --docdir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/share/doc/emacs
 --libdir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/lib
 --libexecdir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/libexec
 --localedir=/nix/store/79wgzibx44pyybla0p6x2l5mqa34688w-emacs-tip/share/locale
 --disable-gc-mark-trace --disable-build-details --without-sound
 --without-native-compilation --with-x --with-x-toolkit=gtk3
 --with-modules --with-threads'

[0001-Consider-the-current-subdirectory-in-dired-create-em.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Wed, 09 Apr 2025 12:56:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kasper Gałkowski <kpg <at> posteo.net>
Cc: 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Wed, 09 Apr 2025 15:54:34 +0300
> From: Kasper Gałkowski <kpg <at> posteo.net>
> Date: Wed, 09 Apr 2025 03:29:42 +0000
> 
> This small patch changes the 'dired-create-empty-file' command to use
> the currently focused/active subdirectory - rather than the
> topmost/default one - as the starting dirname for the interactive
> prompt. This makes it consistent with 'dired-create-directory'.

Thanks, but I don't think we can make such backward-incompatible
behavior change to be the default.  We could make it optional
behavior, like if the command is invoked with a prefix argument, or
have it controlled by a new user option, which will by default be off.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Fri, 11 Apr 2025 09:26:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kasper Gałkowski <kpg <at> posteo.net>
Cc: 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Fri, 11 Apr 2025 12:24:35 +0300
> Date: Fri, 11 Apr 2025 08:58:46 +0000
> Cc: 77668 <at> debbugs.gnu.org
> From: Kasper Gałkowski <kpg <at> posteo.net>
> 
>  > Thanks, but I don't think we can make such backward-incompatible
>  > behavior change to be the default.  We could make it optional
>  > behavior, like if the command is invoked with a prefix argument, or
>  > have it controlled by a new user option, which will by default be off.
> 
> I understand that you are skeptical about changing the command in an
> incompatible way - esp. with the software having this many users.
> 
> Let's dive a bit deeper: who would the change break? How inconvenient would
> that be for them?

Bitter experience has taught us that we have no real means of
answering such questions.  Our own logic and assumptions do not
necessarily reflect those of the Emacs users out there.  And there are
always use cases we cannot imagine.

At face value, this command should do what its name and doc string
say: create an empty file in this buffer's directory.  That's what I
would expect users to expect.

So making such incompatible changes in the default behavior is not
something we can do.  If it's an opt-in behavior, it should support
your needs (after you customize the option to your liking) and also
avoid breaking anyone who wants the previous behavior.  So I think
adding this as an optional behavior a good compromise.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Fri, 11 Apr 2025 12:42:02 GMT) Full text and rfc822 format available.

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

From: Kasper Gałkowski <kpg <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Fri, 11 Apr 2025 08:58:46 +0000
> Thanks, but I don't think we can make such backward-incompatible
> behavior change to be the default.  We could make it optional
> behavior, like if the command is invoked with a prefix argument, or
> have it controlled by a new user option, which will by default be off.

I understand that you are skeptical about changing the command in an
incompatible way - esp. with the software having this many users.

Let's dive a bit deeper: who would the change break? How inconvenient would
that be for them?

I suspect not many people use dired-insert-subdir (just based on the
observation that, for many years, the popular diff-hl dired extension
highlights VC states for the default-directory, i.e. just the topmost 
subdir).

It might have been that the first one to write d-c-e-f wasn't a user of 
d-i-s,
so the case of those two's interop flew under the radar, at that time.

On the other hand, the older dired-create-directory *is* subdir aware. This
makes sense, because according to the Git log, its author is also the author
of d-i-s.

It's quite a contrast between those two. Let's say one opens dired (C-x d),
inserts some subdirs (i), creates a directory deep down here (+). Now, tries
to dired-create-empty-file, but the file is created back up above.

If this default were to be changed, do you think it could have an impact on
dired's out of the box intuitiveness?

How would the average user expect for the above scenario to work?

Could creating an empty file in the topmost directory, rather than the one
around point, be done instead by using dired-goto-subdir first? (Maybe that
could be how it works with C-u).

-- 
  Kasper




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Sat, 12 Apr 2025 16:26:04 GMT) Full text and rfc822 format available.

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

From: Kasper Gałkowski <kpg <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Sat, 12 Apr 2025 16:25:25 +0000
I hoped that consolidating these two commands would be a quick win, but
I understand that could go wrong in unexpected ways.

Still, there have been a couple of breaking changes in the 30.1 release.
For example, to gdb-many-windows, eshell, eldoc and IELM. So, there must
be conditions under which such risk is worth the weight.

Maybe I should have studied the bugs/tickets related to these before
creating this one in order to present a more convincing argument.

> So I think adding this as an optional behavior a good compromise.

Myself I've wrapped the command in a defun with a different interactive
spec. To me, it seems a less invasive soultion, because it requires no
changes to the official sources - esp. given the change is so small.

Cheers,

-- 
  Kasper




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Mon, 14 Apr 2025 11:57:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Kasper Gałkowski <kpg <at> posteo.net>, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Mon, 14 Apr 2025 13:56:47 +0200
On Fri, 11 Apr 2025 12:24:35 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> Date: Fri, 11 Apr 2025 08:58:46 +0000
>> Cc: 77668 <at> debbugs.gnu.org
>> From: Kasper Gałkowski <kpg <at> posteo.net>
>> 
>>  > Thanks, but I don't think we can make such backward-incompatible
>>  > behavior change to be the default.  We could make it optional
>>  > behavior, like if the command is invoked with a prefix argument, or
>>  > have it controlled by a new user option, which will by default be off.
>> 
>> I understand that you are skeptical about changing the command in an
>> incompatible way - esp. with the software having this many users.
>> 
>> Let's dive a bit deeper: who would the change break? How inconvenient would
>> that be for them?
>
> Bitter experience has taught us that we have no real means of
> answering such questions.  Our own logic and assumptions do not
> necessarily reflect those of the Emacs users out there.  And there are
> always use cases we cannot imagine.
>
> At face value, this command should do what its name and doc string
> say: create an empty file in this buffer's directory.

The command can in fact do more than that and then the doc string is at
best misleading; here it is:

"Create an empty file called FILE.
Add a new entry for the new file in the Dired buffer.
Parent directories of FILE are created as needed.
If FILE already exists, signal an error."

If the current buffer D is a Dired buffer and you invoke
dired-create-empty-file to create an empty file F in D, then indeed, the
entry for F is added to D.  But if you use the command to create F in a
previously non-existing subdirectory S of D, then the entry for S, not
F, is added to D, so the doc string, taken literally, is wrong in this
case (F is of course added to S, but S is not currently a Dired buffer).

>                                                        That's what I
> would expect users to expect.

For the subdirectory case I think it is not so clear what users would
expect; the doc string might lead them to expect that a new Dired buffer
S containing F would be opened.

> So making such incompatible changes in the default behavior is not
> something we can do.  If it's an opt-in behavior, it should support
> your needs (after you customize the option to your liking) and also
> avoid breaking anyone who wants the previous behavior.  So I think
> adding this as an optional behavior a good compromise.

Given that the current behavior has existed since the command was
introduced (see bug#24150), I agree it should not be unconditionally
changed.  However, the discussion in bug#24150 makes no mention of the
inserted subdirectory use case, so I also agree with Kasper that this
was probably an oversight.  This conclusion is further supported by the
fact that in the bug thread no justification is given for omitting the
call to dired-current-directory as the DIR argument of the
read-file-name invocation in dired-create-empty-file, although
dired-create-directory (which has this argument) was the explicit model
for dired-create-empty-file.

Kasper's proposal to amend this omission in fact introduces a further
incompatibility: it makes invoking dired-create-empty-file outside of a
Dired buffer raise an error, just as invoking dired-create-directory
outside of Dired does.  However, I don't think this is a serious
incompatibility, because the command make-empty-file (which
dired-create-empty-file uses) exists precisely for this purpose.

In short, I support Kasper's proposal, but agree with Eli that, given
the existing behavior, it should be conditioned on a user option.  If
Kasper does not want to submit a patch for that, I'd be happy to do so.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Mon, 14 Apr 2025 16:09:01 GMT) Full text and rfc822 format available.

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

From: Kasper Gałkowski <kpg <at> posteo.net>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Mon, 14 Apr 2025 16:08:37 +0000
Stephen Berman <stephen.berman <at> gmx.net> writes:

> In short, I support Kasper's proposal, but agree with Eli that, given
> the existing behavior, it should be conditioned on a user option.  If
> Kasper does not want to submit a patch for that, I'd be happy to do so.

Steve - feel free to take over for the patch. I admit, I had trouble
visualising such a change. I wasn't sure whether a similar option to
control dired-create-directory should also be added - for symmetry.
That's why I decided to stick with the "wrapper" approach, for now.

-- 
  Kasper




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 07:23:01 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Kasper Gałkowski <kpg <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 09:22:40 +0200
On Mon, 14 Apr 2025 16:08:37 +0000 Kasper Gałkowski <kpg <at> posteo.net> wrote:

> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> In short, I support Kasper's proposal, but agree with Eli that, given
>> the existing behavior, it should be conditioned on a user option.  If
>> Kasper does not want to submit a patch for that, I'd be happy to do so.
>
> Steve - feel free to take over for the patch. I admit, I had trouble
> visualising such a change. I wasn't sure whether a similar option to
> control dired-create-directory should also be added - for symmetry.
> That's why I decided to stick with the "wrapper" approach, for now.

Ok, I'll write a patch and post it here.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 13:03:01 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Kasper Gałkowski <kpg <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 15:02:01 +0200
[Message part 1 (text/plain, inline)]
On Tue, 15 Apr 2025 09:22:40 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> On Mon, 14 Apr 2025 16:08:37 +0000 Kasper Gałkowski <kpg <at> posteo.net> wrote:
>
>> Stephen Berman <stephen.berman <at> gmx.net> writes:
>>
>>> In short, I support Kasper's proposal, but agree with Eli that, given
>>> the existing behavior, it should be conditioned on a user option.  If
>>> Kasper does not want to submit a patch for that, I'd be happy to do so.
>>
>> Steve - feel free to take over for the patch. I admit, I had trouble
>> visualising such a change. I wasn't sure whether a similar option to
>> control dired-create-directory should also be added - for symmetry.
>> That's why I decided to stick with the "wrapper" approach, for now.
>
> Ok, I'll write a patch and post it here.

The patch is attached.  I did not add a corresponding option for
`dired-create-directory' because, as I wrote upthread, I think making
`dired-create-empty-file' not prompt with the current subdirectory was
an oversight.  For this reason, the name of the user option is specific
to this command.

Steve Berman

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 13:27:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: kpg <at> posteo.net, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 16:26:15 +0300
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  77668 <at> debbugs.gnu.org
> Date: Tue, 15 Apr 2025 15:02:01 +0200
> 
> > Ok, I'll write a patch and post it here.
> 
> The patch is attached.

Thanks.

> +---
> +*** New user option 'dired-create-empty-file-in-current-directory'.
> +When non-nil, 'dired-create-empty-file' prompts with the current
> +subdirectory in the Dired buffer.  When nil (the default),
> +'dired-create-empty-file' prompts with the default directory.

I think the important part is not how the command prompts, the
important part is in which directory will the file be created by
default, i.e. if the user accepts the directory without editing it.

> +(defcustom dired-create-empty-file-in-current-directory nil
> +  "If non-nil, `dired-create-empty-file' prompts with current directory.
> +If nil, `dired-create-empty-file' prompts with the default directory."

Same here.

>  (defun dired-create-empty-file (file)
>    "Create an empty file called FILE.
> -Add a new entry for the new file in the Dired buffer.
>  Parent directories of FILE are created as needed.
> +If user option `dired-create-empty-file-in-current-directory' is
> +non-nil, prompt to create FILE (or its topmost new parent directory) in
> +the current subdirectory, otherwise prompt with the default directory.
> +Add an entry in the Dired buffer for the topmost new parent
> +directory of FILE, if created, otherwise for the new file.

And here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 14:47:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: kpg <at> posteo.net, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 16:45:55 +0200
[Message part 1 (text/plain, inline)]
On Tue, 15 Apr 2025 16:26:15 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: Eli Zaretskii <eliz <at> gnu.org>,  77668 <at> debbugs.gnu.org
>> Date: Tue, 15 Apr 2025 15:02:01 +0200
>> 
>> > Ok, I'll write a patch and post it here.
>> 
>> The patch is attached.
>
> Thanks.
>
>> +---
>> +*** New user option 'dired-create-empty-file-in-current-directory'.
>> +When non-nil, 'dired-create-empty-file' prompts with the current
>> +subdirectory in the Dired buffer.  When nil (the default),
>> +'dired-create-empty-file' prompts with the default directory.
>
> I think the important part is not how the command prompts, the
> important part is in which directory will the file be created by
> default, i.e. if the user accepts the directory without editing it.
>
>> +(defcustom dired-create-empty-file-in-current-directory nil
>> +  "If non-nil, `dired-create-empty-file' prompts with current directory.
>> +If nil, `dired-create-empty-file' prompts with the default directory."
>
> Same here.
>
>>  (defun dired-create-empty-file (file)
>>    "Create an empty file called FILE.
>> -Add a new entry for the new file in the Dired buffer.
>>  Parent directories of FILE are created as needed.
>> +If user option `dired-create-empty-file-in-current-directory' is
>> +non-nil, prompt to create FILE (or its topmost new parent directory) in
>> +the current subdirectory, otherwise prompt with the default directory.
>> +Add an entry in the Dired buffer for the topmost new parent
>> +directory of FILE, if created, otherwise for the new file.
>
> And here.

Is the attached patch better?

Steve Berman
[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 14:52:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: kpg <at> posteo.net, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 17:51:35 +0300
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Cc: kpg <at> posteo.net,  77668 <at> debbugs.gnu.org
> Date: Tue, 15 Apr 2025 16:45:55 +0200
> 
> On Tue, 15 Apr 2025 16:26:15 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> >> From: Stephen Berman <stephen.berman <at> gmx.net>
> >> Cc: Eli Zaretskii <eliz <at> gnu.org>,  77668 <at> debbugs.gnu.org
> >> Date: Tue, 15 Apr 2025 15:02:01 +0200
> >> 
> >> > Ok, I'll write a patch and post it here.
> >> 
> >> The patch is attached.
> >
> > Thanks.
> >
> >> +---
> >> +*** New user option 'dired-create-empty-file-in-current-directory'.
> >> +When non-nil, 'dired-create-empty-file' prompts with the current
> >> +subdirectory in the Dired buffer.  When nil (the default),
> >> +'dired-create-empty-file' prompts with the default directory.
> >
> > I think the important part is not how the command prompts, the
> > important part is in which directory will the file be created by
> > default, i.e. if the user accepts the directory without editing it.
> >
> >> +(defcustom dired-create-empty-file-in-current-directory nil
> >> +  "If non-nil, `dired-create-empty-file' prompts with current directory.
> >> +If nil, `dired-create-empty-file' prompts with the default directory."
> >
> > Same here.
> >
> >>  (defun dired-create-empty-file (file)
> >>    "Create an empty file called FILE.
> >> -Add a new entry for the new file in the Dired buffer.
> >>  Parent directories of FILE are created as needed.
> >> +If user option `dired-create-empty-file-in-current-directory' is
> >> +non-nil, prompt to create FILE (or its topmost new parent directory) in
> >> +the current subdirectory, otherwise prompt with the default directory.
> >> +Add an entry in the Dired buffer for the topmost new parent
> >> +directory of FILE, if created, otherwise for the new file.
> >
> > And here.
> 
> Is the attached patch better?

You kept the "prompts with" part, which I think just muddies the
waters.  But if you insist, I won't fight.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 15:30:03 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: kpg <at> posteo.net, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 17:29:10 +0200
[Message part 1 (text/plain, inline)]
On Tue, 15 Apr 2025 17:51:35 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: kpg <at> posteo.net,  77668 <at> debbugs.gnu.org
>> Date: Tue, 15 Apr 2025 16:45:55 +0200
>> 
>> On Tue, 15 Apr 2025 16:26:15 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 
>> >> From: Stephen Berman <stephen.berman <at> gmx.net>
>> >> Cc: Eli Zaretskii <eliz <at> gnu.org>,  77668 <at> debbugs.gnu.org
>> >> Date: Tue, 15 Apr 2025 15:02:01 +0200
>> >> 
>> >> > Ok, I'll write a patch and post it here.
>> >> 
>> >> The patch is attached.
>> >
>> > Thanks.
>> >
>> >> +---
>> >> +*** New user option 'dired-create-empty-file-in-current-directory'.
>> >> +When non-nil, 'dired-create-empty-file' prompts with the current
>> >> +subdirectory in the Dired buffer.  When nil (the default),
>> >> +'dired-create-empty-file' prompts with the default directory.
>> >
>> > I think the important part is not how the command prompts, the
>> > important part is in which directory will the file be created by
>> > default, i.e. if the user accepts the directory without editing it.
>> >
>> >> +(defcustom dired-create-empty-file-in-current-directory nil
>> >> +  "If non-nil, `dired-create-empty-file' prompts with current directory.
>> >> +If nil, `dired-create-empty-file' prompts with the default directory."
>> >
>> > Same here.
>> >
>> >>  (defun dired-create-empty-file (file)
>> >>    "Create an empty file called FILE.
>> >> -Add a new entry for the new file in the Dired buffer.
>> >>  Parent directories of FILE are created as needed.
>> >> +If user option `dired-create-empty-file-in-current-directory' is
>> >> +non-nil, prompt to create FILE (or its topmost new parent directory) in
>> >> +the current subdirectory, otherwise prompt with the default directory.
>> >> +Add an entry in the Dired buffer for the topmost new parent
>> >> +directory of FILE, if created, otherwise for the new file.
>> >
>> > And here.
>> 
>> Is the attached patch better?
>
> You kept the "prompts with" part, which I think just muddies the
> waters.  But if you insist, I won't fight.

I thought it was important to mention the prompt since its content can
depend on the value of the user option, but since the user will see
that, I guess that suffices, so I left it out in the attached patch.  If
you agree with the wording now, is the patch ready to install?

Steve Berman
[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77668; Package emacs. (Tue, 15 Apr 2025 15:58:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: kpg <at> posteo.net, 77668 <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 18:57:37 +0300
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Cc: kpg <at> posteo.net,  77668 <at> debbugs.gnu.org
> Date: Tue, 15 Apr 2025 17:29:10 +0200
> 
> On Tue, 15 Apr 2025 17:51:35 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> >> Is the attached patch better?
> >
> > You kept the "prompts with" part, which I think just muddies the
> > waters.  But if you insist, I won't fight.
> 
> I thought it was important to mention the prompt since its content can
> depend on the value of the user option, but since the user will see
> that, I guess that suffices, so I left it out in the attached patch.  If
> you agree with the wording now, is the patch ready to install?

Yes, thanks.




Reply sent to Stephen Berman <stephen.berman <at> gmx.net>:
You have taken responsibility. (Tue, 15 Apr 2025 17:07:02 GMT) Full text and rfc822 format available.

Notification sent to Kasper Gałkowski <kpg <at> posteo.net>:
bug acknowledged by developer. (Tue, 15 Apr 2025 17:07:02 GMT) Full text and rfc822 format available.

Message #49 received at 77668-done <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: kpg <at> posteo.net, 77668-done <at> debbugs.gnu.org
Subject: Re: bug#77668: [PATCH] Consider the current subdirectory in
 'dired-create-empty-file'
Date: Tue, 15 Apr 2025 19:06:38 +0200
On Tue, 15 Apr 2025 18:57:37 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: kpg <at> posteo.net,  77668 <at> debbugs.gnu.org
>> Date: Tue, 15 Apr 2025 17:29:10 +0200
>> 
>> On Tue, 15 Apr 2025 17:51:35 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 
>> >> Is the attached patch better?
>> >
>> > You kept the "prompts with" part, which I think just muddies the
>> > waters.  But if you insist, I won't fight.
>> 
>> I thought it was important to mention the prompt since its content can
>> depend on the value of the user option, but since the user will see
>> that, I guess that suffices, so I left it out in the attached patch.  If
>> you agree with the wording now, is the patch ready to install?
>
> Yes, thanks.

Thanks, done in commit 0ac12aed097 and closing the bug.  And thanks to
Kasper for proposing the change.

Steve Berman




This bug report was last modified 18 days ago.

Previous Next


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