emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/projectile 1ca2303eaa 2/2: Make .projectile customizable


From: ELPA Syncer
Subject: [nongnu] elpa/projectile 1ca2303eaa 2/2: Make .projectile customizable
Date: Sat, 12 Nov 2022 04:59:09 -0500 (EST)

branch: elpa/projectile
commit 1ca2303eaa60abc3fda94bd54572a2a5f1ce7c16
Author: Greg Pfeil <greg@technomadic.org>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>

    Make .projectile customizable
    
    Introduces a variable, `projectile-dirconfig-file` specifying the name of 
the
    file used by Projectile to explicitly mark project roots. The default is
    “.projectile”.
    
    One use case for this is if you group project-local configs in an XDG-style
    location. E.g., setting it to “.config/projectile”.
---
 CHANGELOG.md  |  1 +
 projectile.el | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 771475815c..1145b86cc3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
 * [#1591](https://github.com/bbatsov/projectile/issues/1591): Add `project.el` 
integration that will make Projectile the default provider for project lookup.
 * Add new command `projectile-find-references` (bound to `C-c C-p ?` and `C-c 
C-p s x`).
 * [#1737](https://github.com/bbatsov/projectile/pull/1737): Add helpers for 
`dir-local-variables` for 3rd party use. Functions 
`projectile-add-dir-local-variable` and `projectile-delete-dir-local-variable` 
wrap their built-in counterparts. They always use `.dir-locals.el` from the 
root of the current Projectile project.
+* Add a new defcustom (`projectile-dirconfig-file`) controlling the name of 
the file used as Projectile’s root marker and configuration file.
 
 ### Bug fixed
 
diff --git a/projectile.el b/projectile.el
index b409ebded7..db275a1f40 100644
--- a/projectile.el
+++ b/projectile.el
@@ -361,9 +361,17 @@ algorithm."
   :group 'projectile
   :type '(repeat function))
 
+(defcustom projectile-dirconfig-file
+  ".projectile"
+  "The file which serves both as a project marker and configuration file.
+This should _not_ be set via .dir-locals.el."
+  :group 'projectile
+  :type 'file
+  :package-version '(projectile . "2.7.0"))
+
 (defcustom projectile-dirconfig-comment-prefix
   nil
-  "Projectile config file (.projectile) comment start marker.
+  "`projectile-dirconfig-file` comment start marker.
 If specified, starting a line in a project's .projectile file with this
 character marks that line as a comment instead of a pattern.
 Similar to '#' in .gitignore files."
@@ -1200,8 +1208,8 @@ Return the first (topmost) matched directory or nil if 
not found."
                  (or list projectile-project-root-files)))))
 
 (defun projectile-root-marked (dir)
-  "Identify a project root in DIR by search for a .projectile file."
-  (projectile-root-bottom-up dir '(".projectile")))
+  "Identify a project root in DIR by search for `projectile-dirconfig-file`."
+  (projectile-root-bottom-up dir (list projectile-dirconfig-file)))
 
 (defun projectile-root-bottom-up (dir &optional list)
   "Identify a project root in DIR by bottom-up search for files in LIST.
@@ -1950,7 +1958,7 @@ Unignored files/directories are not included."
 
 (defun projectile-dirconfig-file ()
   "Return the absolute path to the project's dirconfig file."
-  (expand-file-name ".projectile" (projectile-project-root)))
+  (expand-file-name projectile-dirconfig-file (projectile-project-root)))
 
 (defun projectile-parse-dirconfig-file ()
   "Parse project ignore file and return directories to ignore and keep.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]