all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ship Mints <shipmints@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Dmitry Gutov <dmitry@gutov.dev>,
	Federico Tedin <federicotedin@gmx.de>,
	72300@debbugs.gnu.org
Subject: bug#72300: project.el: detect newly created project contained within another
Date: Mon, 5 Aug 2024 13:18:00 -0400	[thread overview]
Message-ID: <CAN+1HbpB28NpJK3EQzyCzupufP5KjQCCOoRUVuHBFQZQWWyRPQ@mail.gmail.com> (raw)
In-Reply-To: <86mslssny9.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2481 bytes --]

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 AM Eli Zaretskii <eliz@gnu.org> 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" <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/
> >     .git/
> >     main.py
> >     foo/
> >         foo.py
> >
> >
> > If I open 'main.py', `(project-current)' evals to the expected: `(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 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 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 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?
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3827 bytes --]

  reply	other threads:[~2024-08-05 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25 19:54 bug#72300: project.el: detect newly created project contained within another Federico Tedin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-04  8:15 ` Eli Zaretskii
2024-08-05 17:18   ` Ship Mints [this message]
2024-08-05 19:56     ` Federico Tedin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-13  1:43     ` Dmitry Gutov
2024-08-13 13:31       ` Ship Mints
2024-08-13 14:50         ` Ship Mints

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN+1HbpB28NpJK3EQzyCzupufP5KjQCCOoRUVuHBFQZQWWyRPQ@mail.gmail.com \
    --to=shipmints@gmail.com \
    --cc=72300@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=federicotedin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.