On a fresh install of Emacs 27.1, have to clone straight.el in to .emas.d/straight/repos/straight.el to install straight.el,
otherwise, emacs will hang on start, this also happens with the msys version of emacs 27.1, and my self-compiled native-comp branch emacs.
In a fresh install emacs, with empty .emacs.d folder, and a init.el with following content:
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
Then start emacs.exe or runemacs.exe. emacs will hang but with abnormally high cpu usage.
I dont recall such a problem in windows 10 version 1909, so maybe its a windows problem?...
Not sure what this could be. Here are some things that might help identify the problem:
Does it print anything before hanging? If you type C-g or send SIGUSR2 to Emacs (I don't know if the latter is even possible in Windows), does that produce any useful behavior? If you add (setq debug-on-error t) and/or (setq debug-on-quit t) before the bootstrap snippet, does that manage to produce a stack trace when you poke Emacs while hung?
Does it print anything before hanging? If you type
C-gor sendSIGUSR2to Emacs (I don't know if the latter is even possible in Windows), does that produce any useful behavior?
C-g can un-hung up emacs, but will wont throw up a backtrace buffer or anything, in Message buffer there is only a single line:
Quit
If you add
(setq debug-on-error t)and/or(setq debug-on-quit t)before the bootstrap snippet, does that manage to produce a stack trace when you poke Emacs while hung?
Also tried this, but nothing showed up, I tried like 10 time, 2 of these I get a error said :
GnuTLS error: raw.githubusercontent.com, -53
but most of the time it will hang up forever until I hit C-g.
from https://gnutls.org/manual/html_node/Error-codes.html :
-53 GNUTLS_E_PUSH_ERROR Error in the push function
This thread suggests a networking issue:
https://forum.filezilla-project.org/viewtopic.php?t=14574
Emacs 27.1 ships with more secure TLS defaults, too:
https://www.masteringemacs.org/article/whats-new-in-emacs-27-1
TLS connections have their security tightened by default.
Most of the checks for outdated, believed-to-be-weak TLS algorithms
and ciphers are now switched on by default. (In addition, several new
TLS weaknesses are now warned about.) By default, the NSM will
flag connections using these weak algorithms and ask users whether to
allow them. To get the old behavior back (where certificates are
checked for validity, but no warnings about weak cryptography are
issued), you can either set 'network-security-protocol-checks' to nil,
or adjust the elements in that user option to only happen on the 'high'
security level (assuming you use the 'medium' level).
Sounds like a possible networking issue?
Thanks, after I set up a proxy for emacs, now it won't hang up, but will still complains about cannot find bootstrap.el, then refuse to continue. The .emacs.d\straight\repos folder now automatically created but nothing is in the folder.
This shouldn't happen right? Because the unless expression should execute and download install.el if emacs can't find bootstrap.el
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "c:/home/.emacs.d/straight/repos/straight.el/bootstrap.el")
load("c:/home/.emacs.d/straight/repos/straight.el/bootstrap.el" nil nomessage)
(let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (if (file-exists-p bootstrap-file) nil (save-current-buffer (set-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straigh..." 'silent 'inhibit-cookies)) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage))
eval-buffer(#<buffer *load*> nil "c:/home/.emacs.d/init.el" nil t) ; Reading at buffer position 905
load-with-code-conversion("c:/home/.emacs.d/init.el" "c:/home/.emacs.d/init.el" t t)
load("c:/home/.emacs.d/init" noerror nomessage)
startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1448865>) #f(compiled-function () #<bytecode 0x1448879>) t)
command-line()
normal-top-level()
Try evaluating this and copying the output of the *Pp Eval Output* buffer here:
(progn
(require 'pp)
(pp-eval-expression
'(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/install/beta/straight.el"
nil 'inhibit-cookies)
(buffer-string))))
Here it is, the evaluated output is too long I have to use attachments.
Pp-Eval-Output.txt
Thank you. The output looks fine to me. My hunch so far is that this is a networking or permissions error. I would try manually downloading install.el and stepping through the code to see if/where it is failing. Unfortunately I do not have a Windows machine available to try this myself. For completeness sake, may we have the output of M-x straight-version?
Yeah, I seem to recall that "install code executed, but bootstrap.el somehow not created" is common on Windows when something goes wrong. We would expect to see an error if something goes wrong, but apparently errors are not always reported on Windows. I wonder why.
For what it's worth, I sidestep this issue on Windows by wrapping the provided bootstrap code in a function (below, acdw/bootstrap-straight) and running it via this snippet:
(unless (ignore-errors (acdw/bootstrap-straight))
(message "%s" "Straight.el didn't bootstrap correctly. Cloning directly...")
(call-process "git" nil
(get-buffer-create "*bootstrap-straight-messages*") nil
"clone"
"https://github.com/raxod502/straight.el"
(expand-file-name "straight/repos/straight.el"
user-emacs-directory))
(acdw/bootstrap-straight))
Maybe it'd be a good idea to add something to this effect as a FAQ item, or something?
@duckwork can you provide a way to reproduce the error? Sidestepping is useful, but it would be much better to understand what's going wrong and add a proper fix.
I can try stepping through it later this week, per the instructions earlier in this thread.
Sorry fot this late response, M-x straight-version echos prerelease nil for me.
I also tried to adjust the permissions of my .emacs.d folder, change owner of it, move the folder out of C driver, use git-for-windows instead of msys git...etc, but it just won't work. I can almost sure that this have no deal with the permission.
Eventually I found this is still a wired network issue, setup proxy in init.el won't work for bootstrap straight.el somehow (it works for eww after init though), git config --global also have no effect,
I have to use export http_proxy='some/porxy/' and export https_proxy='some/proxy/' in msys bash then ./emacs.exe in msys bash.
Another proof is @duckwork's method won't work for me unless I set up the proxy discribed earlier.
So my fix is use msys bash (or git bash that comes with git-for-windows, tested, also works) and
export http_proxy='http://my.proxy.server:ports'
export https_proxy='https://my.proxy.server:ports'
then try excute emacs.exe or runemacs.exe from the same bash shell.
No sure if this is a nice fix but it should works for people who use the zip package version fo emacs on windows too.
Thank you. The output looks fine to me. My hunch so far is that this is a networking or permissions error. I would try manually downloading
install.eland stepping through the code to see if/where it is failing. Unfortunately I do not have a Windows machine available to try this myself. For completeness sake, may we have the output ofM-x straight-version?
M-x straight-version echos
prerelease nil
This leads me to believe that straight is having trouble executing git in your environment.
Can you try evaluating the following in your *scratch* buffer and paste the output?:
(let ((straight-process-buffer "*straight-windows-git-test*")
(inhibit-read-only t))
(with-current-buffer straight-process-buffer
(delete-region (point-min) (point-max))
(straight--call "git" "--version")
(buffer-string)))
I ran the pp code provided by @progfolio today, and it gave the same result as @pRot0ta1p. In addition, when the code actually runs on startup, I don't get any indication that it's downloading anything -- of course, I don't know why. I'm using the Emacs for windows build from emacs.org (27.1), and Portable Git, from where I don't remember. Sorry I'm not the most helpful right now, will try to test more this week.
This leads me to believe that straight is having trouble executing git in your environment.
Can you try evaluating the following in your scratch buffer and paste the output?:
After a success bootstrap using the export https_proxy in a msys bash like I described earlier, these are printed in bufer *straight-windows-git-test*
$ cd e\:/Download/emacs-27.1-x86_64/bin/
$ git --version
git version 2.30.0
[Return code: 0]
Also tried with this init.el in a empty .emacs.d folder, same resualt
````emacs-lisp
(setq debug-on-error t)
(setq debug-on-quit t)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(find-file "straight-windows-git-test")
(let ((straight-process-buffer "straight-windows-git-test")
(inhibit-read-only t))
(with-current-buffer straight-process-buffer
(delete-region (point-min) (point-max))
(straight--call "git" "--version")
(buffer-string)))
````
Most helpful comment
I can try stepping through it later this week, per the instructions earlier in this thread.