branch: elpa/projectile commit b014d79f5bca2103cf055b27334ad89f007a6ac8 Author: Bozhidar Batsov <bozhi...@batsov.dev> Commit: Bozhidar Batsov <bozhi...@batsov.dev>
Fix version extraction logic --- CHANGELOG.md | 3 ++- projectile.el | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4601edd8f6..a5683df02d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,8 @@ * [#1714](https://github.com/bbatsov/projectile/issues/1714): Fix `projectile-discover-projects-in-directory` not interactive. * [#1734](https://github.com/bbatsov/projectile/pull/1734): Make `projectile--find-matching-test` use `src-dir/test-dir` properties. * [#1750](https://github.com/bbatsov/projectile/issues/1750): Fix source and test directories for Maven projects. -* [#1765](https://github.com/bbatsov/projectile/issues/1765): Fix `src-dir`/`test-dir` not defaulting to `"src/"` and `"test/"` with `projectile-toggle-between-implementation-and-test` +* [#1765](https://github.com/bbatsov/projectile/issues/1765): Fix `src-dir`/`test-dir` not defaulting to `"src/"` and `"test/"` with `projectile-toggle-between-implementation-and-test`. +* Fix version extraction logic. ### Changes diff --git a/projectile.el b/projectile.el index 4330fbf73a..51097ad6c5 100644 --- a/projectile.el +++ b/projectile.el @@ -823,11 +823,17 @@ If the value is nil, there is no limit to the opend buffers count." ;;; Version information -(defconst projectile-version - (eval-when-compile - (lm-version (or load-file-name buffer-file-name))) +(defconst projectile-version "2.6.0-snapshot" "The current version of Projectile.") +(defun projectile--pkg-version () + "Extract Projectile's package version from its package metadata." + ;; Use `cond' below to avoid a compiler unused return value warning + ;; when `package-get-version' returns nil. See #3181. + ;; FIXME: Inline the logic from package-get-version and adapt it + (cond ((fboundp 'package-get-version) + (package-get-version)))) + ;;;###autoload (defun projectile-version (&optional show-version) "Get the Projectile version as string. @@ -842,9 +848,10 @@ If the version number could not be determined, signal an error, if called interactively, or if SHOW-VERSION is non-nil, otherwise just return nil." (interactive (list t)) - (if show-version - (message "Projectile %s" projectile-version) - projectile-version)) + ((let ((version (or (projectile--pkg-version) projectile-version)))) + (if show-version + (message "Projectile %s" version) + version))) ;;; Misc utility functions (defun projectile-difference (list1 list2)