From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <86il7tihzl.fsf@mail.linkov.net> References: <875y3t2827.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14974"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 66260@debbugs.gnu.org To: sbaugh@catern.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 29 09:01:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qm7V8-0003n3-IB for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Sep 2023 09:01:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm7Uc-0002V5-36; Fri, 29 Sep 2023 03:00:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm7UW-0002RA-2f for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2023 03:00:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qm7UV-0004ex-Q8 for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2023 03:00:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm7Uk-0000ob-49 for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2023 03:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Sep 2023 07:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66260 X-GNU-PR-Package: emacs Original-Received: via spool by 66260-submit@debbugs.gnu.org id=B66260.16959708133050 (code B ref 66260); Fri, 29 Sep 2023 07:01:02 +0000 Original-Received: (at 66260) by debbugs.gnu.org; 29 Sep 2023 07:00:13 +0000 Original-Received: from localhost ([127.0.0.1]:55025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm7Tu-0000n4-5H for submit@debbugs.gnu.org; Fri, 29 Sep 2023 03:00:13 -0400 Original-Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]:52981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm7Tp-0000kt-Kc for 66260@debbugs.gnu.org; Fri, 29 Sep 2023 03:00:08 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 831A21BF206; Fri, 29 Sep 2023 06:59:40 +0000 (UTC) In-Reply-To: <875y3t2827.fsf@catern.com> (sbaugh@catern.com's message of "Thu, 28 Sep 2023 23:26:41 +0000 (UTC)") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271467 Archived-At: > 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'?