From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#68579: [PATCH] Support a local repo as URL in treesit-language-source-alist Date: Fri, 19 Jan 2024 17:33:03 +0300 Message-ID: <79692782ee323c59388fac26d39dc70aeb525284.camel@yandex.ru> References: <0ffc2f474cf84ed3c63aa82091c967807e5ca0e6.camel@yandex.ru> <83frytwwly.fsf@gnu.org> <7010aa960be524d13f4dd96a1c7ea9102b580adf.camel@yandex.ru> <83ededwno1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13299"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.50.3 Cc: casouri@gmail.com, 68579@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 19 15:34:14 2024 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 1rQpwj-000352-8j for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jan 2024 15:34:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQpwX-0002c2-K9; Fri, 19 Jan 2024 09:34:01 -0500 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 1rQpwV-0002bG-V5 for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 09:33:59 -0500 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 1rQpwV-0001gC-Mi for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 09:33:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQpwX-0002Ui-Tv for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 09:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jan 2024 14:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68579 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68579-submit@debbugs.gnu.org id=B68579.17056747949512 (code B ref 68579); Fri, 19 Jan 2024 14:34:01 +0000 Original-Received: (at 68579) by debbugs.gnu.org; 19 Jan 2024 14:33:14 +0000 Original-Received: from localhost ([127.0.0.1]:57953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQpvm-0002TM-50 for submit@debbugs.gnu.org; Fri, 19 Jan 2024 09:33:14 -0500 Original-Received: from forward500a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:d500]:58320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQpvk-0002T8-Uz for 68579@debbugs.gnu.org; Fri, 19 Jan 2024 09:33:13 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-68.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-68.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0d:1f80:0:640:8386:0]) by forward500a.mail.yandex.net (Yandex) with ESMTP id 4ADD16116A; Fri, 19 Jan 2024 17:33:04 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-68.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 3XPY3P5OpOs0-xw3rdzt2; Fri, 19 Jan 2024 17:33:03 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1705674783; bh=zZTUWnPa+OlzvBAdqFoz3gMvKYx0CobZMcoBoV4uU0c=; h=In-Reply-To:Cc:References:To:From:Date:Subject:Message-ID; b=fJHO6b+uIQZqORpOv7pycKu1pO8sMtDsgz34QDJnuZDND0iC0c2danWifJKvfTigK 5aFLpNUnjrmgmub4o/HM89mv5j9zkNMSS98S5dxNr2LXaf/7kkr7dS9yKUnVYppTlP j6ygYUuH1GCwWN3y+yOVkbT22n3eedS0bxTSxF/A= Authentication-Results: mail-nwsmtp-smtp-production-main-68.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <83ededwno1.fsf@gnu.org> 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:278527 Archived-At: On Fri, 2024-01-19 at 13:46 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov > > Cc: 68579@debbugs.gnu.org > > Date: Fri, 19 Jan 2024 11:57:48 +0300 > >=20 > > On Fri, 2024-01-19 at 10:33 +0200, Eli Zaretskii wrote: > > [=E2=80=A6] > >=20 > > Thank you! > >=20 > > >=20 > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (url-is-path (str= ing-prefix-p "/" url)) > > >=20 > > > "Path" used wrongly again.=C2=A0 Also, the string-prefix-p test is to= o > > > na=C3=AFve and unportable.=C2=A0 I think file-name-absolute-p is a be= tter > > > test > > > (assuming we expect an absolute file name there), perhaps also > > > augmented by file-accessible-directory-p. > >=20 > > I would presume if the directory inaccessible some later commands > > such > > as `git checkout` will fail anyway, so no point in adding the > > `file- > > accessible-directory-p` check on Emacs side=E2=80=A6? >=20 > I'm talking about distinguishing between a URL and a local file name. > Are we guaranteed to get an absolute file name there?=C2=A0 If not, how d= o > you know that something like "http://foo.bar" cannot be a local file > name? Ah, gotcha! > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (workdir (expand-= file-name "repo")) > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (workdir (if url-= is-path url (expand-file-name > > > > "repo"))) > > >=20 > > > Not sure about this hunk: why do we not need to expand-file-name > > > if > > > URL is not a local directory but a real URL? > >=20 > > Idk, that was there =F0=9F=98=85 >=20 > The expand-file-name was there, yes.=C2=A0 But why do you think we should > avoid calling expand-file-name if URL is a local file name? Ah, sorry, I got that reversed. Yeah, it makes sense calling that for a local filename. I was wondering why was it there for a URL, which is partially why I read you wrong. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (when (file-exists-p workdir) > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (when (and (not url-is-path) (file-= exists-p workdir)) > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (delete-directory = workdir t))))) > > >=20 > > > Why?=C2=A0 Does workdir have different semantics in these two use > > > cases? > > > Isn't it the directory where we cloned the repository? > >=20 > > When an absolute path is passed as URL, that means the user have > > cloned > > the repo, not us. >=20 > But you still clone from it into workdir, no?=C2=A0 treesit--git-clone- > repo > invokes "git clone" in both cases, according to my reading of the > patch. No, the `treesit--git-clone-repo` is located on the "else" branch of the `(if url-is-path`. That is, we do not call it when it's a local path