Skip to content

Commit 0260bd2

Browse files
committed
Make obsolete php-mode-disable-c-mode-hook variable
1 parent f5c4016 commit 0260bd2

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
2929

3030
* Make obsolete `php-mode-version-number` contstant variable ([#712])
3131
* `(php-mode-version :as-number t)` is provided for use cases comparing as versions, but generally SHOULD NOT be dependent on the PHP Mode version.
32+
* Make obsolete `php-mode-disable-c-mode-hook` customize variable ([#718])
3233

3334
### Fixed
3435

@@ -44,6 +45,7 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
4445
[#715]: https://github.com/emacs-php/php-mode/pull/715
4546
[#716]: https://github.com/emacs-php/php-mode/pull/716
4647
[#717]: https://github.com/emacs-php/php-mode/pull/717
48+
[#718]: https://github.com/emacs-php/php-mode/pull/718
4749

4850
## [1.24.1] - 2022-10-08
4951

lisp/php-mode.el

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
(eval-when-compile
8282
(require 'rx)
8383
(require 'cl-lib)
84+
(require 'flymake)
8485
(require 'regexp-opt)
8586
(defvar add-log-current-defun-header-regexp)
8687
(defvar add-log-current-defun-function)
@@ -301,6 +302,7 @@ In that case set to `NIL'."
301302
:group 'php-mode
302303
:tag "PHP Mode Disable C Mode Hook"
303304
:type 'boolean)
305+
(make-obsolete-variable 'php-mode-disable-c-mode-hook nil "1.24.2")
304306

305307
(defcustom php-mode-enable-project-local-variable t
306308
"When set to `T', apply project local variable to buffer local variable."
@@ -1147,6 +1149,12 @@ After setting the stylevars run hooks according to STYLENAME
11471149
(php-project-apply-local-variables)
11481150
(remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay))
11491151

1152+
(defun php-mode-neutralize-cc-mode-effect ()
1153+
"Reset PHP-irrelevant variables set by Cc Mode initialization."
1154+
(setq-local c-mode-hook nil)
1155+
(setq-local java-mode-hook nil)
1156+
t)
1157+
11501158
(defvar php-mode-syntax-table
11511159
(let ((table (make-syntax-table)))
11521160
(c-populate-syntax-table table)
@@ -1173,9 +1181,12 @@ After setting the stylevars run hooks according to STYLENAME
11731181
"Please run `M-x package-reinstall php-mode' command."
11741182
"Please byte recompile PHP Mode files.")))
11751183

1176-
(when php-mode-disable-c-mode-hook
1177-
(setq-local c-mode-hook nil)
1178-
(setq-local java-mode-hook nil))
1184+
(if php-mode-disable-c-mode-hook
1185+
(php-mode-neutralize-cc-mode-effect)
1186+
(display-warning 'php-mode
1187+
"`php-mode-disable-c-mode-hook' will be removed. Do not depends on this variable."
1188+
:warning))
1189+
11791190
(c-initialize-cc-mode t)
11801191
(c-init-language-vars php-mode)
11811192
(c-common-init 'php-mode)

0 commit comments

Comments
 (0)