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#72300: project.el: detect newly created project contained within another Date: Mon, 30 Sep 2024 04:50:38 +0300 Message-ID: <4ecab405-a03f-4dd7-af4b-f2d29b0420a4@gutov.dev> References: <87r0bh8cy7.fsf@gmx.de> <86mslssny9.fsf@gnu.org> <04986428-27b5-462d-8f89-139cd56ea117@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22731"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 72300@debbugs.gnu.org, Eli Zaretskii , Federico Tedin To: Ship Mints Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 30 05:27:16 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 1sv746-0005jj-Vx for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Sep 2024 05:27:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sv5b7-0007Rq-7T; Sun, 29 Sep 2024 21:53:18 -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 1sv5au-0007Rd-Qt for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2024 21:53:03 -0400 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 1sv5aa-0007IK-DP for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2024 21:52:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=w1ffj0OKI0mggx6Rxv1JkhAjDvpH6apv9m7xR2A4t/U=; b=Irqh3Jnh9biWvU8kWvU54RknGZP4qFbmttxL182tipgw+QmW0xhtW99Q32FDYHh3xgOGwHiNPLH0HaxvgLP2alNavtneWiQpZrgz61hSckwJpYgIf/RHPwcdSg5/s3mQRhMlZeouoQ8QIigoilJIcOI9neoTZ/nD0zHrkG9q//UpZG7s/5tjj308lfelfkB/sDXa1Dj7xtw4+MRH2DGOLT6H/F4tOFZGJP364/MjjYoaJ1ROWp5XUEStMe0rauNi9wCLGLXhCIox5ZDO4ZdrSVeCG5UVw3ogX9FZ2+3Emu/CUjpRRm52FhH7nzGOOSbLoy1DWKCPFmGIe6ngBEzabQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sv5aw-0001hC-68 for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2024 21:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Sep 2024 01:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72300 X-GNU-PR-Package: emacs Original-Received: via spool by 72300-submit@debbugs.gnu.org id=B72300.17276611506356 (code B ref 72300); Mon, 30 Sep 2024 01:53:02 +0000 Original-Received: (at 72300) by debbugs.gnu.org; 30 Sep 2024 01:52:30 +0000 Original-Received: from localhost ([127.0.0.1]:43605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sv5aG-0001di-Ho for submit@debbugs.gnu.org; Sun, 29 Sep 2024 21:52:30 -0400 Original-Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]:55033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sv5ZT-0001XB-Sq for 72300@debbugs.gnu.org; Sun, 29 Sep 2024 21:52:18 -0400 Original-Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id EB70D1140172; Sun, 29 Sep 2024 21:50:42 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Sun, 29 Sep 2024 21:50:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727661042; x=1727747442; bh=w1ffj0OKI0mggx6Rxv1JkhAjDvpH6apv9m7xR2A4t/U=; b= c6qnae5/SAx+WTSW7MU+TSscVg+xH4AXGREnuLepyYNmsRLGz3XupmrlVAJD9J4y RQVqT9JTCMHuJ/utTnrntYMdYkW8lDWHmBhSYBOEDnz0Ma+cYzSsMFERhMi5EriO 9zpaPS3nCDX7W6SK0ueKNBAoUmA4BKnBiCOdG3WD+GFYWroriwnTMNEi8nsxUIyU RzzO23BGvAn3yv8/O6Y3n/QF4/+P93SuyTQdwhkJMAbg191HFPjVaz/Aq5jkUykU qD5GhdU9bXG+TaI0LWN2/wFtX6ejht1eKCQW0RJeBgeCsL42npZOoeNu8c78c6Bg xj5uxRglpf6WyUFAIgPRIQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727661042; x= 1727747442; bh=w1ffj0OKI0mggx6Rxv1JkhAjDvpH6apv9m7xR2A4t/U=; b=N aSydS0gu6E3cUlsKITTgq5aA+eYdfcWeAXknbxFzwRoF43HoM+5Xkm2yLD3QAnBA vGxx42Bend5K+OMoRYrOGf/Y8J0kOT4VCswz1CtzN4fDYzsKOZgpMqrpMGhovIic 4I1qRubl2xE4G4bsYsPKwRO3cowIM8bqOafrcf0qIZMrgAV6p8VA9JwkQ+J/xYB+ znca93DppUE9PfRvomgL6Ci9Hc8Vm40xweLzOnJGSQpmj0OM/AX4x3j/TbBUCSxi KXApxHzzIWiR+R7ZNk6FZ+DnW4gO7qqIQjFo1AyC01RkgR0Ch2ZJTrYDJwo45vXg AI735loxr7rUanrdx2I9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddugedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepgeelfeetkefghfdvhfdtgeevveevteetgeetveeg tedthefhudekteehffeukeeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhhiphhmihhnthhssehgmh grihhlrdgtohhmpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohep fhgvuggvrhhitghothgvughinhesghhmgidruggvpdhrtghpthhtohepjedvfedttdesug gvsggsuhhgshdrghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Sep 2024 21:50:40 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:292688 Archived-At: On 13/08/2024 17:50, Ship Mints wrote: > As some food for thought, we've used git attributes via "git check-attr" > to record custom metadata at the repository level to provide hints to > tooling. As project.el and other tools evolve, perhaps we can consider > the cases where users can supply functions that influence behavior where > one use case is based on things like git attributes. The case in hand is > whether a submodule should be considered external to a project.el > project such as the vendor/third-party submodule I'd mentioned. We use > the default project-vc-merge-submodules t and our exceptions could be > encoded via a custom git attribute and indicated via a predicate > function, perhaps. In the absence of formal guidelines, and git does not > seem to define "reserved words" for naming, we prefix custom attributes > with an underscore. Git attributes is a possible approach, with a downside of extra process calls, which over Tramp (for example) would mean additional latency. How about we just support filtering out submodules using the project-vc-ignores var? Which can be assigned in .dir-locals.el or through other means. I kind of hoped this would work automatically, it does not, but adding the extra comparisons against the list of ignores seems natural enough. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 599a350e5ce..79fcfb65f87 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -720,7 +731,9 @@ project--vc-list-files (let ((sub-files (mapcar (lambda (module) - (when (file-directory-p module) + (when (and (file-directory-p module) + ;; TODO: Support real globs. + (not (member module extra-ignores))) (let ((sub-files (project--vc-list-files (concat default-directory module)