From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#64088: [PATCH] Make project-root for vc projects return an absolute path Date: Tue, 27 Jun 2023 16:01:29 -0400 Message-ID: References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36340"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64088@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 27 22:02:25 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 1qEEtM-0009GI-NR for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Jun 2023 22:02:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEEt2-0007IW-Gj; Tue, 27 Jun 2023 16:02:04 -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 1qEEt0-0007IN-Na for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2023 16:02:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEEt0-0003vZ-ER for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2023 16:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qEEsz-000262-VQ for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2023 16:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Jun 2023 20:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64088 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64088-submit@debbugs.gnu.org id=B64088.16878961008028 (code B ref 64088); Tue, 27 Jun 2023 20:02:01 +0000 Original-Received: (at 64088) by debbugs.gnu.org; 27 Jun 2023 20:01:40 +0000 Original-Received: from localhost ([127.0.0.1]:49578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEEsd-00025P-Mv for submit@debbugs.gnu.org; Tue, 27 Jun 2023 16:01:40 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:40641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEEsZ-000257-0i for 64088@debbugs.gnu.org; Tue, 27 Jun 2023 16:01:38 -0400 In-Reply-To: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> (Dmitry Gutov's message of "Sat, 17 Jun 2023 05:47:00 +0300") 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:264177 Archived-At: Dmitry Gutov 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)))