Skip to content

Commit

Permalink
[#1183] Speed up projectile-verify-file
Browse files Browse the repository at this point in the history
It was implemented in terms of wildcard expansion just to handle
cabal projects. Now the cabal project detection simply uses a
different function.
  • Loading branch information
bbatsov committed Jan 18, 2018
1 parent 480bf47 commit d25d8ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions projectile.el
Expand Up @@ -2276,7 +2276,7 @@ TEST-DIR which specifies the path to the tests relative to the project root."

(defun projectile-cabal-project-p ()
"Check if a project contains *.cabal files but no stack.yaml file."
(and (projectile-verify-file "*.cabal")
(and (projectile-verify-file-wildcard "*.cabal")
(not (projectile-verify-file "stack.yaml"))))

(defun projectile-go-project-p ()
Expand Down Expand Up @@ -2441,9 +2441,13 @@ The project type is cached for improved performance."

(defun projectile-verify-files (files)
"Check whether all FILES exist in the current project."
(cl-every 'projectile-verify-file files))
(cl-every #'projectile-verify-file files))

(defun projectile-verify-file (file)
"Check whether FILE exists in the current project."
(file-exists-p (projectile-expand-root file)))

(defun projectile-verify-file-wildcard (file)
"Check whether FILE exists in the current project.
Expands wildcards using `file-expand-wildcards' before checking."
(file-expand-wildcards (projectile-expand-root file)))
Expand Down

0 comments on commit d25d8ca

Please sign in to comment.