bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66260: 29.0.92; project.el should support copying a file path relati


From: Juri Linkov
Subject: bug#66260: 29.0.92; project.el should support copying a file path relative to the project root
Date: Fri, 29 Sep 2023 09:57:50 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> When communicating with others, it is often useful to copy a file path
> to the current file which is relative to the project root.  For example
> I'd rather send someone the path lisp/progmodes/project.el than
> ~/src/emacs/trunk/lisp/progmodes/project.el.

I have the same problem.  Often for a project directory I give
a name of the current branch, but later after switching branches
sending an absolute file path with an obsolete directory name
would be very confusing.  So every time need to spend too much time
manually removing the prefix.

> project.el should have a way to copy this file path.
>
> Almost good enough is:
>
>  C-x p f       ;; project-find-file
>  M-n         ;; next-history-element
>  C-k         ;; kill-line
>
> but with project--read-file-cpd-relative, if all the files in
> project-files start with a common-parent-directory which is a
> subdirectory of project-root, the resulting file path will not be
> relative to the project-root but to the subdirectory.
>
> Maybe the thing to do is just make project--read-file-cpd-relative use
> project-root instead of calculating a common-parent-directory?  I would
> be happy to make that patch if that's acceptable.  I think that's
> probably the best option.

Sorry, I have no opinion about the option above, because I always use
dired-copy-filename-as-kill with the zero prefix argument:

> Alternatively, it might be cool if there was a variation on:
>
>  C-x C-j     ;; dired-jump
>  M-0       ;; digit-argument
>  w         ;; dired-copy-filename-as-kill
>
> (which copies an absolute path) to instead copy a project-root-relative
> path.

Sometimes an absolute path is needed too even in project directories.
Maybe it's possible to find a new prefix argument to copy
a project-root-relative path like 'C-u C-u w'?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]