[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/php-mode 5179a1c28a 3/9: Copy c-end-of-token function from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/php-mode 5179a1c28a 3/9: Copy c-end-of-token function from cc-engine.el |
Date: |
Sat, 1 Oct 2022 23:59:03 -0400 (EDT) |
branch: elpa/php-mode
commit 5179a1c28ab38df5eb1d6d07fe21b56400fed91c
Author: USAMI Kenta <tadsan@zonu.me>
Commit: USAMI Kenta <tadsan@zonu.me>
Copy c-end-of-token function from cc-engine.el
This function is committed in
https://emba.gnu.org/emacs/emacs/-/commit/95fb826dc58965eac287c0826831352edf2e56f7
---
lisp/php.el | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/lisp/php.el b/lisp/php.el
index 161bf98b8d..e83ba6abf0 100644
--- a/lisp/php.el
+++ b/lisp/php.el
@@ -1,6 +1,7 @@
;;; php.el --- PHP support for friends -*- lexical-binding: t;
-*-
;; Copyright (C) 2022 Friends of Emacs-PHP development
+;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 Dec 2018
@@ -26,9 +27,16 @@
;; This file provides common variable and functions for PHP packages.
+;; These functions are copied function from GNU Emacs.
+;;
+;; - c-end-of-token (cc-engine.el)
+;;
+
;;; Code:
(eval-when-compile
+ (require 'cc-mode)
(require 'cl-lib))
+(require 'cc-engine)
(require 'flymake)
(require 'php-project)
(require 'rx)
@@ -431,6 +439,36 @@ can be used to match against definitions for that
classlike."
(when (re-search-backward re-pattern nil t)
(match-string-no-properties 1)))))
+(eval-and-compile
+ (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.
+ ;; Follows function is copied from Emacs 27's cc-engine.el.
+ ;;
https://emba.gnu.org/emacs/emacs/-/commit/95fb826dc58965eac287c0826831352edf2e56f7
+ (defun php--c-end-of-token (&optional back-limit)
+ ;; Move to the end of the token we're just before or in the middle of.
+ ;; BACK-LIMIT may be used to bound the backward search; if given it's
+ ;; assumed to be at the boundary between two tokens. Return non-nil if
the
+ ;; point is moved, nil otherwise.
+ ;;
+ ;; This function might do hidden buffer changes.
+ (let ((start (point)))
+ (cond ;; ((< (skip-syntax-backward "w_" (1- start)) 0)
+ ;; (skip-syntax-forward "w_"))
+ ((> (skip-syntax-forward "w_") 0))
+ ((< (skip-syntax-backward ".()" back-limit) 0)
+ (while (< (point) start)
+ (if (looking-at c-nonsymbol-token-regexp)
+ (goto-char (match-end 0))
+ ;; `c-nonsymbol-token-regexp' should always match since
+ ;; we've skipped backward over punctuation or paren
+ ;; syntax, but move forward in case it doesn't so that
+ ;; we don't leave point earlier than we started with.
+ (forward-char))))
+ (t (if (looking-at c-nonsymbol-token-regexp)
+ (goto-char (match-end 0)))))
+ (> (point) start)))))
+
(defun php-get-pattern ()
"Find the pattern we want to complete.
`find-tag-default' from GNU Emacs etags.el"
- [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 <=
- [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, 2022/10/01
- [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