From 4d6c1a16af2c12bc369de7c5e4078cd0281a5271 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 25 Apr 2026 23:29:08 +0100 Subject: Small dirconfig cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- projectile.el | 16 +++++++++++++--- 1 file 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." -- cgit v1.0