-
-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semantic of variable projectile-require-project-root inconsistent with documentation promise. #1659
Comments
The culprit has actually been found : it is the function This function is supposed to return the type of vc repo if any, or none. However, when called without argument and not in a project, it produces the following error :
This is because, according to its implementation : (defun projectile-project-vcs (&optional project-root)
"Determine the VCS used by the project if any.
PROJECT-ROOT is the targeted directory. If nil, use
`projectile-project-root'."
(or project-root (setq project-root (projectile-project-root)))
(cond
;; first we check for a VCS marker in the project root itself
((projectile-file-exists-p (expand-file-name ".git" project-root)) 'git)
((projectile-file-exists-p (expand-file-name ".hg" project-root)) 'hg)
((projectile-file-exists-p (expand-file-name ".fslckout" project-root)) 'fossil)
((projectile-file-exists-p (expand-file-name "_FOSSIL_" project-root)) 'fossil)
((projectile-file-exists-p (expand-file-name ".bzr" project-root)) 'bzr)
((projectile-file-exists-p (expand-file-name "_darcs" project-root)) 'darcs)
((projectile-file-exists-p (expand-file-name ".svn" project-root)) 'svn)
;; then we check if there's a VCS marker up the directory tree
;; that covers the case when a project is part of a multi-project repository
;; in those cases you can still the VCS to get a list of files for
;; the project in question
((projectile-locate-dominating-file project-root ".git") 'git)
((projectile-locate-dominating-file project-root ".hg") 'hg)
((projectile-locate-dominating-file project-root ".fslckout") 'fossil)
((projectile-locate-dominating-file project-root "_FOSSIL_") 'fossil)
((projectile-locate-dominating-file project-root ".bzr") 'bzr)
((projectile-locate-dominating-file project-root "_darcs") 'darcs)
((projectile-locate-dominating-file project-root ".svn") 'svn)
(t 'none))) If called without argument, it tries to find the root-project by using the function For I propose to replace
I don't think this replacement breaks anything. If we list all the callers of function
I am therefore convinced that this change would not break anything, but repair 4 functions. If you agree, I can prepare the trivial PR. Best, Aymeric Agon-Rambosson |
Thanks for looking into this, I'll update it myself now. |
According to the documentation of variable
projectile-require-project-root
, we have :We interpret : "will work anywhere as if it were in a project by making the current directory the project root if necessary".
So we set :
And we try
projectile-grep
in the home directory.Expected behavior
To work by providing a grep buffer.
Actual behavior
Does not produce anything, produces following error :
Steps to reproduce the problem
And
(projectile-grep)
in the home directory (any directory that is not a project, in fact) (projectile-ag
fails as well FYI).Environment & Version information
Projectile version information
Emacs version
GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2020-11-08, modified by Debian
Operating system
Debian Testing
The text was updated successfully, but these errors were encountered: