Remove redundant :group keywords from defcustom/defface forms#813
Merged
Conversation
A defcustom or defface without an explicit :group belongs to the group of the last defgroup defined in the same file, so repeating that group on every form is redundant. Drop the self-group keywords in the files that define their own group (php.el, php-face.el, php-format.el, php-ide.el, php-ide-phpactor.el, php-flymake.el, php-complete.el and php-project.el). Kept untouched: * Parent links on the defgroup forms themselves. * Explicit cross-group memberships (e.g. :group 'php on defcustoms in php-format.el), whose removal would change the containing group. Verified that (get GROUP 'custom-group) membership is identical before and after for every php* group.
tarsius
pushed a commit
to emacsmirror/php-mode
that referenced
this pull request
Jul 17, 2026
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. emacs-php#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 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.
Summary
A
defcustom/deffaceform without an explicit:groupbelongs to the group of the lastdefgroupdefined earlier in the same file, so repeating that group on every single form is redundant boilerplate. This drops the self-group:groupkeyword in the files that define their own group:php.el(groupphp)php-face.el(groupphp-faces)php-format.el(groupphp-format)php-ide.el(groupphp-ide)php-ide-phpactor.el(groupphp-ide-phpactor)php-flymake.el(groupphp-flymake)php-complete.el(groupphp-complete)php-project.el(groupphp-project)Kept untouched:
defgroupforms themselves.:group 'phpon a fewdefcustoms insidephp-format.elthat intentionally file themselves under the parent group instead ofphp-format), whose removal would change the containing group.Verification
Loaded every file before and after the change and compared
(get GROUP 'custom-group)forphp,php-mode,php-faces,php-format,php-ide,php-ide-phpactor,php-flymake,php-completeandphp-project— membership is byte-for-byte identical. Byte-compilation is clean (no new warnings), and the existing test suite (tests/php-mode-test.el) passes unchanged.