Skip to content

Remove redundant :group keywords from defcustom/defface forms#813

Merged
zonuexe merged 1 commit into
masterfrom
cleanup/remove-redundant-group-php-group
Jul 16, 2026
Merged

Remove redundant :group keywords from defcustom/defface forms#813
zonuexe merged 1 commit into
masterfrom
cleanup/remove-redundant-group-php-group

Conversation

@zonuexe

@zonuexe zonuexe commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

A defcustom/defface form without an explicit :group belongs to the group of the last defgroup defined earlier in the same file, so repeating that group on every single form is redundant boilerplate. This drops the self-group :group keyword in the files that define their own group:

  • php.el (group php)
  • php-face.el (group php-faces)
  • php-format.el (group php-format)
  • php-ide.el (group php-ide)
  • php-ide-phpactor.el (group php-ide-phpactor)
  • php-flymake.el (group php-flymake)
  • php-complete.el (group php-complete)
  • php-project.el (group php-project)

Kept untouched:

  • Parent links on the defgroup forms themselves.
  • Explicit cross-group memberships (e.g. :group 'php on a few defcustoms inside php-format.el that intentionally file themselves under the parent group instead of php-format), whose removal would change the containing group.

Verification

Loaded every file before and after the change and compared (get GROUP 'custom-group) for php, php-mode, php-faces, php-format, php-ide, php-ide-phpactor, php-flymake, php-complete and php-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.

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.
@zonuexe
zonuexe merged commit 5229244 into master Jul 16, 2026
28 checks passed
@zonuexe
zonuexe deleted the cleanup/remove-redundant-group-php-group branch July 16, 2026 12:14
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant