Skip to content

Make every file compile cleanly on its own - #4205

Open
bbatsov wants to merge 6 commits into
masterfrom
fix-native-comp-warnings
Open

bbatsov wants to merge 6 commits into
masterfrom
fix-native-comp-warnings

Conversation

@bbatsov

@bbatsov bbatsov commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Native compilation compiles each file in a fresh Emacs, so it flags missing requires and declarations that eldev compile hides by building everything in one process. On Emacs 31 that meant a screen of "not known to be defined" warnings, and in natively compiled builds the cider-test-menu selectors, the cider-start-menu edit-command option and the cider-doctor version fallback quietly didn't work. CI now runs eldev compile-isolated to catch this.

The "docstring wider than 80 characters" warnings are left as they are: they only show up with native-comp-async-warnings-errors-kind set to all, and the project allows 100 columns on purpose.

Fixes #4201

cider-test-menu and cider-start-menu let-bind cider-test-default-*-selectors
and cider-edit-jack-in-command around the command they run, but those
defcustoms come later in their files.  A file compiled in a fresh Emacs, as
native compilation does, treats the bindings as lexical, so the menu's
selector and edit-command arguments never reached the code reading them.
Native compilation byte-compiles each file in a fresh Emacs, so a file
only knows the functions it requires or declares.  Several relied on
another file having been loaded first, which triggered "not known to be
defined" warnings on native-comp builds.
lm-with-file is a macro, but lisp-mnt was only required at runtime, so a
standalone compile emitted a plain function call.  The version lookup
then failed inside ignore-errors and the Version-header fallback never
worked.
Several files read variables that are defined further down or in another
file, which the byte compiler flags as free variables when a file is
compiled on its own.  Move the definitions up where they're local, and
declare the rest.  cider-test now silences the obsolete warning for
cider-auto-select-error-buffer, which it still reads on purpose.
eldev compile builds everything in one Emacs, so functions and variables
from files loaded earlier hide missing requires and declarations.  Native
compilation compiles each file in a fresh process and reports them to
users.  compile-isolated does the same, and CI runs it after the regular
byte-compile.

This branch has not been deployed

No deployments
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.

--edit-command (-e) in cider-start-menu is ignored when cider.el is natively compiled

1 participant