GNU bug report logs -
#76792
[PATCH] dired-copy-filename-as-kill to support project relative names
Previous Next
Reported by: Dmitry Gutov <dmitry <at> gutov.dev>
Date: Thu, 6 Mar 2025 22:40:02 UTC
Severity: wishlist
Tags: patch
Fixed in version 31.1
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76792 in the body.
You can then email your comments to 76792 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Thu, 06 Mar 2025 22:40:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dmitry Gutov <dmitry <at> gutov.dev>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 06 Mar 2025 22:40:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here's an implementation for that idea, together with .texi and NEWS
changes.
Comments welcome!
[dired-copy-filename-as-kill-project-relative.diff (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 05:14:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 76792 <at> debbugs.gnu.org (full text, mbox):
[வெள்ளி மார்ச் 07, 2025] Dmitry Gutov wrote:
> Here's an implementation for that idea, together with .texi and NEWS
> changes.
>
> Comments welcome!
Maybe there's a typo, see below.
> diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
> index 07142e71713..5fc0c3b4a52 100644
> --- a/doc/emacs/dired.texi
> +++ b/doc/emacs/dired.texi
> @@ -1860,8 +1860,9 @@ Misc Dired Features
> you had killed them with @kbd{C-w}. The names are separated by a
> space.
>
> - With a zero prefix argument, this uses the absolute file name of
> -each marked file. With just @kbd{C-u} as the prefix argument, it uses
> + With a zero prefix argument, this uses the absolute file name of each
> +marked file. With prefix value, it uses names relative to the current
^^^^^^^^^^^^^^^^^^
Did you mean, "With prefix value 1?"
> +project root. With just @kbd{C-u} as the prefix argument, it uses
> file names relative to the Dired buffer's default directory. (This
> can still contain slashes if in a subdirectory.) As a special case,
> if point is on a directory header line, @kbd{w} gives you the absolute
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 07:07:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 76792 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 7 Mar 2025 00:39:02 +0200
> From: Dmitry Gutov <dmitry <at> gutov.dev>
>
> - With a zero prefix argument, this uses the absolute file name of
> -each marked file. With just @kbd{C-u} as the prefix argument, it uses
> + With a zero prefix argument, this uses the absolute file name of each
> +marked file. With prefix value, it uses names relative to the current
> +project root. With just @kbd{C-u} as the prefix argument, it uses
> file names relative to the Dired buffer's default directory. (This
Using 1 as the prefix arg which means files are relative to project
root seems inconsistent with the meaning of zero argument. So I would
suggest to use "C-u C-u" for the new meaning. It is not harder to
type, and it is more mentally similar to "just C-u".
> +*** 'dired-copy-filename-as-kill' supports project-relative names.
> +With a new value of the prefix argument (1), this command copies file
Suggest to reword:
When invoked with the prefix argument of 1, this command ...
(But if you agree to switch to "C-u C-u", this will need to be phrased
differently.)
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 07:18:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 76792 <at> debbugs.gnu.org (full text, mbox):
> Here's an implementation for that idea, together with .texi and NEWS
> changes.
>
> Comments welcome!
I wanted to suggest 'C-x p f M-n' in Dired to get the default value
based on the current Dired file, just to copy it and cancel with 'C-g',
and maybe this still could be added as well. But definitely '1 w'
or even 'C-u C-u w' is a more convenient way to get a file name
relative to the project root, thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 15:20:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 76792 <at> debbugs.gnu.org (full text, mbox):
On 07/03/2025 09:06, Eli Zaretskii wrote:
> Using 1 as the prefix arg which means files are relative to project
> root seems inconsistent with the meaning of zero argument.
Is it really? We have 0 which means "absolute name" and we have 'C-u'
(which often translates to 4) which means "only base name".
The project-relative name sits somewhere in the middle (when judging by
length, for example) so 1 seems fitting.
> So I would
> suggest to use "C-u C-u" for the new meaning. It is not harder to
> type, and it is more mentally similar to "just C-u".
I could agree to 'C-u C-u' as well, but it does seem like a longer
sequence requiring two hands (while '1' sits very close to 'w' and would
be typed with one hand). Semantically as well the new behavior doesn't
seem like an advanced version of the current 'C-u' behavior.
But if the majority prefers 'C-u C-u', I won't argue.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 15:21:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 76792 <at> debbugs.gnu.org (full text, mbox):
On 07/03/2025 07:13, Visuwesh wrote:
> Did you mean, "With prefix value 1?"
Yep, thanks!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 16:21:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 76792 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> On 07/03/2025 09:06, Eli Zaretskii wrote:
>> Using 1 as the prefix arg which means files are relative to project
>> root seems inconsistent with the meaning of zero argument.
>
> Is it really? We have 0 which means "absolute name" and we have 'C-u'
> (which often translates to 4) which means "only base name".
>
> The project-relative name sits somewhere in the middle (when judging by
> length, for example) so 1 seems fitting.
>
>> So I would
>> suggest to use "C-u C-u" for the new meaning. It is not harder to
>> type, and it is more mentally similar to "just C-u".
>
> I could agree to 'C-u C-u' as well, but it does seem like a longer
> sequence requiring two hands (while '1' sits very close to 'w' and would
> be typed with one hand).
FWIW, on some keyboard layouts, e.g. Dvorak which I have here, this
doesn't hold. :-)
> Semantically as well the new behavior doesn't
> seem like an advanced version of the current 'C-u' behavior.
>
> But if the majority prefers 'C-u C-u', I won't argue.
Hmm, `dired-copy-filename-as-kill` with prefix 1 copies one file, with
prefix 2 copies two, with 3 copies three, and so on.
Do we care to keep this behavior?
If so, I think 1 is the only prefix left that makes sense. That gives
us:
0 copy absolute file name
1 copy project file name
2 copy 2 files
...
7 copy 7 files
8 copy 8 files
9 copy 9 files
With C-u C-u, we get this instead:
0 copy absolute file name
1 copy 1 file [ NB. same as with no prefix ]
2 copy 2 files
...
7 copy 7 files
8 copy project file name
9 copy 9 files
That means we have no way of copying 8 file names, I think, and two ways
to copy just 1.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 07 Mar 2025 16:24:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 76792 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefankangas <at> gmail.com> writes:
> That means we have no way of copying 8 file names, I think, and two ways
> to copy just 1.
Actually, scratch that. The above is wrong, I got confused.
Sorry for the noise.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Sat, 08 Mar 2025 02:49:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 76792 <at> debbugs.gnu.org (full text, mbox):
On 07/03/2025 18:20, Stefan Kangas wrote:
> Dmitry Gutov <dmitry <at> gutov.dev> writes:
>
>> On 07/03/2025 09:06, Eli Zaretskii wrote:
>>> Using 1 as the prefix arg which means files are relative to project
>>> root seems inconsistent with the meaning of zero argument.
>>
>> Is it really? We have 0 which means "absolute name" and we have 'C-u'
>> (which often translates to 4) which means "only base name".
>>
>> The project-relative name sits somewhere in the middle (when judging by
>> length, for example) so 1 seems fitting.
>>
>>> So I would
>>> suggest to use "C-u C-u" for the new meaning. It is not harder to
>>> type, and it is more mentally similar to "just C-u".
>>
>> I could agree to 'C-u C-u' as well, but it does seem like a longer
>> sequence requiring two hands (while '1' sits very close to 'w' and would
>> be typed with one hand).
>
> FWIW, on some keyboard layouts, e.g. Dvorak which I have here, this
> doesn't hold. :-)
True, and anyway I think semantic fit is more important.
>> Semantically as well the new behavior doesn't
>> seem like an advanced version of the current 'C-u' behavior.
>>
>> But if the majority prefers 'C-u C-u', I won't argue.
>
> Hmm, `dired-copy-filename-as-kill` with prefix 1 copies one file, with
> prefix 2 copies two, with 3 copies three, and so on.
>
> Do we care to keep this behavior?
I actually wasn't aware of this one.
Like you concluded, it would still be supported, except for value ARG=1.
We have reserved ARG=0 for a different behavior already, so it seems
that ARG is not suitable for programmatic calculation anyway.
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Mar 2025 21:08:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76792
; Package
emacs
.
(Fri, 14 Mar 2025 20:36:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 76792 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> Like you concluded, it would still be supported, except for value ARG=1. We have
> reserved ARG=0 for a different behavior already, so it seems that ARG is not
> suitable for programmatic calculation anyway.
I found use for this new prefix argument today.
How about installing it now?
Reply sent
to
Dmitry Gutov <dmitry <at> gutov.dev>
:
You have taken responsibility.
(Sat, 15 Mar 2025 03:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Dmitry Gutov <dmitry <at> gutov.dev>
:
bug acknowledged by developer.
(Sat, 15 Mar 2025 03:08:03 GMT)
Full text and
rfc822 format available.
Message #39 received at 76792-done <at> debbugs.gnu.org (full text, mbox):
Version: 31.1
On 14/03/2025 22:35, Stefan Kangas wrote:
> Dmitry Gutov <dmitry <at> gutov.dev> writes:
>
>> Like you concluded, it would still be supported, except for value ARG=1. We have
>> reserved ARG=0 for a different behavior already, so it seems that ARG is not
>> suitable for programmatic calculation anyway.
>
> I found use for this new prefix argument today.
>
> How about installing it now?
Thanks for the encouragement, pushed it now to master, commit
af81b3af4ce99c.
Just to note that if anybody still disagrees with the prefix convention,
they are free to refine the behavior, I don't really mind.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 12 Apr 2025 11:24:14 GMT)
Full text and
rfc822 format available.
This bug report was last modified 119 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.