flathub / flathub/org.gnu.emacs

Do not compress jka-compr.el

Open
#78 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
18
Forks
20
Avg merge
23h 32m
Merged PRs (30d)
1

Description

The library `jka-compr` is used to load compressed libraries (`.el.gz`). When it's itself compressed one can encounter recursive load issue. For example:
```
Warning (initialization): An error occurred while loading ~/.emacs.d/init.el’:

error: Recursive load, /app/share/emacs/29.4/lisp/jka-compr.el.gz, /app/share/emacs/29.4/lisp/jka-compr.el.gz, /app/share/emacs/29.4/lisp/jka-compr.el.gz, /app/share/emacs/29.4/lisp/jka-compr.el.gz, /app/share/emacs/29.4/lisp/jka-compr.el.gz, /app/share/emacs/29.4/lisp/info.el.gz, /home/khaoos/.emacs.d/init.el
```
It's happening on a fresh spacemacs installation (dev branch) due to the lines in `~/.emacs.d/layers/+spacemacs/spacemacs-defaults/config.el
```
;; Don't load outdated compiled files.
(setq load-prefer-newer t)
```
As soon as I comment them out, issue dissapears. It seems that emacs tries to recompile the library `jka-compr` before its load when `load-prefer-newer` is set. As the uncompiled version of the library is a bit fresher (see Modify below):
``` bash
[📦 org.gnu.emacs lisp]$ pwd
/app/share/emacs/29.4/lisp
📦 org.gnu.emacs lisp]$ stat *jka-compr*
File: jka-compr.elc
Size: 12099 Blocks: 24 IO Block: 4096 regular file
Device: 259,2 Inode: 674859 Links: 2
Access: (0644/-rw-r--r--) Uid: (65534/nfsnobody) Gid: (65534/nfsnobody)
Access: 2024-09-22 12:51:01.736093903 +0600
Modify: 2024-09-22 12:51:01.736093903 +0600
Change: 2024-09-22 12:51:22.793010855 +0600
Birth: 2024-09-22 12:51:01.736093903 +0600
File: jka-compr.el.gz
Size: 7293 Blocks: 16 IO Block: 4096 regular file
Device: 259,2 Inode: 676551 Links: 2
Access: (0644/-rw-r--r--) Uid: (65534/nfsnobody) Gid: (65534/nfsnobody)
Access: 2024-09-22 12:51:01.920093179 +0600
Modify: 2024-09-22 12:51:01.921093175 +0600
Change: 2024-09-22 12:51:22.798010836 +0600
Birth: 2024-09-22 12:51:01.920093179 +0600
```

So I believe if you `touch jka-compr.elc` the problem will go away. Or a better option I think is just to not compress `jka-compr.el` at all. But you decide. I haven not tried any of them as the application is immutable and I am a newbie to flatpack to hack it around. As for now I've left setting `load-prefer-newer` above commented out.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting how the Flatpak build handles Emacs Lisp compression, with particular attention to jka-compr.el and the generated jka-compr.elc and jka-compr.el.gz files. Reproduce the load-prefer-newer scenario described in the issue and verify that loading jka-compr no longer causes recursive loading while compressed libraries still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.