Skip to content

No inherit c-mode #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this

### Changed

* `php-mode` no longer inherits `c-mode`
* The keymap continues to inherit from `c-mode-base-map`.
* This change has no effect on other CC Mode features
* Optimized propertize process ([#669])
* Reimoplement `php-syntax-propertize-function` using `syntax-propertize-rules`
* Make propertize PHP 8 `#[Attribute]` always enabled
Expand Down
17 changes: 4 additions & 13 deletions lisp/php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,6 @@ In that case set to `NIL'."
:tag "PHP Mode Disable c-auto-align-backslashes"
:type 'boolean)

(define-obsolete-variable-alias 'php-mode-disable-parent-mode-hooks 'php-mode-disable-c-mode-hook "1.21.0")
(defcustom php-mode-disable-c-mode-hook t
"When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')."
:group 'php-mode
:tag "PHP Mode Disable C Mode Hook"
:type 'boolean)

(defcustom php-mode-enable-project-local-variable t
"When set to `T', apply project local variable to buffer local variable."
:group 'php-mode
Expand Down Expand Up @@ -306,6 +299,7 @@ In that case set to `NIL'."

(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)

Expand Down Expand Up @@ -1106,23 +1100,20 @@ After setting the stylevars run hooks according to STYLENAME
table))

;;;###autoload
(define-derived-mode php-mode c-mode "PHP"
(define-derived-mode php-mode prog-mode "PHP"
"Major mode for editing PHP code.

\\{php-mode-map}"
:group 'php-mode
:syntax-table php-mode-syntax-table
;; :after-hook (c-update-modeline)
;; (setq abbrev-mode t)
:after-hook (c-update-modeline)

(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))
(c-initialize-cc-mode t)
(c-init-language-vars php-mode)
(c-common-init 'php-mode)
Expand Down