[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/php-mode 52f8297606 2/4: Make php-mode inherit from php-ba
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/php-mode 52f8297606 2/4: Make php-mode inherit from php-base-mode instead of c-mode |
Date: |
Tue, 28 Nov 2023 16:00:11 -0500 (EST) |
branch: elpa/php-mode
commit 52f82976069d002d8be10bd17b1cf476f83811d3
Author: USAMI Kenta <tadsan@zonu.me>
Commit: USAMI Kenta <tadsan@zonu.me>
Make php-mode inherit from php-base-mode instead of c-mode
---
CHANGELOG.md | 4 ++++
lisp/php-mode.el | 19 ++++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62f59096e4..649c813212 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ All notable changes of the PHP Mode 1.19.1 release series are
documented in this
* Add `php-base-mode` which is the base of php related modes ([#772])
* `php-base-mode` is designed as a common parent mode for `php-mode` and
[`php-ts-mode`](https://github.com/emacs-php/php-ts-mode).
+### Changed
+
+ * Make `php-mode` inherit from `php-base-mode` instead of `c-mode` ([#772])
+
[#772]: https://github.com/emacs-php/php-mode/pull/772
## [1.25.1] - 2023-11-24
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 022b2a62f0..e19faea8ce 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -327,6 +327,7 @@ as a function. Call with AS-NUMBER keyword to compare by
`version<'.
(defvar php-mode-map
(let ((map (make-sparse-keymap "PHP Mode")))
+ (set-keymap-parent map c-mode-base-map)
;; Remove menu item for c-mode
(define-key map [menu-bar C] nil)
@@ -1150,14 +1151,14 @@ After setting the stylevars run hook
`php-mode-STYLENAME-hook'."
table))
;;;###autoload
-(define-derived-mode php-mode c-mode "PHP"
+(define-derived-mode php-mode php-base-mode "PHP"
"Major mode for editing PHP code.
\\{php-mode-map}"
:syntax-table php-mode-syntax-table
- ;; :after-hook (c-update-modeline)
- ;; (setq abbrev-mode t)
-
+ :after-hook (progn (c-make-noise-macro-regexps)
+ (c-make-macro-with-semi-re)
+ (c-update-modeline))
(unless (string= php-mode-cc-version c-version)
(php-mode-debug-reinstall nil))
@@ -1168,8 +1169,16 @@ After setting the stylevars run hook
`php-mode-STYLENAME-hook'."
:warning))
(c-initialize-cc-mode t)
+ (setq abbrev-mode t)
+
+ ;; Must be called once as c-mode to enable font-lock for Heredoc.
+ ;; TODO: This call may be removed in the future.
+ (c-common-init 'c-mode)
+
(c-init-language-vars php-mode)
(c-common-init 'php-mode)
+ (cc-imenu-init cc-imenu-c-generic-expression)
+
(setq-local c-auto-align-backslashes nil)
(setq-local comment-start "// ")
@@ -1252,7 +1261,7 @@ After setting the stylevars run hook
`php-mode-STYLENAME-hook'."
(advice-add 'acm-backend-tabnine-candidate-expand
:filter-args
#'php-acm-backend-tabnine-candidate-expand-filter-args)
- (when (>= emacs-major-version 25)
+ (when (eval-when-compile (>= emacs-major-version 25))
(with-silent-modifications
(save-excursion
(let* ((start (point-min))