From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ship Mints Newsgroups: gmane.emacs.bugs Subject: bug#72300: project.el: detect newly created project contained within another Date: Mon, 5 Aug 2024 13:18:00 -0400 Message-ID: References: <87r0bh8cy7.fsf@gmx.de> <86mslssny9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009e42ba061ef2dc93" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34786"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , Federico Tedin , 72300@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 05 19:20:03 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 1sb1NK-0008u8-Bi for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Aug 2024 19:20:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb1N0-0008NH-Cr; Mon, 05 Aug 2024 13:19:42 -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 1sb1My-0008Mx-7k for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2024 13:19:40 -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 1sb1Mx-00007G-Uz for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2024 13:19:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=bQ2pKuk5gUU65pMDyjaNWW7AjIyGikiNSSCss9rRK/4=; b=AqtNSilfTDEzppEgv/g80zPRd0SnPlIE8RhfnkxwFjI+391rmpAadYBBrqBkvno0LIslH/5+oiq9HNT53FMXTaf7532BfQDIA5Ro76f5qqjO6R5DNjYH2ThM/2Lmsxb+uASXV6XHrOxYEefBdoSGLSlIOt4zVfye4/Q7pRi/YCS2rGtm3gfGCyLOSDUCNFPXzQGwRuTIYlQo9agBeMzyeH/NXfCVHglQbbrPoDkd66MUMHrB2JracbmtqoAndSmYqUR4vVkMvStsg2H7OP5lWqmMiZFC03YfBC9uYtZueauoRs1ecI8buTcIM4x3lPUF5jZ2N5CnP/swAL56DfS5Qw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sb1NK-0005gQ-5h for bug-gnu-emacs@gnu.org; Mon, 05 Aug 2024 13:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Aug 2024 17:20: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.172287838421799 (code B ref 72300); Mon, 05 Aug 2024 17:20:02 +0000 Original-Received: (at 72300) by debbugs.gnu.org; 5 Aug 2024 17:19:44 +0000 Original-Received: from localhost ([127.0.0.1]:59410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sb1N1-0005fW-TH for submit@debbugs.gnu.org; Mon, 05 Aug 2024 13:19:44 -0400 Original-Received: from mail-oo1-f52.google.com ([209.85.161.52]:46166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sb1Mz-0005fC-3A for 72300@debbugs.gnu.org; Mon, 05 Aug 2024 13:19:42 -0400 Original-Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5d5b850d969so6255730eaf.0 for <72300@debbugs.gnu.org>; Mon, 05 Aug 2024 10:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722878292; x=1723483092; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bQ2pKuk5gUU65pMDyjaNWW7AjIyGikiNSSCss9rRK/4=; b=ZxBQ9DZ1SN+70WogTK4GfcGKmAvTiFOPtfwKIrhnxkFOL5Af0NVVDfaQfyVcIiiErd /y8FXQqq1AvYmDU9JVh1kdpfxBeDPDFa0Un6FwZJSqWIszPxy9u5kxT6UDxjHwy19zEY DvVQTY3u3Hu3uccmk0+SMOsYIsPj4JVsXdSrRhdx8uxhUR4sA5oafvCqfqdAAnaIXyAr UA24ZS0WqFhHESs/T+nhKdBr5HaR/LBZJuSgs+feV5Hi6EzyAfhBV4ZnIRelswzDO2E4 oa2wvEJGai+1HkAmGQYD72X4pQYbxP9O074GYuzHpqBdJCIbhqlD0EVlT/msVarfye+t 5plQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722878292; x=1723483092; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bQ2pKuk5gUU65pMDyjaNWW7AjIyGikiNSSCss9rRK/4=; b=w7EO/Ig1MbelEA69/Qt7OjZTyP0pgUxY9f7Nx/O0EcX2tydRLPcQf9uGBbopWqH78d ejpvsWBYjyO1vABL7NUov58KoqHueflWlX6O9NLK6xtANtu2BI5MrkVseLLzzT/3xVJY lGwwQZAGZobEVAqCZVKOjhtg/VAIPY8m/2e4Hf+wAD4a4iBsVLSjv1o+AnELPm1B7qbv sUs6ujmxEB6gaSY0HBUx8llQKeiShhSar4mSQ3VUH9h9uwUrY0w9lLDaIGrrndnRW1D8 VL7JgEB0GH6NsVciWPPq2HSPX4vcfq2OwEc87o5zjagTfOgTDfZZlW+yjeB7CDWLJKeJ HVeQ== X-Forwarded-Encrypted: i=1; AJvYcCWBRjFEYhJW0BGF2/WURRS6cYzzO2UiLc/AR1a4T3mzCNG5xp1BrWkdrc14Z67glyFmG/yyhgTJVFIScnGg5lzOqBnGcCk= X-Gm-Message-State: AOJu0Ywgqam+sHVedo8RgQyn1Qk7XW5oeqC4NglVM0rssp0jTe/D3Spz EKhau2q6Hfg6N3qIpwRETdUuj4sCADPCoh3HaxS1Gr0Bs+uV5WRwq9MwyVQHP+QP1slOLkfneVi 4a2jMaBRfCUTM05K+gwdzvTZxoog= X-Google-Smtp-Source: AGHT+IGVnC7E6arAFzP4s7AbtvfEAeLNqPSUA9xvOwCkr5qN4RaCH4U5ZA0M9L2/aDQc1ev4mtPS4DohXA0qTHFVbII= X-Received: by 2002:a05:6358:b413:b0:1ac:f00d:c8c6 with SMTP id e5c5f4694b2df-1af3bb2a001mr1840218555d.27.1722878292539; Mon, 05 Aug 2024 10:18:12 -0700 (PDT) In-Reply-To: <86mslssny9.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:289800 Archived-At: --0000000000009e42ba061ef2dc93 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This appears to be intentional behavior of project's caching implemented via (vc-file-getprop dir 'project-vc) and (vc-file-setprop dir 'project-vc project) in project-try-vc. There is no facility, public API or private, to clear the cache en-masse. One could reset the cache via clearing the vector vc-file-prop-obarray (setq vc-file-prop-obarray (make-vector 17 0)) in the absence of an API. You can observe what's in your vc-file-prop-obarray for yourself before taking this action. Hope that helps, -Stephane On Sun, Aug 4, 2024 at 4:16=E2=80=AFAM Eli Zaretskii wrote: > > Date: Thu, 25 Jul 2024 21:54:24 +0200 > > From: Federico Tedin via "Bug reports for GNU Emacs, > > the Swiss army knife of text editors" > > > > In Emacs master e56e4b345a2, `emacs -q`: > > > > I'm having problems trying to make project.el detect a new project that > > is contained in the directory of another project. > > > > I have a directory called 'scratch' which contains a '.git' directory, = a > > file 'test.py' and a directory 'foo'. The 'foo' directory contains a > > file called 'foo.py'. > > > > > > ~/scratch/ > > .git/ > > main.py > > foo/ > > foo.py > > > > > > If I open 'main.py', `(project-current)' evals to the expected: `(vc Gi= t > > "~/scratch")'. > > > > If I open 'foo.py', `(project-current)' also evals to `(vc Git > > "~/scratch")', which is expected. > > > > However if now I cd into 'foo/' and run `git init`, then I would expect > > project.el to now consider 'foo.py' to be in another project - `(vc Git > > "~/scratch/foo")'. However, if I evaluate `(project-current)' when > > visiting 'foo.py', I still get `(vc Git "~/scratch")'. > > > > If I kill the buffer visiting 'foo.py' and open the file again, I get > > the same result. > > > > Interestingly, if I run 'M-x project-remember-projects-under' with > > '~/scratch/foo' as path, it does inform me that the new project has bee= n > > found. However visiting 'foo.py` still results in `(vc Git "~/scratch")= ' > > as the current project. > > > > If I restart Emacs then the problem is solved; 'foo.py' is correctly > > filed under project `(vc Git "~/scratch/foo")'. > > > > The fact that this works correctly after restarting makes me think > > that there must be some runtime state set up that is preventing the > > desired behaviour to happen. > > Dmitry, any comments or suggestions? > > > > --0000000000009e42ba061ef2dc93 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
<= font face=3D"monospace">This appears to be intentional behavior of project&= #39;s caching implemented via=C2=A0(vc-file-getprop dir 'project-vc) an= d
(vc-file-setprop dir 'project-vc project) in=C2=A0project-try-vc. T= here is no facility, public API or private, to clear the cache en-masse. On= e could reset the cache via clearing the vector=C2=A0vc-file-prop-obarray (= setq=C2=A0vc-file-prop-obarray (make-vector 17 0)) in the absence of an API= . You can observe what's in your=C2=A0vc-file-prop-obarray for yourself before taking this action.
=
Hope that helps,

-Stephane

On Sun, Aug 4, 2024 = at 4:16=E2=80=AFAM Eli Zaretskii <eliz@g= nu.org> wrote:
> Date: Thu, 25 Jul 2024 21:54:24 +0200
> From:=C2=A0 Federico Tedin via "Bug reports for GNU Emacs,
>=C2=A0 the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> In Emacs master e56e4b345a2, `emacs -q`:
>
> I'm having problems trying to make project.el detect a new project= that
> is contained in the directory of another project.
>
> I have a directory called 'scratch' which contains a '.git= ' directory, a
> file 'test.py' and a directory 'foo'. The 'foo'= ; directory contains a
> file called 'foo.py'.
>
>
> ~/scratch/
>=C2=A0 =C2=A0 =C2=A0.git/
>=C2=A0 =C2=A0 =C2=A0main.py
>=C2=A0 =C2=A0 =C2=A0foo/
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0foo.py
>
>
> If I open 'main.py', `(project-current)' evals to the expe= cted: `(vc Git
> "~/scratch")'.
>
> If I open 'foo.py', `(project-current)' also evals to `(vc= Git
> "~/scratch")', which is expected.
>
> However if now I cd into 'foo/' and run `git init`, then I wou= ld expect
> project.el to now consider 'foo.py' to be in another project -= `(vc Git
> "~/scratch/foo")'. However, if I evaluate `(project-curr= ent)' when
> visiting 'foo.py', I still get `(vc Git "~/scratch")= '.
>
> If I kill the buffer visiting 'foo.py' and open the file again= , I get
> the same result.
>
> Interestingly, if I run 'M-x project-remember-projects-under' = with
> '~/scratch/foo' as path, it does inform me that the new projec= t has been
> found. However visiting 'foo.py` still results in `(vc Git "~= /scratch")'
> as the current project.
>
> If I restart Emacs then the problem is solved; 'foo.py' is cor= rectly
> filed under project `(vc Git "~/scratch/foo")'.
>
> The fact that this works correctly after restarting makes me think
> that there must be some runtime state set up that is preventing the > desired behaviour to happen.

Dmitry, any comments or suggestions?



--0000000000009e42ba061ef2dc93--