unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: sbaugh@catern.com
Cc: 66260@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	[thread overview]
Message-ID: <86il7tihzl.fsf@mail.linkov.net> (raw)
In-Reply-To: <875y3t2827.fsf@catern.com> (sbaugh@catern.com's message of "Thu,  28 Sep 2023 23:26:41 +0000 (UTC)")

> 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	other threads:[~2023-09-29  6:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 23:26 bug#66260: 29.0.92; project.el should support copying a file path relative to the project root sbaugh
2023-09-29  6:57 ` Juri Linkov [this message]
2023-09-30 13:50   ` sbaugh
2023-09-30 14:47     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 15:17       ` sbaugh
2023-10-01 22:44 ` Dmitry Gutov
2023-10-02  5:57   ` Eli Zaretskii
2023-10-02  6:53     ` Juri Linkov
2023-10-02 11:46       ` Dmitry Gutov
2023-10-03 20:49         ` sbaugh
2023-10-03 21:17           ` Dmitry Gutov
2023-10-02 11:13     ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-21 13:13   ` sbaugh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86il7tihzl.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=66260@debbugs.gnu.org \
    --cc=sbaugh@catern.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).