GNU bug report logs - #76230
[PATCH] New command 'project-forget-all-projects'

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Wed, 12 Feb 2025 17:08:02 UTC

Severity: wishlist

Tags: patch

To reply to this bug, email your comments to 76230 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Wed, 12 Feb 2025 17:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ship Mints <shipmints <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 12 Feb 2025 17:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] New command 'project-forget-all-projects'
Date: Wed, 12 Feb 2025 12:07:33 -0500
[Message part 1 (text/plain, inline)]
This command prompts to clear all projects. It also calls the new, but
unadvertised, 'project-clear-cache' command after clearing 'project-list'.
The lack of a supported project cache clearing function is something that
has been discussed in the past.

-Stephane
[Message part 2 (text/html, inline)]
[0001-New-command-project-forget-all-projects.patch (application/octet-stream, attachment)]

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 13 Feb 2025 06:56:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Mon, 03 Mar 2025 03:02:03 GMT) Full text and rfc822 format available.

Message #10 received at 76230 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>, 76230 <at> debbugs.gnu.org
Subject: Re: bug#76230: [PATCH] New command 'project-forget-all-projects'
Date: Mon, 3 Mar 2025 05:01:16 +0200
Hi, sorry about the late response.

On 12/02/2025 19:07, Ship Mints wrote:
> This command prompts to clear all projects. It also calls the new, but 
> unadvertised, 'project-clear-cache' command after clearing 'project- 
> list'. The lack of a supported project cache clearing function is 
> something that has been discussed in the past.

> +(defun project-clear-cache ()
> + "Clear the project directory cache."
> + (interactive)
> + (vc-clear-context))

The new command is okay, but the cache clearing lacks an indirection - 
we shouldn't go straight to the project-vc's cache here because that's 
not the only backend that can be used here.

The PoC previously posted in here https://debbugs.gnu.org/72300#26 could 
use some testing (I haven't come up with anything fundamentally better), 
and an improved cache structure will only affect the internal 
implementation.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Wed, 05 Mar 2025 18:53:02 GMT) Full text and rfc822 format available.

Message #13 received at 76230 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76230 <at> debbugs.gnu.org
Subject: Re: bug#76230: [PATCH] New command 'project-forget-all-projects'
Date: Wed, 5 Mar 2025 13:51:53 -0500
[Message part 1 (text/plain, inline)]
On Sun, Mar 2, 2025 at 10:01 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> Hi, sorry about the late response.
>
> On 12/02/2025 19:07, Ship Mints wrote:
> > This command prompts to clear all projects. It also calls the new, but
> > unadvertised, 'project-clear-cache' command after clearing 'project-
> > list'. The lack of a supported project cache clearing function is
> > something that has been discussed in the past.
>
> > +(defun project-clear-cache ()
> > + "Clear the project directory cache."
>  > + (interactive)
>  > + (vc-clear-context))
>
> The new command is okay, but the cache clearing lacks an indirection -
> we shouldn't go straight to the project-vc's cache here because that's
> not the only backend that can be used here.
>
> The PoC previously posted in here https://debbugs.gnu.org/72300#26 could
> use some testing (I haven't come up with anything fundamentally better),
> and an improved cache structure will only affect the internal
> implementation.
>

Right.  We did discuss this a bit back then.  Which of these two less
heavy-handed approaches do you prefer?  Setting the property to nil or
removing it?

(defun project-clear-cache ()
  "Clear the project directory cache."
  (interactive)
  (obarray-map (lambda (ent)
                 (setq ent (symbol-name ent))
                 (when (vc-file-getprop ent 'project-vc)
                   (vc-file-setprop ent 'project-vc nil)))
               vc-file-prop-obarray))

(defun project-clear-cache ()
  "Clear the project directory cache."
  (interactive)
  (let ((ents-to-remove))
    (obarray-map (lambda (ent)
                   (when (vc-file-getprop (symbol-name ent) 'project-vc)
                     (push ent ents-to-remove)))
                 vc-file-prop-obarray)
    (mapc (lambda (ent)
            (obarray-remove vc-file-prop-obarray ent))
          ents-to-remove)))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Thu, 06 Mar 2025 02:57:02 GMT) Full text and rfc822 format available.

Message #16 received at 76230 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 76230 <at> debbugs.gnu.org
Subject: Re: bug#76230: [PATCH] New command 'project-forget-all-projects'
Date: Thu, 6 Mar 2025 04:56:04 +0200
On 05/03/2025 20:51, Ship Mints wrote:
> Right.  We did discuss this a bit back then.  Which of these two less 
> heavy-handed approaches do you prefer?  Setting the property to nil or 
> removing it?

Removing it, I guess. But the function should still be accessed through 
an indirection, so it should be called project-vc-* as it's specific to 
project-vc.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Fri, 07 Mar 2025 00:44:02 GMT) Full text and rfc822 format available.

Message #19 received at 76230 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76230 <at> debbugs.gnu.org
Subject: Re: bug#76230: [PATCH] New command 'project-forget-all-projects'
Date: Thu, 6 Mar 2025 19:43:23 -0500
[Message part 1 (text/plain, inline)]
On Wed, Mar 5, 2025 at 9:56 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 05/03/2025 20:51, Ship Mints wrote:
> > Right.  We did discuss this a bit back then.  Which of these two less
> > heavy-handed approaches do you prefer?  Setting the property to nil or
> > removing it?
>
> Removing it, I guess. But the function should still be accessed through
> an indirection, so it should be called project-vc-* as it's specific to
> project-vc.
>

Agree. Done in the attached patch.

-Stephane
[Message part 2 (text/html, inline)]
[0001-New-commands-project-forget-all-projects-project-vc-.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Mon, 10 Mar 2025 04:21:01 GMT) Full text and rfc822 format available.

Message #22 received at 76230 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 76230 <at> debbugs.gnu.org
Subject: Re: bug#76230: [PATCH] New command 'project-forget-all-projects'
Date: Mon, 10 Mar 2025 06:20:15 +0200
On 07/03/2025 02:43, Ship Mints wrote:
> 
> Agree. Done in the attached patch.

Sorry, like I said, we shouldn't be calling directly a function that 
only services a particular backend (clears its cache only).

See the link in my email earlier in this thread, to a patch that 
implements such an indirection.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76230; Package emacs. (Mon, 10 Mar 2025 18:44:02 GMT) Full text and rfc822 format available.

Message #25 received at 76230 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76230 <at> debbugs.gnu.org
Subject: Re: bug#76230: [PATCH] New command 'project-forget-all-projects'
Date: Mon, 10 Mar 2025 14:43:04 -0400
[Message part 1 (text/plain, inline)]
On Mon, Mar 10, 2025 at 12:20 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 07/03/2025 02:43, Ship Mints wrote:
> >
> > Agree. Done in the attached patch.
>
> Sorry, like I said, we shouldn't be calling directly a function that
> only services a particular backend (clears its cache only).
>
> See the link in my email earlier in this thread, to a patch that
> implements such an indirection.
>

I can try to get back to this tomorrow.  Apologies for me being "thick
headed."  When you say indirection, I didn't catch one in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72300;att=1;filename=project-forget-functions.diff;msg=26
and I'm happy to accommodate whatever design you think is maintainable
especially as I think you want to replace the caching method with something
native to project.el so whatever API there is should survive.

-Stephane
[Message part 2 (text/html, inline)]

This bug report was last modified 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.