[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/projectile 55e9026881 2/2: Optimize compilation-find-file-
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/projectile 55e9026881 2/2: Optimize compilation-find-file-projectile-find-compilation-buffer (#1874) |
|
Date: |
Mon, 22 Jan 2024 16:00:48 -0500 (EST) |
branch: elpa/projectile
commit 55e9026881538c126293b7e682d0d147984254f1
Author: Siew Yi Liang <sonictk@gmail.com>
Commit: GitHub <noreply@github.com>
Optimize compilation-find-file-projectile-find-compilation-buffer (#1874)
If the target file already exists, navigate to it directly instead of
running the expensive extra logic.
---
CHANGELOG.md | 1 +
projectile.el | 20 ++++++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b45450c63..56a3b08135 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
### New features
+* [#1874](https://github.com/bbatsov/projectile/pull/1874): Changes
`compilation-find-file-projectile-find-compilation-buffer` to navigate directly
to the file if already present on disk to help improve performance in scenarios
where there are a large number of project directories.
* [#1870](https://github.com/bbatsov/projectile/pull/1870): Add package
command for CMake projects.
* [#1875](https://github.com/bbatsov/projectile/pull/1875): Add support for
Sapling VCS.
* [#1876](https://github.com/bbatsov/projectile/pull/1876): Add support for
Jujutsu VCS.
diff --git a/projectile.el b/projectile.el
index b7f794f9a3..5d030dc957 100644
--- a/projectile.el
+++ b/projectile.el
@@ -5406,14 +5406,18 @@ We enhance its functionality by appending the current
project's directories
to its search path. This way when filenames in compilation buffers can't be
found by compilation's normal logic they are searched for in project
directories."
- (let* ((root (projectile-project-root))
- (compilation-search-path
- (if (projectile-project-p)
- (append compilation-search-path (list root)
- (mapcar (lambda (f) (expand-file-name f root))
- (projectile-current-project-dirs)))
- compilation-search-path)))
- (apply orig-fun `(,marker ,filename ,directory ,@formats))))
+ ; If the file already exists, don't bother running the extra logic as the
project directories might be massive (i.e. Unreal-sized).
+ (if (file-exists-p filename)
+ (apply orig-fun `(,marker ,filename ,directory ,@formats))
+
+ (let* ((root (projectile-project-root))
+ (compilation-search-path
+ (if (projectile-project-p)
+ (append compilation-search-path (list root)
+ (mapcar (lambda (f) (expand-file-name f root))
+ (projectile-current-project-dirs)))
+ compilation-search-path)))
+ (apply orig-fun `(,marker ,filename ,directory ,@formats)))))
(defun projectile-open-projects ()
"Return a list of all open projects.