From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#41572: 28.0.50; [PATCH] Support plain project marked with file .emacs-project Date: Wed, 30 Nov 2022 22:43:59 +0200 Message-ID: <70b78ec2-c74a-b4fc-a928-bbc1f2c567d5@yandex.ru> References: <871riitzch.fsf@gnus.org> <9781acc2-e4c0-b53c-6422-ef2e0a96f400@yandex.ru> <83sfi6tavq.fsf@gnu.org> <83mt8dssdn.fsf@gnu.org> <29c1c5f3-b189-ff30-c5bc-92a4d35e0683@yandex.ru> <83fse4rj2s.fsf@gnu.org> <2bc8b5dd-83c9-8bbc-82d5-e296f60e47c3@yandex.ru> <83lenwpj5k.fsf@gnu.org> <83fse4pctt.fsf@gnu.org> <8335a3p9xy.fsf@gnu.org> <62aab865-7c71-8c12-9e51-688f588b1e51@yandex.ru> <83lenvnrgs.fsf@gnu.org> <83a64bnngm.fsf@gnu.org> <834jujnhtr.fsf@gnu.org> <14c44382-1c57-4c09-d9ae-7991b8296572@yandex.ru> <83edtklge2.fsf@gnu.org> <162e7230-8295-884f-6ed0-04920b8b5325@yandex.ru> <83wn7ci3ok.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34216"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: philipk@posteo.net, rudi@constantly.at, eric@ericabrahamsen.net, cjpeople2013@gmail.com, theo@thornhill.no, mardani29@yahoo.es, joaotavora@gmail.com, manuel.uberti@inventati.org, juri@linkov.net, salutis@me.com, arstoffel@gmail.com, 41572@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 30 21:45:27 2022 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 1p0TxO-0008fO-Lf for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Nov 2022 21:45:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0Tx4-0005QA-1h; Wed, 30 Nov 2022 15:45:06 -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 1p0Tx0-0005Ph-Sv for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 15:45:02 -0500 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 1p0Tx0-0003QK-JG for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 15:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0Twz-0005SR-Ok for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 15:45:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Nov 2022 20:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41572 X-GNU-PR-Package: emacs Original-Received: via spool by 41572-submit@debbugs.gnu.org id=B41572.166984105220950 (code B ref 41572); Wed, 30 Nov 2022 20:45:01 +0000 Original-Received: (at 41572) by debbugs.gnu.org; 30 Nov 2022 20:44:12 +0000 Original-Received: from localhost ([127.0.0.1]:34999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0TwB-0005Rq-Kw for submit@debbugs.gnu.org; Wed, 30 Nov 2022 15:44:12 -0500 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:38805) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0Tw9-0005Rk-K5 for 41572@debbugs.gnu.org; Wed, 30 Nov 2022 15:44:10 -0500 Original-Received: by mail-wr1-f47.google.com with SMTP id f18so6973097wrj.5 for <41572@debbugs.gnu.org>; Wed, 30 Nov 2022 12:44:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=tixdR0I/Qn9iWcg4LDBEG3dBaAPp4P1uj5vgOTFGVYo=; b=XPzt5OarCgFJn9/yiWaE13tFzCeOPO5bkgLKYuVg5rW8DYy34tzIIUVBu0tfDQO36h 0XjyiMo4diWMASEb+d1rFrb49qzaGwkI6nMsrea2SQZ973mqYT4dE9oif1Qjc4/vQmrk g7vQwIIL4auNlNuVmPFlQXgpZ5PjXp3NFm32JNlYO3k13fkelh6WhTSxAcUvx/lcfBNB Ll9NhXT6n2tyJEehZMN/I9yJqT5pp7LAUwKufJaL/brJ4PT6J3h5UkJLtR+UsTKKiPlp gUM2WAIE3vFy+/pfJvHoIr6K7o7HefktkFnxpmV37fOjgCaKyabZGP7OvQ3hI/6uzwfE x4oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tixdR0I/Qn9iWcg4LDBEG3dBaAPp4P1uj5vgOTFGVYo=; b=KcNyeuto462wuA+R8RmY463x1xvCor5A9qH73ZtD0BILzAgPjlQydOGSEkag1o04Nj qfOF6tHrrA/34cy9enBuwJGmfNoRmpnR1l6zIuZFqdSoSLRXOoxA0uKfZQati1hHoAVS uxmKsqXipURdVF6ZfgJzlSZr3UNOVCSsFfXDEaf0c5godZaPu2PBQfFy0Qn26wa8h1g+ kbiRtRgkg9DsCtoFKLt7T0UO3wf6HxA9W7XYw+juS+xlDNUPkmmLymuNvjVpPf35VvBW 4A2tHhGR7Fb8VHiVccySARsjIn8ZYcH3v4oT9kJ6+zIEV6grN4DpIFv9U9mvZZOx3dk6 4F+g== X-Gm-Message-State: ANoB5pnYzTnefSn2YouPjqe2csG2SkbG55mEpwJ0Kk8sQUpwWeuFMAVD YohvL2ZqWSu2/3gEFvFJ/GY= X-Google-Smtp-Source: AA0mqf4sTB6HwrvMklxtiXdaSQb82tm85uohzJUITVsLK8yibV9VZlrO4tIlGEl7/FYj9YYdJHHILw== X-Received: by 2002:adf:f443:0:b0:242:eb1:5b78 with SMTP id f3-20020adff443000000b002420eb15b78mr13023976wrp.158.1669841043650; Wed, 30 Nov 2022 12:44:03 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id c14-20020a05600c0a4e00b003cffd3c3d6csm3080104wmq.12.2022.11.30.12.44.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Nov 2022 12:44:03 -0800 (PST) Content-Language: en-US In-Reply-To: <83wn7ci3ok.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:249572 Archived-At: On 30/11/2022 22:32, Eli Zaretskii wrote: >> Date: Wed, 30 Nov 2022 20:52:32 +0200 >> Cc: philipk@posteo.net, rudi@constantly.at, eric@ericabrahamsen.net, >> cjpeople2013@gmail.com, theo@thornhill.no, mardani29@yahoo.es, >> joaotavora@gmail.com, manuel.uberti@inventati.org, juri@linkov.net, >> salutis@me.com, arstoffel@gmail.com, 41572@debbugs.gnu.org >> From: Dmitry Gutov >> >>>> Eli, what do you think about this feature >>>> (project-vc-extra-root-markers) for emacs-29? >>> Where can I see the code that you are proposing? >> >> Here you go, I also added some documentation updates and 2 tests. > > Thanks. But I don't see any tests... Sorry, missed them in this patch. They don't really need an advance review, though, so just see them later. >> +;; If the repository is using any other VCS than Git or Hg, the file >> +;; listing uses the default mechanism based on 'find'. > > Instead of a literal 'find', this should probably say something like > > If the repository is using any other VCS than Git or Hg, the file > listing uses the default mechanism based on the program specified by > `find-program'. Sure, thanks. >> (defun project-try-vc (dir) >> + (defvar vc-svn-admin-directory) >> + (require 'vc-svn) >> + ;; FIXME: Learn to invalidate when the value of >> + ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers' >> + ;; changes. >> (or (vc-file-getprop dir 'project-vc) >> - (let* ((backend (ignore-errors (vc-responsible-backend dir))) >> + (let* ((backend-markers-alist `((Git . ".git") >> + (Hg . ".hg") >> + (Bzr . ".bzr") >> + (SVN . ,vc-svn-admin-directory) >> + (DARCS . "_darcs") >> + (Fossil . ".fslckout"))) >> + (backend-markers >> + (delete >> + nil >> + (mapcar >> + (lambda (b) (assoc-default b backend-markers-alist)) >> + vc-handled-backends))) >> + (marker-re >> + (mapconcat >> + (lambda (m) (format "\\(%s\\)" (wildcard-to-regexp m))) >> + (append backend-markers project-vc-extra-root-markers) >> + "\\|")) >> + (locate-dominating-stop-dir-regexp >> + (or vc-ignore-dir-regexp locate-dominating-stop-dir-regexp)) >> + last-matches >> (root >> - (pcase backend >> - ('Git >> - ;; Don't stop at submodule boundary. >> - (or (vc-file-getprop dir 'project-git-root) >> - (let ((root (vc-call-backend backend 'root dir))) >> - (vc-file-setprop >> - dir 'project-git-root >> - (if (and >> - ;; FIXME: Invalidate the cache when the value >> - ;; of this variable changes. >> - project-vc-merge-submodules >> - (project--submodule-p root)) >> - (let* ((parent (file-name-directory >> - (directory-file-name root)))) >> - (vc-call-backend backend 'root parent)) >> - root))))) >> - ('nil nil) >> - (_ (ignore-errors (vc-call-backend backend 'root dir))))) >> + (locate-dominating-file >> + dir >> + (lambda (d) >> + (setq last-matches (directory-files d nil marker-re t 100))))) >> + (backend >> + (cl-find-if >> + (lambda (b) >> + (member (assoc-default b backend-markers-alist) >> + last-matches)) >> + vc-handled-backends)) >> project) >> + (when (and >> + (eq backend 'Git) >> + project-vc-merge-submodules >> + (project--submodule-p root)) >> + (let* ((parent (file-name-directory (directory-file-name root)))) >> + (setq root (vc-call-backend 'Git 'root parent)))) >> (when root >> (setq project (list 'vc backend root)) >> ;; FIXME: Cache for a shorter time. > > This is a significant change of the implementation of a public API. Isn't > it risky to make such changes on the release branch? > > But if you are okay with that, it's fine by me. A little bit, yeah. But I've done some dogfooding, and we have a couple of months before the release, right?