Skip to content

Conversation

@sunlin7
Copy link
Contributor

@sunlin7 sunlin7 commented May 23, 2025

Use the function (projectile-known-projects) to replace the function (projectile-relevant-known-projects) for correctly getting the project list.

This patch will:

  1. don't active the projectile-mode in spacemacs-buffer
  2. just load the projects by projectile function projectile-known-projects which was introduced in the commit bbatsov/projectile@373fca7.

The projectile is part of +distributions/spacemacs/:


And it's activated in the function spacemacs-project/init-projectile.

The projectile-mode is NOT part of +distributions/spacemacs-base/:

(configuration-layer/declare-layers '(spacemacs-defaults))

But it was activated in the (spacemacs-buffer//insert-projects) even user selected the spacemacs-base as dotspacemacs-distribution.

@bcc32 bcc32 changed the title [core] Load the projects without active projectile-mode [core] Load the projects without enabling projectile-mode May 27, 2025
@bcc32
Copy link
Collaborator

bcc32 commented May 27, 2025

I'm not currently at my personal computer to test this, but:

If the user has selected spacemacs-base as the distribution, without enabling the spacemacs-project layer... is projectile even installed? In that case, won't the spacemacs-buffer trigger an error?

If the above is correct, I feel like the better solution would be to skip the calls to projectile-known-projects rather than attempting to autoload it.

@sunlin7
Copy link
Contributor Author

sunlin7 commented May 27, 2025

@bcc32 Thanks for the comment. The projectile will be installed as dependency of helm-porjectile and treemacs-projectile, which are from the default value of dotspacemacs-configuration-layers included the helm and treemacs.

If remove the helm and treemacs from layers, the spacemacs-base will not going to install the projectile.

Keep project list on Spacemacs startup buffer will provide consistent user experience.

@sunlin7 sunlin7 force-pushed the enhance-projectile branch from a84972b to e3ebddd Compare May 27, 2025 21:22
@bcc32
Copy link
Collaborator

bcc32 commented May 27, 2025

I think if a user has gone out of their way to exclude the spacemacs-project layer, they are saying they don't want projectile-mode at all. In that case, installing/loading it anyway seems unhelpful.

@bcc32
Copy link
Collaborator

bcc32 commented May 27, 2025

And it would be nice to take this opportunity to support Spacemacs starting up properly without projectile installed at all (e.g., if the user wants to exclude it in their dotfile)

@sunlin7 sunlin7 changed the title [core] Load the projects without enabling projectile-mode [core] Load the projects list without activating the projectile-mode May 27, 2025
@sunlin7 sunlin7 force-pushed the enhance-projectile branch from e3ebddd to a84972b Compare May 27, 2025 21:49
@sunlin7
Copy link
Contributor Author

sunlin7 commented May 27, 2025

@bcc32
The key point is, original function (projectile-relevant-known-projects) has two issue here:

  1. will remove the project for current directory from the project list
  2. require the projectile-mode to be enabled on the spacemacs-buffer.

This PR will use the function (projectile-known-projects) which just load the project list without side effects.

@sunlin7
Copy link
Contributor Author

sunlin7 commented May 27, 2025

Got your points, mark this PR as draft first, will enhance it towards the comments.

@sunlin7 sunlin7 marked this pull request as draft May 27, 2025 22:31
@sunlin7
Copy link
Contributor Author

sunlin7 commented May 28, 2025

@bcc32
It works without projectile package after setting the dotspacemacs-distribution 'spacemacs-base and dotspacemacs-configuration-layers '(). I confirmed on my local.

Before calling projectile function, it will detect projectile feature by (fboundp 'projectile-mode) on these lines:

((eq el 'recents) (spacemacs-buffer//insert-recent-files list-size))
((and (eq el 'recents-by-project)
(fboundp 'projectile-mode))
(spacemacs-buffer//insert-recent-files-by-project list-size))

((eq el 'bookmarks) (spacemacs-buffer//insert-bookmarks list-size))
((and (eq el 'projects)
(fboundp 'projectile-mode))
(spacemacs-buffer//insert-projects list-size)))))))

So the changes works for projectile exists or projectile not exists cases.

@sunlin7 sunlin7 marked this pull request as ready for review May 28, 2025 00:43
@bcc32
Copy link
Collaborator

bcc32 commented May 30, 2025

Got it, thank you for explaning.

@bcc32 bcc32 merged commit cbb4b17 into syl20bnr:develop May 30, 2025
6 of 7 checks passed
@sunlin7
Copy link
Contributor Author

sunlin7 commented May 30, 2025

Thank you!

liarchgh pushed a commit to liarchgh/spacemacs that referenced this pull request Sep 3, 2025
…yl20bnr#17006)

* [core] Load the projects without active projectile-mode

* [core] Avoid byte-compilation warning about unknown function

---------

Co-authored-by: Aaron L. Zeng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants