dired-copy-filename-as-kill: Support project-relative names
* lisp/dired.el (dired-copy-filename-as-kill): Support new value of ARG, to mean file name relative to project root (bug#76792). * doc/emacs/dired.texi (Misc Dired Features): Mention it. * etc/NEWS: Same.
This commit is contained in:
parent
4980287e08
commit
af81b3af4c
3 changed files with 14 additions and 3 deletions
|
@ -1868,8 +1868,9 @@ names of the marked (or next @var{n}) files into the kill ring, as if
|
|||
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 1, it uses names relative to the
|
||||
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
|
||||
|
|
4
etc/NEWS
4
etc/NEWS
|
@ -1211,6 +1211,10 @@ Without 'dired-hide-details-hide-absolute-location':
|
|||
When 'dired-make-directory-clickable' is non-nil, clicking on the base
|
||||
name of the directory now reverts the Dired buffer.
|
||||
|
||||
*** 'dired-copy-filename-as-kill' supports project-relative names.
|
||||
With a new value of the prefix argument (1), this command copies file
|
||||
names relative to the root directory of the current project.
|
||||
|
||||
** Grep
|
||||
|
||||
+++
|
||||
|
|
|
@ -3478,6 +3478,7 @@ be quoted (with double quotes). (When there's a single file, no
|
|||
quoting is done.)
|
||||
|
||||
With a zero prefix arg, use the absolute file name of each marked file.
|
||||
With a prefix value 1, use the names relative to the current project root.
|
||||
With \\[universal-argument], use the file name relative to the Dired buffer's
|
||||
`default-directory'. (This still may contain slashes if in a subdirectory.)
|
||||
|
||||
|
@ -3489,8 +3490,13 @@ You can then feed the file name(s) to other commands with \\[yank]."
|
|||
(let* ((files
|
||||
(or (ensure-list (dired-get-subdir))
|
||||
(if arg
|
||||
(cond ((zerop (prefix-numeric-value arg))
|
||||
(cond ((eql 0 arg)
|
||||
(dired-get-marked-files))
|
||||
((eql 1 arg)
|
||||
(let ((root (project-root (project-current t))))
|
||||
(mapcar
|
||||
(lambda (file) (file-relative-name file root))
|
||||
(dired-get-marked-files))))
|
||||
((consp arg)
|
||||
(dired-get-marked-files t))
|
||||
(t
|
||||
|
|
Loading…
Add table
Reference in a new issue