branch: elpa/php-mode
commit 0260bd288aeb2e001470d49cd4fb2fc9574a17f4
Author: USAMI Kenta <[email protected]>
Commit: USAMI Kenta <[email protected]>
Make obsolete php-mode-disable-c-mode-hook variable
---
CHANGELOG.md | 2 ++
lisp/php-mode.el | 17 ++++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3276c010e6..d860e573fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ All notable changes of the PHP Mode 1.19.1 release series are
documented in this
* Make obsolete `php-mode-version-number` contstant variable ([#712])
* `(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.
+ * Make obsolete `php-mode-disable-c-mode-hook` customize variable ([#718])
### Fixed
@@ -44,6 +45,7 @@ All notable changes of the PHP Mode 1.19.1 release series are
documented in this
[#715]: https://github.com/emacs-php/php-mode/pull/715
[#716]: https://github.com/emacs-php/php-mode/pull/716
[#717]: https://github.com/emacs-php/php-mode/pull/717
+[#718]: https://github.com/emacs-php/php-mode/pull/718
## [1.24.1] - 2022-10-08
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 6843b3a720..6281c8a546 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -81,6 +81,7 @@
(eval-when-compile
(require 'rx)
(require 'cl-lib)
+ (require 'flymake)
(require 'regexp-opt)
(defvar add-log-current-defun-header-regexp)
(defvar add-log-current-defun-function)
@@ -301,6 +302,7 @@ In that case set to `NIL'."
:group 'php-mode
:tag "PHP Mode Disable C Mode Hook"
:type 'boolean)
+(make-obsolete-variable 'php-mode-disable-c-mode-hook nil "1.24.2")
(defcustom php-mode-enable-project-local-variable t
"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
(php-project-apply-local-variables)
(remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay))
+(defun php-mode-neutralize-cc-mode-effect ()
+ "Reset PHP-irrelevant variables set by Cc Mode initialization."
+ (setq-local c-mode-hook nil)
+ (setq-local java-mode-hook nil)
+ t)
+
(defvar php-mode-syntax-table
(let ((table (make-syntax-table)))
(c-populate-syntax-table table)
@@ -1173,9 +1181,12 @@ After setting the stylevars run hooks according to
STYLENAME
"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))
+ (if php-mode-disable-c-mode-hook
+ (php-mode-neutralize-cc-mode-effect)
+ (display-warning 'php-mode
+ "`php-mode-disable-c-mode-hook' will be removed. Do not
depends on this variable."
+ :warning))
+
(c-initialize-cc-mode t)
(c-init-language-vars php-mode)
(c-common-init 'php-mode)