Skip to content

Commit cf10f7c

Browse files
committed
Use compat-string-trim-* functions for compatibility
1 parent f35bf9a commit cf10f7c

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Diff for: Cask

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
(package "php-mode" "1.24.1" "Major mode for editing PHP code")
2+
(source gnu)
23
(source melpa)
34

45
(package-file "lisp/php-mode.el")

Diff for: Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ AUTOLOADS = php-mode-autoloads.el
55
ELCS = $(ELS:.el=.elc)
66

77
%.elc: %.el
8-
$(EMACS) --batch -L lisp/ -f batch-byte-compile $<
8+
$(EMACS) --batch -L lisp/ --eval \
9+
"(let ((default-directory (expand-file-name \".cask\" default-directory))) \
10+
(normal-top-level-add-subdirs-to-load-path))" \
11+
-f batch-byte-compile $<
912

1013
all: autoloads $(ELCS) authors
1114

Diff for: lisp/php-mode.el

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
;; URL: https://github.com/emacs-php/php-mode
1111
;; Keywords: languages php
1212
;; Version: 1.24.1
13-
;; Package-Requires: ((emacs "25.2"))
13+
;; Package-Requires: ((emacs "25.2") (compat "28.1.1.0"))
1414
;; License: GPL-3.0-or-later
1515

1616
(eval-and-compile
@@ -82,6 +82,7 @@
8282
(require 'rx)
8383
(require 'cl-lib)
8484
(require 'regexp-opt)
85+
(require 'compat-26 nil t)
8586
(defvar add-log-current-defun-header-regexp)
8687
(defvar add-log-current-defun-function)
8788
(defvar c-syntactic-context)
@@ -92,7 +93,11 @@
9293
(eval-when-compile
9394
(let* ((fallback-version (format "%s-non-vcs" (with-no-warnings php-mode-version-number))))
9495
(if (locate-dominating-file default-directory ".git")
95-
(string-trim-left (string-trim-right (shell-command-to-string "git describe --tags")) "v")
96+
(funcall
97+
(if (and (boundp 'string-trim-left) (boundp 'string-trim-right))
98+
(lambda (s) (string-trim-left (string-trim-right s) "v"))
99+
(lambda (s) (compat-string-trim-left (compat-string-trim-right s) "v")))
100+
(shell-command-to-string "git describe --tags"))
96101
fallback-version)))
97102
"PHP Mode build ID.
98103

0 commit comments

Comments
 (0)