From: Spencer Baugh <sbaugh@janestreet.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 64088@debbugs.gnu.org
Subject: bug#64088: [PATCH] Make project-root for vc projects return an absolute path
Date: Tue, 27 Jun 2023 16:01:29 -0400 [thread overview]
Message-ID: <ier4jms1xpi.fsf@janestreet.com> (raw)
In-Reply-To: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> (Dmitry Gutov's message of "Sat, 17 Jun 2023 05:47:00 +0300")
Dmitry Gutov <dmitry@gutov.dev> writes:
> On 15/06/2023 23:48, Spencer Baugh wrote:
>> - (setq project (list 'vc backend root))
>> + (setq project (list 'vc backend (expand-file-name root)))
>
> Spec violated or not (like Eli said, abbreviated names are still
> absolute), we should probably try to fix this in another place, so
> that other backends (whatever external ones exist) don't have to worry
> about the distinction.
>
> As you can see, in project-buffers, for example, we call expand-file-name.
OK, how about this?
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ddb033d50f9..b365e195415 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1575,7 +1575,10 @@ project-list-file
(defvar project--list 'unset
"List structure containing root directories of known projects.
-With some possible metadata (to be decided).")
+With some possible metadata (to be decided).
+
+Entries should be canonicalized with `expand-file-name' before
+being added.")
(defun project--read-project-list ()
"Initialize `project--list' using contents of `project-list-file'."
@@ -1613,7 +1616,7 @@ project-remember-project
Save the result in `project-list-file' if the list of projects
has changed, and NO-WRITE is nil."
(project--ensure-read-project-list)
- (let ((dir (project-root pr)))
+ (let ((dir (expand-file-name (project-root pr))))
(unless (equal (caar project--list) dir)
(dolist (ent project--list)
(when (equal dir (car ent))
@@ -1629,7 +1632,7 @@ project--remove-from-project-list
from the list using REPORT-MESSAGE, which is a format string
passed to `message' as its first argument."
(project--ensure-read-project-list)
- (when-let ((ent (assoc project-root project--list)))
+ (when-let ((ent (assoc (expand-file-name project-root) project--list)))
(setq project--list (delq ent project--list))
(message report-message project-root)
(project--write-project-list)))
next prev parent reply other threads:[~2023-06-27 20:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 20:48 bug#64088: [PATCH] Make project-root for vc projects return an absolute path Spencer Baugh
2023-06-16 5:52 ` Eli Zaretskii
2023-06-17 2:43 ` Dmitry Gutov
2023-06-17 6:25 ` Eli Zaretskii
2023-06-18 0:43 ` Dmitry Gutov
2023-06-17 2:47 ` Dmitry Gutov
2023-06-27 20:01 ` Spencer Baugh [this message]
2023-07-10 2:17 ` Dmitry Gutov
2023-07-10 23:45 ` Spencer Baugh
2023-08-12 0:45 ` Dmitry Gutov
2023-08-19 12:31 ` sbaugh
2023-08-19 12:57 ` sbaugh
2023-08-23 0:24 ` Dmitry Gutov
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=ier4jms1xpi.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=64088@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
/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).