Skip to content
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

projectile-project-buffer-p may return incorrect result on Windows #1013

Closed
cshtarkov opened this issue May 30, 2016 · 0 comments
Closed

projectile-project-buffer-p may return incorrect result on Windows #1013

cshtarkov opened this issue May 30, 2016 · 0 comments

Comments

@cshtarkov
Copy link
Contributor

projectile-project-buffer-p indicates whether a buffer is part of the current project. On Windows, it can sometimes (or always?) return a false negative due to path capitalization. This happens because it uses case-sensitive string-prefix-p to check whether the project root is a prefix of the full path to the currently visited file. As a result, functions like helm-projectile and projectile-switch-to-buffer will not let the user switch to a buffer of the same project.

Expected behavior

projectile-project-buffer-p always returns t when a buffer is part of a project.

Actual behavior

It returns nil on Windows.

Steps to reproduce the problem

  1. Create a directory C:\Home.
  2. Create a repository under C:\Home\repo.
  3. Visit a file in that repository.
  4. M-: (projectile-project-buffer-p (current-buffer) (projectile-project-root)

The last step will return nil when it should be t (this buffer is surely part of the project). This happens because in projectile-project-buffer-p, project-root will evaluate to c:/Home/repo/demo.txt, while (file-truename default-directory) will be c:/home/repo/demo.txt.

Environment & Version information

Projectile version information

Projectile version: 20160526.832

Emacs version

GNU Emacs 24.5.1 (x86_64-w64-mingw32)

Operating system

Windows 7

cshtarkov added a commit to cshtarkov/projectile that referenced this issue May 30, 2016
Use case-insensitive comparison on Windows to avoid false negatives.
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

No branches or pull requests

1 participant