branch: scratch/editorconfig-cc
commit 212157a779cf637df004076754c8a1c3d30f975b
Author: 10sr <8.slas...@gmail.com>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    Make -version print packaging version
---
 editorconfig.el | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index aa712cb0d7..bc4bca211b 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -595,15 +595,27 @@ To disable EditorConfig in some buffers, modify
 If called interactively or if SHOW-VERSION is non-nil, show the
 version in the echo area and the messages buffer."
   (interactive (list t))
-  (with-temp-buffer
-    (require 'find-func)
-    (insert-file-contents (find-library-name "editorconfig"))
-    (require 'lisp-mnt)
-    (let ((version (lm-version)))
-      (when show-version
+  (let* ((version
+          (with-temp-buffer
+            (require 'find-func)
+            (insert-file-contents (find-library-name "editorconfig"))
+            (require 'lisp-mnt)
+            (lm-version)))
+         (pkg
+          (and (require 'package nil t)
+               (cadr (assq 'editorconfig
+                           package-alist))))
+         (pkg-version
+          (and pkg
+               (package-version-join (package-desc-version pkg)))))
+    (when show-version
+      (if pkg-version
+          (message "EditorConfig Emacs: v%s  (package version: %s)"
+                   version
+                   pkg-version)
         (message "EditorConfig Emacs v%s"
-                 version))
-      version)))
+                 version)))
+    version))
 
 (provide 'editorconfig)
 

Reply via email to