update packages
This commit is contained in:
@@ -318,6 +318,9 @@ In that case set to `NIL'."
|
||||
:tag "PHP Mode Enable Project Local Variable"
|
||||
:type 'boolean)
|
||||
|
||||
(defconst php-mode-cc-vertion
|
||||
(eval-when-compile c-version))
|
||||
|
||||
(defun php-mode-version ()
|
||||
"Display string describing the version of PHP Mode."
|
||||
(interactive)
|
||||
@@ -472,7 +475,7 @@ In that case set to `NIL'."
|
||||
|
||||
(c-lang-defconst c-primitive-type-kwds
|
||||
php '("int" "integer" "bool" "boolean" "float" "double" "real"
|
||||
"string" "object" "void"))
|
||||
"string" "object" "void" "mixed"))
|
||||
|
||||
(c-lang-defconst c-class-decl-kwds
|
||||
"Keywords introducing declarations where the following block (if any)
|
||||
@@ -519,6 +522,9 @@ PHP does not have an \"enum\"-like keyword."
|
||||
(c-lang-defconst c-lambda-kwds
|
||||
php '("function" "use"))
|
||||
|
||||
(c-lang-defconst c-inexpr-block-kwds
|
||||
php '("match"))
|
||||
|
||||
(c-lang-defconst c-other-block-decl-kwds
|
||||
php '("namespace"))
|
||||
|
||||
@@ -643,6 +649,23 @@ but only if the setting is enabled"
|
||||
(beginning-of-line)
|
||||
(if (looking-at-p "\\s-*->") '+ nil))))
|
||||
|
||||
(defun php-c-looking-at-or-maybe-in-bracelist (&optional containing-sexp lim)
|
||||
"Replace `c-looking-at-or-maybe-in-bracelist'.
|
||||
|
||||
CONTAINING-SEXP is the position of the brace/paren/bracket enclosing
|
||||
POINT, or nil if there is no such position, or we do not know it. LIM is
|
||||
a backward search limit."
|
||||
(cond
|
||||
((looking-at-p "{")
|
||||
(save-excursion
|
||||
(c-backward-token-2 2 t lim)
|
||||
;; PHP 8.0 match expression
|
||||
;; echo match ($var) |{
|
||||
;; ↑ matches ↑ initial position
|
||||
(when (looking-at-p (eval-when-compile (rx symbol-start "match" symbol-end)))
|
||||
(cons (point) t))))
|
||||
(t nil)))
|
||||
|
||||
(c-add-style
|
||||
"php"
|
||||
`((c-basic-offset . 4)
|
||||
@@ -1111,6 +1134,13 @@ After setting the stylevars run hooks according to STYLENAME
|
||||
:syntax-table php-mode-syntax-table
|
||||
;; :after-hook (c-update-modeline)
|
||||
;; (setq abbrev-mode t)
|
||||
|
||||
(unless (string= php-mode-cc-vertion c-version)
|
||||
(user-error "CC Mode has been updated. %s"
|
||||
(if (package-installed-p 'php-mode)
|
||||
"Please run `M-x package-reinstall php-mode' command."
|
||||
"Please byte recompile PHP Mode files.")))
|
||||
|
||||
(when php-mode-disable-c-mode-hook
|
||||
(setq-local c-mode-hook nil)
|
||||
(setq-local java-mode-hook nil))
|
||||
@@ -1186,6 +1216,10 @@ After setting the stylevars run hooks according to STYLENAME
|
||||
(setq-local add-log-current-defun-function nil)
|
||||
(setq-local add-log-current-defun-header-regexp php-beginning-of-defun-regexp)
|
||||
|
||||
(when (fboundp 'c-looking-at-or-maybe-in-bracelist)
|
||||
(advice-add #'c-looking-at-or-maybe-in-bracelist
|
||||
:override 'php-c-looking-at-or-maybe-in-bracelist))
|
||||
|
||||
(when (>= emacs-major-version 25)
|
||||
(with-silent-modifications
|
||||
(save-excursion
|
||||
@@ -1518,7 +1552,7 @@ a completion list."
|
||||
("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign))
|
||||
|
||||
;; Logical operator (!)
|
||||
("\\(![^=]\\)" 1 'php-logical-op)
|
||||
("\\(!\\)[^=]" 1 'php-logical-op)
|
||||
|
||||
;; Highlight special variables
|
||||
("\\(\\$\\)\\(this\\)\\>" (1 'php-$this-sigil) (2 'php-$this))
|
||||
|
||||
Reference in New Issue
Block a user