GNU bug report logs - #66260
29.0.92; project.el should support copying a file path relative to the project root

Previous Next

Package: emacs;

Reported by: sbaugh <at> catern.com

Date: Thu, 28 Sep 2023 23:28:02 UTC

Severity: wishlist

Found in version 29.0.92

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: sbaugh <at> catern.com
Cc: 66260 <at> debbugs.gnu.org
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
> 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'?




This bug report was last modified 1 year and 293 days ago.

Previous Next


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