Skip to content

Commit

Permalink
Use API to get version info (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
10sr authored Mar 23, 2019
1 parent 6827105 commit 023b599
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
5 changes: 3 additions & 2 deletions bin/editorconfig-el
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
load-path)))

(require 'cl-lib)
(require 'editorconfig) ; For `editorconfig-version'
(require 'editorconfig-core)

(defconst editorconfig-bin-help-message
Expand Down Expand Up @@ -80,8 +81,8 @@ with required output."
(message editorconfig-bin-help-message)
(kill-emacs 0))
((-v --version)
(princ (format "EditorConfig-Core-EmacsLisp Version %s\n"
editorconfig-core-version))
(princ (format "EditorConfig-EmacsLisp Version %s\n"
(editorconfig-version)))
(kill-emacs 0))

(otherwise
Expand Down
3 changes: 0 additions & 3 deletions editorconfig-conf-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
;; Copyright (C) 2011-2019 EditorConfig Team

;; Author: EditorConfig Team <[email protected]>
;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
;; Version: 0.7.14
;; Package-Requires: ((emacs "24"))

;; See
;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors
Expand Down
3 changes: 0 additions & 3 deletions editorconfig-core-handle.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
;; Copyright (C) 2011-2019 EditorConfig Team

;; Author: EditorConfig Team <[email protected]>
;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
;; Version: 0.7.14
;; Package-Requires: ((emacs "24"))

;; See
;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors
Expand Down
7 changes: 0 additions & 7 deletions editorconfig-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
;; Copyright (C) 2011-2019 EditorConfig Team

;; Author: EditorConfig Team <[email protected]>
;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
;; Version: 0.7.14
;; Package-Requires: ((emacs "24"))

;; See
;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors
Expand Down Expand Up @@ -72,10 +69,6 @@
(require 'editorconfig-core-handle)


(defconst editorconfig-core-version
"0.7.14"
"EditorConfig core version.")

(defun editorconfig-core--get-handles (dir confname &optional result)
"Get list of EditorConfig handlers for DIR from CONFNAME.
Expand Down
3 changes: 0 additions & 3 deletions editorconfig-fnmatch.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
;; Copyright (C) 2011-2019 EditorConfig Team

;; Author: EditorConfig Team <[email protected]>
;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
;; Version: 0.7.14
;; Package-Requires: ((emacs "24"))

;; See
;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors
Expand Down
28 changes: 28 additions & 0 deletions editorconfig.el
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,34 @@ To disable EditorConfig in some buffers, modify
(indent-region (point-min) (point-max)))



;; (defconst editorconfig--version
;; (eval-when-compile
;; (require 'lisp-mnt)
;; (declare-function lm-version "lisp-mnt" nil)
;; (lm-version))
;; "EditorConfig version.")

(declare-function find-library-name "find-func" (library))
(declare-function lm-version "lisp-mnt" nil)

;;;###autoload
(defun editorconfig-version (&optional show-version)
"Get EditorConfig version as string.
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
(message "EditorConfig Emacs v%s"
version))
version)))

(provide 'editorconfig)

;;; editorconfig.el ends here
Expand Down

0 comments on commit 023b599

Please sign in to comment.