[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/php-mode b3718d488d 6/9: Copy thing-at-point-bounds-of-str
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/php-mode b3718d488d 6/9: Copy thing-at-point-bounds-of-string-at-point function from thingatpt.el |
Date: |
Sat, 1 Oct 2022 23:59:03 -0400 (EDT) |
branch: elpa/php-mode
commit b3718d488db5cec133820907c15f03a4912dd364
Author: USAMI Kenta <tadsan@zonu.me>
Commit: USAMI Kenta <tadsan@zonu.me>
Copy thing-at-point-bounds-of-string-at-point function from thingatpt.el
---
lisp/php.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lisp/php.el b/lisp/php.el
index 61b9564966..3a79a97ac3 100644
--- a/lisp/php.el
+++ b/lisp/php.el
@@ -461,6 +461,28 @@ can be used to match against definitions for that
classlike."
(match-string-no-properties 1)))))
(eval-and-compile
+ (if (eval-when-compile (fboundp 'thing-at-point-bounds-of-string-at-point))
+ (defalias 'php--thing-at-point-bounds-of-string-at-point
#'thing-at-point-bounds-of-string-at-point)
+ ;; Copyright (C) 1991-1998, 2000-2022 Free Software Foundation, Inc.
+ ;; Follows function is copied from Emacs 28's thingatpt.el.
+ ;;
https://github.com/emacs-mirror/emacs/commit/2abf143f8185fced544c4f8d144ea710142d7a59
+ (defun php--thing-at-point-bounds-of-string-at-point ()
+ "Return the bounds of the string at point.
+Prefer the enclosing string with fallback on sexp at point.
+\[Internal function used by `bounds-of-thing-at-point'.]"
+ (save-excursion
+ (let ((ppss (syntax-ppss)))
+ (if (nth 3 ppss)
+ ;; Inside the string
+ (ignore-errors
+ (goto-char (nth 8 ppss))
+ (cons (point) (progn (forward-sexp) (point))))
+ ;; At the beginning of the string
+ (if (eq (char-syntax (char-after)) ?\")
+ (let ((bound (bounds-of-thing-at-point 'sexp)))
+ (and bound
+ (<= (car bound) (point)) (< (point) (cdr bound))
+ bound))))))))
(if (eval-when-compile (fboundp 'c-end-of-token))
(defalias 'php--c-end-of-token #'c-end-of-token)
;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
- [nongnu] elpa/php-mode updated (6513efaf6f -> 7e4905a6e9), ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 6049ad7453 5/9: Add php-complete.el, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 651d524bdb 1/9: Add script/extract_functions.php, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 5179a1c28a 3/9: Copy c-end-of-token function from cc-engine.el, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 4609c9334c 4/9: Add php-leading-tokens, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 6531053ce6 2/9: Add php-defs.el, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode b3718d488d 6/9: Copy thing-at-point-bounds-of-string-at-point function from thingatpt.el,
ELPA Syncer <=
- [nongnu] elpa/php-mode 51670f3364 7/9: Add "=>" to php-mode token as pseudo-operator, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 836663957b 8/9: Add functions-txt subcommand to extract_functions.php, ELPA Syncer, 2022/10/01
- [nongnu] elpa/php-mode 7e4905a6e9 9/9: Merge pull request #708 from emacs-php/feature/php-completion, ELPA Syncer, 2022/10/01