[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/projectile 71f18add5e 2/2: Check for project-root before a
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/projectile 71f18add5e 2/2: Check for project-root before adding overload |
|
Date: |
Wed, 29 Nov 2023 13:00:53 -0500 (EST) |
branch: elpa/projectile
commit 71f18add5e66201c3ea7c9650b848968db3aec42
Author: Eldritch Cheese <eldritch.cheese@gmail.com>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>
Check for project-root before adding overload
Prior to emacs 28, the `project.el` package did not provide
`project-root`. By providing an overload for `project-root`, any
compatibility checks of `(fboundp 'project-root)` done by other
packages will return true, even for versions that do not have
`project-root`.
Fixes https://github.com/bbatsov/projectile/issues/1868.
---
projectile.el | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/projectile.el b/projectile.el
index b7012780a7..56178d2521 100644
--- a/projectile.el
+++ b/projectile.el
@@ -6163,8 +6163,11 @@ when opening new files."
;; it's safe to require this directly, as it was added in Emacs 25.1
(require 'project)
-(cl-defmethod project-root ((project (head projectile)))
- (cdr project))
+;; Only define an override for project-root if the method exists. For versions
+;; before emacs 28, project.el provided project-roots instead of project.root.
+(if (fboundp 'project-root)
+ (cl-defmethod project-root ((project (head projectile)))
+ (cdr project)))
(cl-defmethod project-files ((project (head projectile)) &optional _dirs)
(let ((root (project-root project)))