Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1053] Handle renamed native-comp variable in Emacs 30 #1054

Merged
merged 1 commit into from
Feb 25, 2023

Conversation

raxod502
Copy link
Member

Closes #1053

@frumigoul
Copy link

Hi, when will this fix be merged into the Develop branch?
I tried to work from this commit, but somehow did not find the way to implement it in my init.el (sorry, emacs newbie here).
Thanks for the good work!

@Panadestein
Copy link

Pardon the impatience, but I would like to second the previous comment. This PR is kind of a bottleneck in my config now. Thanks for the effort!

@j0ni
Copy link

j0ni commented Feb 20, 2023

Folks who are stuck behind this, you can do this before initializing straight.el to get it working.

(setq straight-repository-branch "rr-fix-renamed-variable")

Edit to add: this is obv a temporary workaround, and as soon as this branch is deleted will probably break. But you knew that :)

@petergardfjall
Copy link

petergardfjall commented Feb 20, 2023

This PR solves the issue for me as well.

@j0ni: your fix with setting straight-repository-branch prior to running the init snippet did not work for me.

Edit: starting without straight/repos/straight.el/ I had to (1) start emacs and see straight fail (2) go to straight/repos/straight.el/ and run git checkout --track origin/rr-fix-renamed-variable, (3) restart emacs. Only then did it work.

Edit: I'm on the HEAD of the emacs-29 branch.

@j0ni
Copy link

j0ni commented Feb 20, 2023

@petergardfjall I guess I should have mentioned that you would need to remove your existing straight installation subdir to force it to re-clone. My apologies.

@petergardfjall
Copy link

petergardfjall commented Feb 20, 2023

@petergardfjall I guess I should have mentioned that you would need to remove your existing straight installation subdir to force it to re-clone. My apologies.

@j0ni Interestingly, when I tried your approach on an older version of Emacs (emacs-mirror/emacs@fdac69b) just deleting straight/repos/straight.el/ and then restarting emacs worked fine: the straight-repository-branch setting was honored and the right straight.el branch was checked out.

However, when running on a more recent commit (on branch emacs-29) your proposed approach did not work and I had to check out the branch myself (as I hinted at in my earlier comment).

If I haven't completely messed up somehow it appears like the install.el script broke after Emacs changes introduced somewhere between fdac69b..02aba20.

Running emacs -q --load install.el without straight/repos/straight.el/ directory then gives:

Bootstrapping straight.el...
if: straight.el bootstrap failed: Package autoload is deprecated
Symbol’s value as variable is void: straight-install-dir
Cloning straight.el...
Cloning straight.el...done

Error: void-variable (straight-install-dir)
  debug-early-backtrace()
  debug-early(error (void-variable straight-install-dir))
  (concat straight-install-dir "straight/bootstrap.el")
  (let* ((recipe (gethash "straight" straight--recipe-cache)) (local-repo (plist-get recipe :local-repo)) (link-target (concat "repos/" local-repo "/bootstrap.el")) (link-name (concat straight-install-dir "straight/bootstrap.el"))) (condition-case nil (progn (delete-file link-name)) (error nil)) (if (and (boundp 'straight-use-symlinks) straight-use-symlinks) (if (straight--windows-os-p) (call-process "cmd" nil nil nil "/c" "mklink" (subst-char-in-string 47 92 link-name) (subst-char-in-string 47 92 link-target)) (make-symbolic-link link-target link-name)) (let ((temp-file link-name) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (print (cons 'load (cons (cons 'expand-file-name (cons link-target '((file-name-directory load-file-name)))) '(nil 'nomessage))) (current-buffer))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  (if (and (boundp 'bootstrap-version) (integerp bootstrap-version) (>= bootstrap-version 3)) nil (let* ((recipe (gethash "straight" straight--recipe-cache)) (local-repo (plist-get recipe :local-repo)) (link-target (concat "repos/" local-repo "/bootstrap.el")) (link-name (concat straight-install-dir "straight/bootstrap.el"))) (condition-case nil (progn (delete-file link-name)) (error nil)) (if (and (boundp 'straight-use-symlinks) straight-use-symlinks) (if (straight--windows-os-p) (call-process "cmd" nil nil nil "/c" "mklink" (subst-char-in-string 47 92 link-name) (subst-char-in-string 47 92 link-target)) (make-symbolic-link link-target link-name)) (let ((temp-file link-name) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (print (cons 'load (cons (cons 'expand-file-name (cons link-target '((file-name-directory load-file-name)))) '(nil 'nomessage))) (current-buffer))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))))
  load-with-code-conversion("/tmp/straight.el~i9rUag" "/tmp/straight.el~i9rUag" nil t)
  command-line-1(("--load" "/tmp/straight.el~i9rUag"))
  command-line()
  normal-top-level()

@j0ni
Copy link

j0ni commented Feb 20, 2023

@petergardfjall interesting.

I am using locally compiled emacs 30.0.50, rebuilt every few days. Configured thusly:

./configure --with-mailutils --with-native-compilation=aot --with-x-toolkit=lucid --with-tree-sitter --with-json --with-rsvg

I run this on three Arch Linux systems, though one has no head and I build it without an X11 toolkit. On each system it runs as a systemd user service and I use emacsclient for working.

I quite often update all the straight packages, but that does not do anything to the straight build itself (I don't think). Normally that goes like this:

(straight-pull-recipe-repositories)
(straight-pull-all)
(straight-rebuild-all)

Every so often (or when something breaks) I delete the ELN cache and the straight subdirectory (the whole thing, with all the packages in it) and let it bootstrap again. Normally I start emacs separately using the --debug-init flag when I do that, but it usually completes (in a few minutes) without problem.

The reason I do this is because I don't trust all the cached native code, and emacs bytecode, and straight build artifacts to be in a consistent state being as how I'm always fiddling. This guarantees the freshest of meats.

That's what I ended up doing this time, fwiw - I didn't try any intermediate cleanup.

Not that it should be relevant but my current emacs config is available here on sourcehut.

Sorry if I sent you down a rabbit-hole!

@zetaomegagon
Copy link

Thanks @j0ni worked perf for me 👍

@benthamite
Copy link

I can confirm that @petergardfjall's method works with Emacs 30:

  1. $ cd ~/.emacs.d/straight/repos/straight.el
  2. $ git checkout --track origin/rr-fix-renamed-variable
  3. Launch Emacs.

@raxod502
Copy link
Member Author

I unfortunately don't have enough free time to attend to PRs more often than every week or two. But you should be able to use any desired revision of straight.el by simply visiting ~/.emacs.d/straight/repos/straight.el and checking out whatever you like.

@benthamite
Copy link

Also worth noting that this fix won't work if you are on the "master" branch. Just set straight-repository-branch to "develop".

@zetaomegagon
Copy link

@raxod502 IMO, that's fine.* straight.el is great and I super duper appreciate your work. 🙏

*esp when I run off emacs/master. I could be running off a stable branch, but I chose not to.

mjrusso added a commit to mjrusso/.emacs.d that referenced this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants