joaotavora / sly

Sylvester the Cat's Common Lisp IDE
1.23k stars 139 forks source link

Unable to start sly on Windows #584

Closed simendsjo closed 1 year ago

simendsjo commented 1 year ago

First try on Windows, so I'm not really sure where to start.

EDIT: If I start sbcl in a terminal, create a server, and connect from emacs. So it's something with launching sbcl from emacs..?

; caught ERROR:
;   during macroexpansion of
;   (FORMATTER "~
;   ;; Event history end.~%~
;   ;; Backtrace:~%~{~A~%~}~
;   ;; Connection to Emacs lost. [~%~
;   ;;  condition: ~A~%~
;   ;;  type: ~S~%~
;   ;;  style: ~S]~%").
;   Use *BREAK-ON-SIGNALS* to intercept.
;   
;    error in FORMAT: Unknown directive (character: Return)
;     ~
;   ;; Event history end.~%~
;   ;; Backtrace:~%~{~A~%~}~
;   ;; Connection to Emacs lost. [~%~
;   ;;  condition: ~A~%~
;   ;;  type: ~S~%~
;   ;;  style: ~S]~%
;      ^

Full output

(cond ((ignore-errors (funcall 'require "asdf") (funcall (read-from-string "asdf:version-satisfies") (funcall (read-from-string "asdf:asdf-version")) "2.019")) (push (pathname "c:/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/") (symbol-value (read-from-string "asdf:*central-registry*"))) (funcall (read-from-string "asdf:load-system") :slynk) (funcall (read-from-string "slynk:start-server") "c:/tmp/sly.14320")) (t (progn (load "c:/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/slynk-loader.lisp" :verbose t) (funcall (read-from-string "slynk-loader:init")) (funcall (read-from-string "slynk:start-server") "c:/tmp/sly.14320"))))

This is SBCL 2.3.2, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
To load "cffi":
  Load 1 ASDF system:
    cffi
; Loading "cffi"
.............
* WARNING:
   redefining EMACS-INSPECT (#<SB-PCL:SYSTEM-CLASS COMMON-LISP:T>) in DEFMETHOD
; compiling file "c:/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/slynk.lisp" (written 31 MAR 2023 11:47:11 AM):

; file: c:/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/slynk.lisp
; in: DEFUN CLOSE-CONNECTION%
;     (FORMAT SLYNK:*LOG-OUTPUT* "~
;   ;; Event history end.~%~
;   ;; Backtrace:~%~{~A~%~}~
;   ;; Connection to Emacs lost. [~%~
;   ;;  condition: ~A~%~
;   ;;  type: ~S~%~
;   ;;  style: ~S]~%"
;             (LOOP SLYNK::FOR (SLYNK::I SLYNK::F) SLYNK::IN SLYNK::BACKTRACE
;                   SLYNK::COLLECT (IGNORE-ERRORS
;                                   (FORMAT NIL "~d: ~a" SLYNK::I
;                                           (SLYNK::ESCAPE-NON-ASCII SLYNK::F))))
;             (SLYNK::ESCAPE-NON-ASCII (SLYNK::SAFE-CONDITION-MESSAGE CONDITION))
;             (TYPE-OF CONDITION) (SLYNK::CONNECTION-COMMUNICATION-STYLE SLYNK::C))
; 
; caught ERROR:
;   during macroexpansion of
;   (FORMATTER "~
;   ;; Event history end.~%~
;   ;; Backtrace:~%~{~A~%~}~
;   ;; Connection to Emacs lost. [~%~
;   ;;  condition: ~A~%~
;   ;;  type: ~S~%~
;   ;;  style: ~S]~%").
;   Use *BREAK-ON-SIGNALS* to intercept.
;   
;    error in FORMAT: Unknown directive (character: Return)
;     ~
;   ;; Event history end.~%~
;   ;; Backtrace:~%~{~A~%~}~
;   ;; Connection to Emacs lost. [~%~
;   ;;  condition: ~A~%~
;   ;;  type: ~S~%~
;   ;;  style: ~S]~%
;      ^

; wrote C:/Users/simend/AppData/Local/cache/common-lisp/sbcl-2.3.2-win-x64/c/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/slynk-tmpGHU3ALSV.fasl
; compilation finished in 0:00:00.534

debugger invoked on a UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {10044982F3}>:
  COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "slynk" "slynk">

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry
                                     compiling #<CL-SOURCE-FILE "slynk" "slynk">.
  1: [ACCEPT                       ] Continue, treating
                                     compiling #<CL-SOURCE-FILE "slynk" "slynk">
                                     as having been successful.
  2:                                 Retry ASDF operation.
  3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
                                     configuration.
  4:                                 Retry ASDF operation.
  5:                                 Retry ASDF operation after resetting the
                                     configuration.
  6: [ABORT                        ] Exit debugger, returning to top level.

(UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "slynk" "slynk">)))
   error finding frame source: Bogus form-number: the source file has probably
                               changed too much to cope with.
   source: NIL
joaotavora commented 1 year ago

Please try with SLY from git instead of "straight" and try again.

Also please attach the slynk.lisp file here exactly as it appears in your file system: c:/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/slynk.lisp

The error is complaining about a #\Return character, but there are no return characters in that file. Unless maybe the (unsupported) "straight" installation method has added Windows line endings to that file.

joaotavora commented 1 year ago

Oh no :-) "attach" doesn't mean "copy and paste" . That's a huuuge file. And it would defeat the purpose of looking for CRLF line endings. Try to attach using some other means like an external site, or just drag the file here.

joaotavora commented 1 year ago

Like this seems to work.

test.txt

simendsjo commented 1 year ago

Here's the version I had: https://github.com/joaotavora/sly/commit/f34c22289a2b

joaotavora commented 1 year ago

No, but that's not the same~! I need the file from your file system. I want to check if it has CRLF line endings. Sometimes git or other things put CRLF line endings on a file, it's common on windows. I want to rule this out. Please attach the file like I showed in the example.

joaotavora commented 1 year ago

Open Windows explorer and drag c:/Users/simend/.emacs.d/.local/straight/build-28.2/sly/slynk/slynk.lisp to this github comment box.

simendsjo commented 1 year ago

slynk.txt

EDIT: Had to rename it to txt as github didn't want to upload a .lisp file.

joaotavora commented 1 year ago

Thanks. as I suspected, your slynk.txt has CRLF line endings. This is what's making trouble here. Try to replace it with this file. slynk-without-crlf-endings.txt

Also also, try installing SLY via the officially supported installation method in the README.md.

joaotavora commented 1 year ago

Just double-checked that installing via M-x package-install RET sly doesn't do this, it uses correct "Unix" line endings. So this is not a bug in SLY.

simendsjo commented 1 year ago

Just double-checked that installing via M-x package-install RET sly doesn't do this, it uses correct "Unix" line endings. So this is not a bug in SLY.

Oof, god how I hate Windows :( Looks like autocrlf=true is the culprit then. Which is the default on Windows, and required for other things.

Sorry about this, I'll try to find a workaround.

joaotavora commented 1 year ago

Oof, god how I hate Windows :(

I feel you :-) truly do

Looks like autocrlf=true is the culprit then. Which is the default on Windows, and required for other things.

But I tested ou windows with M-x package-install and didn't have this problem :-)

simendsjo commented 1 year ago

But I tested ou windows with M-x package-install and didn't have this problem :-)

I'm not sure what that does. The straight setup fetches from git, and I notice .git/config in the repository has autocrlf=true, so it will be broken already on checkout. I just manually ran dos2unix on the files, and now it works (until the next update.)

joaotavora commented 1 year ago

maybe you should report this to "straight".

joaotavora commented 1 year ago

I'm not sure what that does.

package-install is the official way to install packages on Emacs. it's not "straight".

simendsjo commented 1 year ago

maybe you should report this to "straight".

Yes, maybe autocrlf=false would be a good thing to enforce, but that might very well break the other way around when things expect windows newlines :/

package-install is the official way to install packages on Emacs. it's not "straight".

I'm using Doom Emacs, and Spacemacs before that. I'm not really at the level where I can start building my own config from scratch (even though I've been using emacs since 2015....)

joaotavora commented 1 year ago

I'm not really at the level where I can start building my own config from scratch (even though I've been using emacs since 2015....)

You dont' have to build a new config. Just use vanilla Emacs. Then you can report problems to Emacs itself, where we can fix them to make it a better program. If you use Spacemacs and its thingamabobs, this "voids your Emacs warranty" in a sense. Or at least you should report all problems to Spacemacs.

simendsjo commented 1 year ago

maybe you should report this to "straight".

Yes, maybe autocrlf=false would be a good thing to enforce, but that might very well break the other way around when things expect windows newlines :/

https://github.com/radian-software/straight.el/issues/1071