aboutsummaryrefslogtreecommitdiff
path: root/projectile.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@toptal.com>2026-04-25 23:29:08 +0100
committerBozhidar Batsov <bozhidar@toptal.com>2026-04-25 23:29:08 +0100
commit4d6c1a16af2c12bc369de7c5e4078cd0281a5271 (patch)
tree535e740dea50d8dfc23a052b6835a7b60696e270 /projectile.el
parent0dc5b507231e8ad53a0ce925471111dda89cff4d (diff)
Small dirconfig cleanupsdirconfig-polish
- projectile-get-project-directories: replace the (or keep '("")) trick with an explicit (if keep ... (list project-dir)). The behavior is unchanged but the empty-keep case no longer reads as a string-concat with the empty string. - projectile-dirconfig-file: expand the docstring to spell out the dual marker/config role — empty file is enough to mark a project, non-empty content drives parsing.
Diffstat (limited to 'projectile.el')
-rw-r--r--projectile.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/projectile.el b/projectile.el
index a7c505d..cd3ea2a 100644
--- a/projectile.el
+++ b/projectile.el
@@ -389,6 +389,13 @@ algorithm."
(defcustom projectile-dirconfig-file
".projectile"
"The file which serves both as a project marker and configuration file.
+
+The mere presence of this file in a directory marks that directory
+as a Projectile project root, even when the file is empty. When
+the file has content, it is parsed by `projectile-parse-dirconfig-file'
+to drive `+' keep / `-' ignore / `!' ensure rules; see the manual
+for the full format.
+
This should _not_ be set via .dir-locals.el."
:group 'projectile
:type 'file
@@ -1535,11 +1542,14 @@ If PROJECT is not specified acts on the current project."
;;; Project indexing
(defun projectile-get-project-directories (project-dir)
- "Get the list of PROJECT-DIR directories that are of interest to the user."
+ "Get the list of PROJECT-DIR directories that are of interest to the user.
+When the dirconfig file has no `+' keep entries, return a single-
+element list with PROJECT-DIR itself."
(let* ((cfg (projectile-parse-dirconfig-file))
(keep (and cfg (projectile-dirconfig-keep cfg))))
- (mapcar (lambda (subdir) (concat project-dir subdir))
- (or keep '("")))))
+ (if keep
+ (mapcar (lambda (subdir) (concat project-dir subdir)) keep)
+ (list project-dir))))
(defun projectile--directory-p (directory)
"Checks if DIRECTORY is a string designating a valid directory."