summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package-vc.el18
1 files changed, 7 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index dd23247974f..faebd6ad6c9 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -276,17 +276,13 @@ asynchronously."
(defun package-vc-version (pkg)
"Extract the commit of a development package PKG."
(cl-assert (package-vc-p pkg))
- (cl-loop with dir = (package-desc-dir pkg) ;FIXME: dir is nil
- for file in (sort (directory-files dir t "\\.el\\'")
- (lambda (s1 s2)
- (< (length s1) (length s2))))
- when (with-temp-buffer
- (insert-file-contents file)
- (package-strip-rcs-id
- (or (lm-header "package-version")
- (lm-header "version"))))
- return it
- finally return "0"))
+ (if-let ((main-file (package-vc-main-file pkg)))
+ (with-temp-buffer
+ (insert-file-contents main-file)
+ (package-strip-rcs-id
+ (or (lm-header "package-version")
+ (lm-header "version"))))
+ "0"))
(defun package-vc-main-file (pkg-desc)
"Return the main file for PKG-DESC."