[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/php-mode b559c80a1e 11/12: Merge pull request #713 from em
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/php-mode b559c80a1e 11/12: Merge pull request #713 from emacs-php/feature/php-mode-version |
Date: |
Thu, 3 Nov 2022 12:59:20 -0400 (EDT) |
branch: elpa/php-mode
commit b559c80a1eb271c94de4639a3a02c93eaf81c81b
Merge: 865bc847f8 9603a4f54f
Author: USAMI Kenta <tadsan@pixiv.com>
Commit: GitHub <noreply@github.com>
Merge pull request #713 from emacs-php/feature/php-mode-version
Add php-mode-version-id and make obsolete php-mode-version-number
---
CHANGELOG.md | 8 ++++++++
lisp/php-mode.el | 48 +++++++++++++++++++++++++++++++++++++-----------
2 files changed, 45 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cccfd1309..3276c010e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,8 +21,15 @@ All notable changes of the PHP Mode 1.19.1 release series
are documented in this
* Make continued expressions inside lists (arguments and arrays, etc.) have
the same indent width as outside the list ([#703])
* (internal) Improved readability of test failures about indentation ([#707])
* `php-doc-annotation-tag` inherits `font-lock-doc-markup-face` if defined in
Emacs 28 ([#711])
+ * Make `php-mode-version` function include a Git tag and revision ([#713])
+ * Like `"1.23.4-56-xxxxxx"` for example.
* Change `php-phpdoc-type-keywords` to `php-phpdoc-type-names` to avoid
confusion ([#717])
+### Deprecated
+
+ * Make obsolete `php-mode-version-number` contstant variable ([#712])
+ * `(php-mode-version :as-number t)` is provided for use cases comparing as
versions, but generally SHOULD NOT be dependent on the PHP Mode version.
+
### Fixed
* Removed invalid definitions that caused errors in some expressions ([#704])
@@ -33,6 +40,7 @@ All notable changes of the PHP Mode 1.19.1 release series are
documented in this
[#708]: https://github.com/emacs-php/php-mode/pull/708
[#710]: https://github.com/emacs-php/php-mode/pull/710
[#711]: https://github.com/emacs-php/php-mode/pull/711
+[#713]: https://github.com/emacs-php/php-mode/pull/713
[#715]: https://github.com/emacs-php/php-mode/pull/715
[#716]: https://github.com/emacs-php/php-mode/pull/716
[#717]: https://github.com/emacs-php/php-mode/pull/717
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 5e5b66e790..6843b3a720 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -13,8 +13,10 @@
;; Package-Requires: ((emacs "25.2"))
;; License: GPL-3.0-or-later
-(defconst php-mode-version-number "1.24.1"
- "PHP Mode version number.")
+(eval-and-compile
+ (make-obsolete-variable
+ (defconst php-mode-version-number "1.24.1" "PHP Mode version number.")
+ "Please call (php-mode-version :as-number t) for compatibility." "1.24.2"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -86,6 +88,27 @@
(defvar c-vsemi-status-unknown-p)
(defvar syntax-propertize-via-font-lock))
+(defconst php-mode-version-id
+ (eval-when-compile
+ (let ((fallback-version (format "%s-non-vcs" (with-no-warnings
php-mode-version-number))))
+ (if (locate-dominating-file default-directory ".git")
+ (save-match-data
+ (let ((tag (replace-regexp-in-string
+ (rx bos "v") ""
+ (shell-command-to-string "git describe --tags")))
+ (pattern (rx (group (+ any)) eol)))
+ (if (string-match pattern tag)
+ (match-string 0 tag)
+ (error "Faild to obtain git tag"))))
+ fallback-version)))
+ "PHP Mode build ID.
+
+The format is follows:
+
+\"1.23.4\": Tagged revision, compiled under Git VCS.
+\"1.23.4-56-xxxxxx\": 56 commits after the last tag release, compiled under
Git.
+\"1.23.4-non-vcs\": Compiled in an environment not managed by Git VCS.")
+
(autoload 'php-mode-debug "php-mode-debug"
"Display informations useful for debugging PHP Mode." t)
@@ -288,17 +311,20 @@ In that case set to `NIL'."
(defconst php-mode-cc-vertion
(eval-when-compile c-version))
-(defun php-mode-version ()
- "Display string describing the version of PHP Mode."
- (interactive)
- (let ((fmt (eval-when-compile (let ((id "$Id$"))
- (concat "PHP Mode %s"
- (if (string= id (concat [?$ ?I ?d
?$]))
- ""
- (concat " " id)))))))
+(cl-defun php-mode-version (&key as-number)
+ "Display string describing the version of PHP Mode.
+
+Although this is an interactive command, it returns a string when called
+as a function. Call with AS-NUMBER keyword to compare by `version<'.
+
+\(version<= \"1.24.1\" (php-mode-version :as-number t))"
+ (interactive (list :as-number nil))
+ (if as-number
+ (save-match-data (and (string-match (rx (group (+ (in ".0-9"))))
php-mode-version-id)
+ (match-string 0 php-mode-version-id)))
(funcall
(if (called-interactively-p 'interactive) #'message #'format)
- fmt php-mode-version-number)))
+ "PHP Mode v%s" php-mode-version-id)))
;;;###autoload
(define-obsolete-variable-alias 'php-available-project-root-files
'php-project-available-root-files "1.19.0")
- [nongnu] elpa/php-mode updated (fe8ab0903c -> f5c4016bb6), ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 44601ab2df 02/12: Add "phan" to type tag vendor prefix, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 258d6c5460 04/12: Add Psalm template annotations to php-phpdoc-type-tags, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 9603a4f54f 10/12: Revert string-trim-right, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode f5c4016bb6 12/12: Update AUTHORS, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 0bbdc46e01 03/12: Add "type" to php-phpdoc-type-tags as "phpstan-type", ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 7853345918 05/12: Update CHANGELOG, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 865bc847f8 06/12: Merge pull request #717 from emacs-php/refactor/phpdoc-type-variables, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 08ef915dc3 09/12: Revert "Use compat-string-trim-* functions for compatibility", ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode b559c80a1e 11/12: Merge pull request #713 from emacs-php/feature/php-mode-version,
ELPA Syncer <=
- [nongnu] elpa/php-mode cf10f7c217 08/12: Use compat-string-trim-* functions for compatibility, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode 08776c1b50 01/12: Changed variable name to php-phpdoc-type-names to avoid confusion, ELPA Syncer, 2022/11/03
- [nongnu] elpa/php-mode f35bf9a28c 07/12: Add php-mode-version-id and make obsolete php-mode-version-number, ELPA Syncer, 2022/11/03