0

I have just tried to setup magit using straight.el in my init file as follows:

(use-package magit
       :straight t
       :bind ("C-x g" . magit-status)
       :commands (magit-status magit-get-current-branch))

However upon restarting emacs (v28.1) on my macOS (Montery v12.2.1) I get the following error message:

command-execute: Cannot open load file: No such file or directory, ../../../../../../../.emacs.d/straight/build/magit/magit-status

For some reason straight.el seems to be searching for the clone in several directories above the current one. It seems to be doing this to many other newly installed packages, e.g. projectile.

Note that my ~/.emacs.d is symlinked to my dropbox folder in case that is relevant:

.emacs.d -> ~/DROPBOX/REPOS/dotfiles/.emacs.d

It seems that a similar issue has been flagged here, but I'm not sure what the resolution is. For reference here is my init file.

How can this be rectified?

Update: I've cross-posted this here, since the comments to this post lead back to this thread. I will post any helpful responses on either thread to the other one to ensure that the responses are passed onto users with the same issue.

user4687531
  • 143
  • 5
  • Do you have `find-file-visit-truename` set? If yes, try setting it to `nil`. You can check a related question. https://emacs.stackexchange.com/questions/69066/problem-loading-packages-with-emacs-28 – Swarnendu Biswas Jun 20 '22 at 01:46
  • @SwarnenduBiswas - thanks for the suggestion. Unfortunately the same issue occurs. I placed your suggested line *before* setting up `straight.el`. Is that how you did it?. [Here](https://github.com/shamindras/ss_dotfiles/blob/main/.emacs.d/myinit.el) is my init file in case that helps – user4687531 Jun 20 '22 at 02:56
  • Not answering your questions in any way, I just wanna mention that you can give `chemacs2` a try and perhaps you'll no longer need your .emacs.d symlink and then your problem might just go away. – TerryTsao Jun 20 '22 at 02:59
  • Also [here](https://github.com/blaenk/dots/blob/master/emacs/.emacs.d/init.el#L60-L65) is another suggested [workaround](https://github.com/radian-software/straight.el/issues/701#issuecomment-1094153050) from the thread I flagged above. I tried placing this after `straight.el` setup as per the repo above. It did not resolve this issue either. Any ideas? – user4687531 Jun 20 '22 at 02:59

1 Answers1

1

I am posting the solution that worked for me, based on the helpful suggestions by @Swarnendu Biswas above, and the github user @croqaz in this thread.

In short, simply adding (setq find-file-visit-truename nil) was not enough for me. Crucially I had to delete the straight installation directory, and rebuild everything from scratch. As per my post in the mentioned thread, I performed the following steps to resolve the issue:

  1. Backup ~/.emacs.d dir
  2. Deleted the entire ~/.emacs.d/straight dir.
  • This is more than what @croqaz suggested (i.e. to just delete ~/.emacs.d/straight/build dir only), but I just wanted to be quite cautious to resolve this issue.
  • Re-installing everything from scratch took less than a minute for me. Thanks to straight.el
  1. Ensure that (setq find-file-visit-truename nil) is included in my init file after bootstrapping straight.el.
  2. Do a quick search for setq find-file-visit-truename and check that we have set it to nil and not t anywhere else.
    • I had it set to t in my dired, which I removed.
    • This did cause me issues, but were resolved after removing it and setting it to nil only once as per above.

I hope this provides some guidance for others when faced with this issue.

user4687531
  • 143
  • 5