Skip to content

Commit aca7981

Browse files
committed
fix(project): proper convention to forget remote zombie projects
1 parent 3267853 commit aca7981

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

core/me-builtin.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ or file path may exist now."
264264
:straight t
265265
:after minemacs-loaded
266266
:demand t
267-
:hook (kill-emacs . project-forget-zombie-projects)
267+
:hook (kill-emacs . +project-forget-zombie-projects)
268268
:custom
269269
(project-list-file (concat minemacs-local-dir "project-list.el"))
270270
(project-vc-extra-root-markers '(".projectile.el" ".project.el" ".project")))

core/me-keybindings.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
"prC" #'project-async-shell-command
241241
;; forget
242242
"pF" '(nil :wk "forget/cleanup")
243-
"pFz" #'project-forget-zombie-projects
243+
"pFz" #'+project-forget-zombie-projects
244244
"pFp" #'project-forget-project
245245
"pFu" #'project-forget-projects-under
246246
"pFc" #'+project-list-cleanup

core/me-lib.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,18 @@ When DIR is not detected as a project, ask to force it to be by adding a
16091609
(with-temp-buffer
16101610
(write-file (expand-file-name ".project.el" dir)))))
16111611

1612+
(defun +project-forget-zombie-projects ()
1613+
"Forget all known projects that don't exist any more.
1614+
1615+
Like `project-forget-zombie-projects', but handles remote projects differently,
1616+
it forget them only when we are sure they don't exist."
1617+
(interactive)
1618+
(dolist (proj (project-known-project-roots))
1619+
(unless (or (and (file-remote-p proj nil t) (file-readable-p proj)) ; Connected remote + existent project
1620+
(file-remote-p proj) ; Non connected remote project
1621+
(file-exists-p proj)) ; Existent local project
1622+
(project-forget-project proj))))
1623+
16121624
(defun +project-gdb ()
16131625
"Invoke `gdb' in the project's root."
16141626
(interactive)

0 commit comments

Comments
 (0)