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

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

[nongnu] elpa/projectile 31b87151b1 2/2: Obey `projectile-project-test-d


From: ELPA Syncer
Subject: [nongnu] elpa/projectile 31b87151b1 2/2: Obey `projectile-project-test-dir` (and similarly for src dir) when toggling between impl and test (#1840)
Date: Tue, 6 Jun 2023 04:01:13 -0400 (EDT)

branch: elpa/projectile
commit 31b87151b1fe43221736ded957a1123a54e32531
Author: Len Trigg <len@realtimegenomics.com>
Commit: GitHub <noreply@github.com>

    Obey `projectile-project-test-dir` (and similarly for src dir) when 
toggling between impl and test (#1840)
---
 CHANGELOG.md  |  1 +
 projectile.el | 14 ++++++--------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e42d8ac656..5d6f7c6523 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@
 
 ### Changes
 
+* [#1839](https://github.com/bbatsov/projectile/issues/1839): Ensure 
`projectile-toggle-between-implementation-and-test` also obeys 
`projectile-project-test-dir` and `projectile-project-src-dir`.
 * [#1285](https://github.com/bbatsov/projectile/pull/1825): By default, use 
[fd](https://github.com/sharkdp/fd) in Git repositories instead of `git 
ls-files` when it is installed, in order to solve the problem where deleted 
files were still shown in `projectile-find-file` until their deletions were 
staged. The user-facing behavior should be the same, although potentially with 
different performance characteristics in large Git repositories. The old 
behavior can be reclaimed by setting `pr [...]
 * [#1831](https://github.com/bbatsov/projectile/issues/1831): Enable the 
project.el integration only when `projectile-mode` is active.
 * [#1847](https://github.com/bbatsov/projectile/issues/1847): Use literal 
directory name casing when toggling between impl and test.
diff --git a/projectile.el b/projectile.el
index 31ba699341..501cc4e02d 100644
--- a/projectile.el
+++ b/projectile.el
@@ -3675,8 +3675,8 @@ string) are replaced with the current project type's 
src-dir property
 
 Nil is returned if either the src-dir or test-dir properties are not strings."
   (let* ((project-type (projectile-project-type))
-         (test-dir (projectile-project-type-attribute project-type 'test-dir))
-         (impl-dir (projectile-project-type-attribute project-type 'src-dir)))
+         (test-dir (projectile-test-directory project-type))
+         (impl-dir (projectile-src-directory project-type)))
     (when (and (stringp test-dir) (stringp impl-dir))
       (if (not (string-match-p test-dir (file-name-directory test-dir-path)))
           (error "Attempted to find a implementation file by switching this 
project type's (%s) test-dir property \"%s\" with this project type's src-dir 
property \"%s\", but %s does not contain \"%s\""
@@ -3732,8 +3732,8 @@ signalled.
 
 Nil is returned if either the src-dir or test-dir properties are not strings."
   (let* ((project-type (projectile-project-type))
-         (test-dir (projectile-project-type-attribute project-type 'test-dir))
-         (impl-dir (projectile-project-type-attribute project-type 'src-dir)))
+         (test-dir (projectile-test-directory project-type))
+         (impl-dir (projectile-src-directory project-type)))
     (when (and (stringp test-dir) (stringp impl-dir))
       (if (not (string-match-p impl-dir (file-name-directory impl-dir-path)))
           (error "Attempted to find a test file by switching this project 
type's (%s) src-dir property \"%s\" with this project type's test-dir property 
\"%s\", but %s does not contain \"%s\""
@@ -3846,14 +3846,12 @@ Fallback to DEFAULT-VALUE for missing attributes."
 (defun projectile-src-directory (project-type)
   "Find default src directory based on PROJECT-TYPE."
   (or projectile-project-src-dir
-      (projectile-project-type-attribute
-       project-type 'src-dir projectile-default-src-directory)))
+      (projectile-project-type-attribute project-type 'src-dir)))
 
 (defun projectile-test-directory (project-type)
   "Find default test directory based on PROJECT-TYPE."
   (or projectile-project-test-dir
-      (projectile-project-type-attribute
-       project-type 'test-dir projectile-default-test-directory)))
+      (projectile-project-type-attribute project-type 'test-dir)))
 
 (defun projectile-dirname-matching-count (a b)
   "Count matching dirnames ascending file paths in A and B."



reply via email to

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