[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/php-mode 9896cccd64 13/13: Merge pull request #740 from em
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/php-mode 9896cccd64 13/13: Merge pull request #740 from emacs-php/apply-monnier-patch |
Date: |
Mon, 10 Apr 2023 10:03:18 -0400 (EDT) |
branch: elpa/php-mode
commit 9896cccd647fc85106cc4c6cfd3f0a0833854a24
Merge: e515cc9d0e 4b03e9b956
Author: USAMI Kenta <tadsan@pixiv.com>
Commit: GitHub <noreply@github.com>
Merge pull request #740 from emacs-php/apply-monnier-patch
Apply Stefan Monnier's patch (3)
---
lisp/php-mode.el | 68 ++++++++++++++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index cabb11cb09..b3ea2d083c 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -660,13 +660,14 @@ but only if the setting is enabled."
'+)
(t nil)))))))
-(defun php-c-looking-at-or-maybe-in-bracelist (&optional _containing-sexp lim)
+(defun php-c-looking-at-or-maybe-in-bracelist (orig-fun &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
+ ((not (derived-mode-p 'php-mode)) (apply orig-fun containing-sexp lim args))
((looking-at-p "{")
(save-excursion
(c-backward-token-2 2 t lim)
@@ -994,20 +995,19 @@ HEREDOC-START."
(eval-and-compile
(defconst php-syntax-propertize-rules
- `((php-heredoc-start-re
- (0 (ignore (php--syntax-propertize-heredoc
- (match-beginning 0)
- (or (match-string 1) (match-string 2) (match-string 3))
- (null (match-string 3))))))
- (,(rx "#[")
- (0 (ignore (php--syntax-propertize-attributes (match-beginning 0)))))
- (,(rx (or "'" "\"" ))
- (0 (ignore (php--syntax-propertize-quotes-in-comment (match-beginning
0)))))))
-
- (defmacro php-build-propertize-function ()
- `(byte-compile (syntax-propertize-rules ,@php-syntax-propertize-rules)))
-
- (defalias 'php-syntax-propertize-function (php-build-propertize-function)))
+ (syntax-propertize-precompile-rules
+ (php-heredoc-start-re
+ (0 (ignore (php--syntax-propertize-heredoc
+ (match-beginning 0)
+ (or (match-string 1) (match-string 2) (match-string 3))
+ (null (match-string 3))))))
+ ((rx "#[")
+ (0 (ignore (php--syntax-propertize-attributes (match-beginning 0)))))
+ ((rx (or "'" "\""))
+ (0 (ignore (php--syntax-propertize-quotes-in-comment (match-beginning
0))))))))
+
+(defalias 'php-syntax-propertize-function
+ (syntax-propertize-rules php-syntax-propertize-rules))
(defun php--syntax-propertize-heredoc (start id _is-heredoc)
"Apply propertize Heredoc and Nowdoc from START, with ID and IS-HEREDOC."
@@ -1208,7 +1208,7 @@ After setting the stylevars run hook
`php-mode-STYLENAME-hook'."
(progn
(add-hook 'hack-local-variables-hook #'php-mode-set-style-delay t t)
(setq php-mode--delayed-set-style t)
- (advice-add #'c-set-style :after #'php-mode--disable-delay-set-style
'(local)))
+ (advice-add 'c-set-style :after #'php-mode--disable-delay-set-style))
(let ((php-mode-enable-backup-style-variables nil))
(php-set-style (symbol-name php-mode-coding-style))))
@@ -1242,15 +1242,12 @@ After setting the stylevars run hook
`php-mode-STYLENAME-hook'."
php-mode-replace-flymake-diag-function)
(add-hook 'flymake-diagnostic-functions
php-mode-replace-flymake-diag-function nil t))
- (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 '(local)))
- (advice-add #'fixup-whitespace :after #'php-mode--fixup-whitespace-after
'(local))
+ (advice-add 'c-looking-at-or-maybe-in-bracelist
+ :around 'php-c-looking-at-or-maybe-in-bracelist)
+ (advice-add 'fixup-whitespace :after #'php-mode--fixup-whitespace-after)
- (when (fboundp #'acm-backend-tabnine-candidate-expand)
- (advice-add #'acm-backend-tabnine-candidate-expand
- :filter-args
#'php-acm-backend-tabnine-candidate-expand-filter-args
- '(local)))
+ (advice-add 'acm-backend-tabnine-candidate-expand
+ :filter-args
#'php-acm-backend-tabnine-candidate-expand-filter-args)
(when (>= emacs-major-version 25)
(with-silent-modifications
@@ -1558,22 +1555,25 @@ The output will appear in the buffer *PHP*."
;;; logic of `fixup-whitespace'.
(defun php-mode--fixup-whitespace-after ()
"Remove whitespace before certain characters in PHP Mode."
- (when (or (looking-at-p " \\(?:;\\|,\\|->\\|::\\)")
- (save-excursion
- (forward-char -2)
- (looking-at-p "->\\|::")))
+ (when (and (derived-mode-p 'php-mode)
+ (or (looking-at-p " \\(?:;\\|,\\|->\\|::\\)")
+ (save-excursion
+ (forward-char -2)
+ (looking-at-p "->\\|::"))))
(delete-char 1)))
;; Advice for lsp-bridge' acm-backend-tabnine
;; see
https://github.com/manateelazycat/lsp-bridge/issues/402#issuecomment-1305653058
(defun php-acm-backend-tabnine-candidate-expand-filter-args (args)
"Adjust to replace bound-start ARGS for Tabnine in PHP."
- (cl-multiple-value-bind (candidate-info bound-start) args
- (save-excursion
- (goto-char bound-start)
- (when (looking-at-p (eval-when-compile (regexp-quote "$")))
- (setq bound-start (1+ bound-start))))
- (list candidate-info bound-start)))
+ (if (not (derived-mode-p 'php-mode))
+ args
+ (cl-multiple-value-bind (candidate-info bound-start) args
+ (save-excursion
+ (goto-char bound-start)
+ (when (looking-at-p (eval-when-compile (regexp-quote "$")))
+ (setq bound-start (1+ bound-start))))
+ (list candidate-info bound-start))))
;;;###autoload
(progn
- [nongnu] elpa/php-mode updated (47e0813079 -> 9896cccd64), ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode ca7485696f 02/13: Merge pull request #738 from emacs-php/fix/cask-source, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode dfec538042 03/13: Remove unnecessary :group 'php-mode from defcustom, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 1e4e93c805 06/13: Merge pull request #737 from emacs-php/apply-monnier-patch, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 06763946a0 08/13: Simplify code for style-specific hooks, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode e45117f0e2 05/13: Properly quote symbols in documentation strings, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 9a5ace8c95 07/13: Hide CC-mode's `TAB' binding, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode e515cc9d0e 10/13: Merge pull request #739 from emacs-php/apply-monnier-patch, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 4b03e9b956 12/13: Use syntax-propertize-precompile-rules for php-syntax-propertize-function, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 9896cccd64 13/13: Merge pull request #740 from emacs-php/apply-monnier-patch,
ELPA Syncer <=
- [nongnu] elpa/php-mode 2f9fa61516 04/13: Replace function name with #'function-form instead of 'symbol, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 65b8db569e 11/13: Fixed incorrect use of 'local' (nonexistent) advice, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode f8913f9a5f 01/13: Add GNU ELPA (gnu) to Cask source, ELPA Syncer, 2023/04/10
- [nongnu] elpa/php-mode 9e952d47a9 09/13: Remove unnecessary boundp guards from remove-hook call, ELPA Syncer, 2023/04/10