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 19:06:59 +0300 Message-ID: <4b9f254dcba00812e8f6002d82cd7ebb0a29c45e.camel@yandex.ru> References: <0ffc2f474cf84ed3c63aa82091c967807e5ca0e6.camel@yandex.ru> <83frytwwly.fsf@gnu.org> <7010aa960be524d13f4dd96a1c7ea9102b580adf.camel@yandex.ru> <83ededwno1.fsf@gnu.org> <79692782ee323c59388fac26d39dc70aeb525284.camel@yandex.ru> <83r0iduzvc.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="25375"; 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 17:08:17 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 1rQrPl-0006Ne-N9 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jan 2024 17:08:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQrPZ-0007Bg-5X; Fri, 19 Jan 2024 11:08:05 -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 1rQrPU-00076S-KQ for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 11:08:00 -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 1rQrPU-0006bV-5W for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 11:08:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQrPV-0004vO-UK for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 11:08: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 16:08: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.170568042918771 (code B ref 68579); Fri, 19 Jan 2024 16:08:01 +0000 Original-Received: (at 68579) by debbugs.gnu.org; 19 Jan 2024 16:07:09 +0000 Original-Received: from localhost ([127.0.0.1]:60003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQrOf-0004sh-5t for submit@debbugs.gnu.org; Fri, 19 Jan 2024 11:07:09 -0500 Original-Received: from forward501b.mail.yandex.net ([178.154.239.145]:59384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQrOb-0004rw-Uj for 68579@debbugs.gnu.org; Fri, 19 Jan 2024 11:07:07 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:5205:0:640:3bd4:0]) by forward501b.mail.yandex.net (Yandex) with ESMTP id 3F2F7609B6; Fri, 19 Jan 2024 19:07:01 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id x6RSoL6OnSw0-OpXFsaP3; Fri, 19 Jan 2024 19:07:00 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1705680420; bh=GIglIlSJVeNI9FRnBjkUGC6/SdEjfDr9vCsW/UqPcZU=; h=In-Reply-To:Cc:References:To:From:Date:Subject:Message-ID; b=lxYrhm4iwHBmqZknXJpPah7881MAl0joZuePBtZ4XJ1zHfkK+4FLTSSp9HnXcZbJi ZhvYmwJgh4GZg/CEbmd5oOGcBFz61uHhaDLx55e37ZY0oclKY5vZGQfobAndSi9Tj9 /CZ0JULMuxppmAoPrCjGc7Or+mz9XghyIUyaVCQE= Authentication-Results: mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <83r0iduzvc.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:278535 Archived-At: On Fri, 2024-01-19 at 17:06 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov > > Cc: casouri@gmail.com, 68579@debbugs.gnu.org > > Date: Fri, 19 Jan 2024 17:33:03 +0300 > >=20 > > > > > > -=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) (f= ile-exists-p > > > > > > workdir)) > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (delete-direct= ory 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. > >=20 > > 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 >=20 > Then this assumes some kind of workflow, doesn't it?=C2=A0 The user must > first clone the repository, either via treesit.el or manually, and > then they can use this new feature, right?=C2=A0 So I guess we should > document this workflow somewhere? Well, I can add some docs if you want, but the workflow per se seems obvious to me: you have a function that accepts a local path to repo and builds from it. You'd never want someone to delete your repo just because you asked that someone to compile sources in the repo, because you might have some local commits in there. Removing it would be a completely surprising side-effect. OTOH, when you pass a URL to the same function, you ask "pls build from the sources, I don't care how", so the function clones it to a temporary dir. It may or may not remove the dir, it's doesn't matter that much. But the temporary directory becomes a junk after the build completed, so why not remove it as well. To me personally these two workflows is something that immediately comes to mind when I see that the parameter is a URL or a local path.