Add php-core.el for the dependency-free primitives#815
Merged
Conversation
php.el is required by every PHP package, but it requires flymake, php-project and (for now) CC Mode. A module that only wants the `php' customization group or a syntax-ppss predicate pays for all of it: `(require 'php)' pulls in 17 features and ~53 ms. Move the definitions that depend on nothing into php-core.el: - the `php' customization group, - `php-executable', - `php-in-string-p' and its siblings, - `php-base-mode'. php.el requires php-core.el and therefore still exposes all of them, so `(require 'php)' behaves exactly as before and nothing has to migrate. php-indent.el, which only ever wanted the customization group, now requires php-core.el instead: 2 features and ~1 ms, with no flymake, php-project or cc-engine in its dependency chain. Two consequences worth noting: * php.el's defcustoms specify `:group 'php' again. #813 removed those as redundant, which was true only while the defgroup sat in the same file: `custom-current-group' keys off `load-file-name', so with the defgroup in php-core.el they would silently fall out of the group (`M-x customize-group php' listed 2 members instead of 29). They are required now, not redundant. * The syntax tables stay in php.el for the moment. They are built with `c-populate-syntax-table', so moving them would drag CC Mode into php-core.el and defeat the purpose; they can follow once php.el stops requiring cc-engine. Verified that (get GROUP 'custom-group) membership is identical to before for every php* group.
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step of the php.el decomposition, aimed at the v1.28 series.
Why
php.el is required by every PHP package, but it requires
flymake,php-projectand (for now) CC Mode. A module that only wants thephpcustomization group or asyntax-ppsspredicate pays for all of it — measured on a byte-compiled tree:(require 'php)The indentation engine pulling in flymake to get a 7-line
defgroupis the clearest symptom.What moves
lisp/php-core.el(new, zero dependencies):phpcustomization groupphp-executablephp-in-string-p,php-in-comment-p,php-in-string-or-comment-p,php-in-poly-php-html-modephp-base-modephp.el requires php-core.el and therefore still exposes every one of them, so
(require 'php)behaves exactly as before and nothing has to migrate. This is the facade direction: the dependency arrow points core ← php, with no cycle.php-indent.el, which only ever wanted the customization group, now requires php-core.el instead:
(require 'php-indent)with no flymake, php-project or cc-engine in its chain.
Two consequences worth calling out
php.el's defcustoms specify
:group 'phpagain. #813 removed those as redundant, which was true only while the defgroup sat in the same file:custom-current-groupkeys offload-file-name, so with the defgroup in php-core.el they silently fall out of the group. Without this,M-x customize-group phplists 2 members instead of 29. They are required now, not redundant.The syntax tables stay in php.el for the moment. They are built with
c-populate-syntax-table, so moving them would drag CC Mode into php-core.el and defeat the purpose. They can follow once php.el stops requiring cc-engine.Verification
(get GROUP 'custom-group)membership is identical to master for everyphp*group (php,php-mode,php-faces,php-format,php-ide,php-ide-phpactor,php-flymake,php-complete,php-project).Follow-ups (not here)
php-executablecurrently has twobound-and-true-p/boundpworkarounds — php-project.el:224 and php-flymake.el:104 — because neither can require php.el (php.el requires php-project, so it would be circular). Both can now require php-core.el instead and drop the workaround. Kept out of this PR to keep it a pure move with no behaviour change.php-magical-constants→ php-keywords.el with an obsolete alias.