Skip to content

Commit

Permalink
Use compat-string-trim-* functions for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed Nov 3, 2022
1 parent f35bf9a commit cf10f7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cask
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(package "php-mode" "1.24.1" "Major mode for editing PHP code")
(source gnu)
(source melpa)

(package-file "lisp/php-mode.el")
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ AUTOLOADS = php-mode-autoloads.el
ELCS = $(ELS:.el=.elc)

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

all: autoloads $(ELCS) authors

Expand Down
9 changes: 7 additions & 2 deletions lisp/php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
;; URL: https://github.com/emacs-php/php-mode
;; Keywords: languages php
;; Version: 1.24.1
;; Package-Requires: ((emacs "25.2"))
;; Package-Requires: ((emacs "25.2") (compat "28.1.1.0"))
;; License: GPL-3.0-or-later

(eval-and-compile
Expand Down Expand Up @@ -82,6 +82,7 @@
(require 'rx)
(require 'cl-lib)
(require 'regexp-opt)
(require 'compat-26 nil t)
(defvar add-log-current-defun-header-regexp)
(defvar add-log-current-defun-function)
(defvar c-syntactic-context)
Expand All @@ -92,7 +93,11 @@
(eval-when-compile
(let* ((fallback-version (format "%s-non-vcs" (with-no-warnings php-mode-version-number))))
(if (locate-dominating-file default-directory ".git")
(string-trim-left (string-trim-right (shell-command-to-string "git describe --tags")) "v")
(funcall
(if (and (boundp 'string-trim-left) (boundp 'string-trim-right))
(lambda (s) (string-trim-left (string-trim-right s) "v"))
(lambda (s) (compat-string-trim-left (compat-string-trim-right s) "v")))
(shell-command-to-string "git describe --tags"))
fallback-version)))
"PHP Mode build ID.
Expand Down

0 comments on commit cf10f7c

Please sign in to comment.