GNU bug report logs -
#76230
[PATCH] New command 'project-forget-all-projects'
Previous Next
Full log
View this message in rfc822 format
[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)]
This bug report was last modified 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.