On Sun, Mar 2, 2025 at 10:01 PM Dmitry Gutov 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)))