Skip to content

Put native compiled files in user-emacs-directory/eln-cache#910

Merged
rswgnu merged 2 commits intomasterfrom
pr_fix_native_compile_target
Mar 21, 2026
Merged

Put native compiled files in user-emacs-directory/eln-cache#910
rswgnu merged 2 commits intomasterfrom
pr_fix_native_compile_target

Conversation

@matsl
Copy link
Collaborator

@matsl matsl commented Mar 21, 2026

What

Put native compiled files in user-emacs-directory/eln-cache.

  • Makefile (HYPB_BYTE_COMP_ELN_LOAD_PATH): Add users eln-cache last in native-comp-eln-load-path so that batch-byte+native-compile uses that for storing the en-files. (%.elc): Use HYPB_BYTE_COMP_ELN_LOAD_PATH.

Why

The function batch-byte+native-compile stores the eln files in the last dir in native-comp-eln-load-path. This means that the system folder is preferred by this function. Only workaround is to append the user cache last. This was unnoticed since I used native compilation on a machine where I also build Emacs for the user and have write permission in the system folder. When trying the eln target on a machine with a system installed Emacs this does not work.

Note

I'm really thinking of removing the native build support from the Makefile. It does not seem to give us anything since the byte compilation provides all warnings and errors.

* Makefile (HYPB_BYTE_COMP_ELN_LOAD_PATH): Add users eln-cache last in
    native-comp-eln-load-path so that batch-byte+native-compile uses that
    for storing the en-files.
    (%.elc): Use HYPB_BYTE_COMP_ELN_LOAD_PATH.
@matsl matsl requested a review from rswgnu March 21, 2026 13:24
@rswgnu
Copy link
Owner

rswgnu commented Mar 21, 2026 via email

@rswgnu
Copy link
Owner

rswgnu commented Mar 21, 2026

Also look at whether remove-package will update the eln-cache.

@rswgnu rswgnu merged commit 512f444 into master Mar 21, 2026
4 checks passed
@matsl
Copy link
Collaborator Author

matsl commented Mar 21, 2026

I think a lot of people today use native compilation so having a make target and build hyperbole with that is a useful feature to have if we can work out the location location to save the ELN files.

Having a make target for it is not really needed and its usefulness can be questioned:

  1. Native compiled code is generally incompatible between systems so it can't practically be packaged.
  2. Further more, an Emacs that can compile and load native code will by default native compile a file when loaded and replace the elc-loaded file with the definitions from the eln-file. That process is performed async in the background. Next time the eln-file will be used directly.
  3. Users who download Hyperbole and have the parameter package-native-compile set to t will get the Hyperbole natively compiled as part of the installation.

@matsl
Copy link
Collaborator Author

matsl commented Mar 21, 2026

Also look at whether remove-package will update the eln-cache.

I don't think that is a problem. The eln-file is not standalone as elc. Without an el- or elc-file it will not be used and I think there are timestamp and hash-code checks that the eln-file is a valid native version of the source file.

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.

2 participants