Skip to content

Commit 373fca7

Browse files
committed
Simplify a bit the projectile-known-projects API
The new function is the preferred way to access the known projects from client code.
1 parent bb9c773 commit 373fca7

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

projectile.el

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5561,26 +5561,33 @@ An open project is a project with any open buffers."
55615561
(list (abbreviate-file-name project)))
55625562
projects))
55635563

5564-
(defun projectile--init-known-projects ()
5564+
(defun projectile-known-projects ()
55655565
"Initialize the known projects.
55665566
5567-
This might potentially clean up redundant projects
5568-
and discover new ones if `projectile-auto-discover' is enabled."
5567+
This might potentially clean up redundant projects and discover new ones if
5568+
`projectile-auto-cleanup-known-projects' or `projectile-auto-discover' are
5569+
enabled."
55695570
;; load the known projects
55705571
(unless projectile-known-projects
55715572
(projectile-load-known-projects))
55725573
(when projectile-auto-cleanup-known-projects
55735574
(projectile--cleanup-known-projects))
55745575
(when (and projectile-auto-discover projectile-project-search-path)
5575-
(projectile-discover-projects-in-search-path)))
5576+
(projectile-discover-projects-in-search-path))
5577+
;; return the list of known projects
5578+
projectile-known-projects)
5579+
5580+
(defalias 'projectile--init-known-projects 'projectile-known-projects)
55765581

55775582
(defun projectile-relevant-known-projects ()
5578-
"Return a list of known projects."
5579-
(projectile--init-known-projects)
5580-
(pcase projectile-current-project-on-switch
5581-
('remove (projectile--remove-current-project projectile-known-projects))
5582-
('move-to-end (projectile--move-current-project-to-end projectile-known-projects))
5583-
('keep projectile-known-projects)))
5583+
"Return a list of known projects.
5584+
5585+
It factors the value of `projectile-current-project-on-switch'."
5586+
(let ((known-projects (projectile-known-projects)))
5587+
(pcase projectile-current-project-on-switch
5588+
('remove (projectile--remove-current-project known-projects))
5589+
('move-to-end (projectile--move-current-project-to-end known-projects))
5590+
('keep known-projects))))
55845591

55855592
(defun projectile-relevant-open-projects ()
55865593
"Return a list of open projects."

0 commit comments

Comments
 (0)