Skip to content

Commit 3c6c0d6

Browse files
committed
Revert string-trim-right
1 parent 62ef194 commit 3c6c0d6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lisp/php-mode.el

+9-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@
9090

9191
(defconst php-mode-version-id
9292
(eval-when-compile
93-
(let* ((fallback-version (format "%s-non-vcs" (with-no-warnings php-mode-version-number))))
93+
(let ((fallback-version (format "%s-non-vcs" (with-no-warnings php-mode-version-number))))
9494
(if (locate-dominating-file default-directory ".git")
95-
(string-trim-left (string-trim-right (shell-command-to-string "git describe --tags")) "v")
95+
(save-match-data
96+
(let ((tag (replace-regexp-in-string
97+
(rx bos "v") ""
98+
(shell-command-to-string "git describe --tags")))
99+
(pattern (rx (group (+ any)) eol)))
100+
(if (string-match pattern tag)
101+
(match-string 0 tag)
102+
(error "Faild to obtain git tag"))))
96103
fallback-version)))
97104
"PHP Mode build ID.
98105

0 commit comments

Comments
 (0)