Slime: Windows SBCL with Cygwin Emacs

Discussion of Common Lisp
Post Reply
schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Slime: Windows SBCL with Cygwin Emacs

Post by schoppenhauer » Thu Feb 11, 2010 2:57 am

Hello.

I currently changed to windows, and I am currently using the Emacs from Cygwin (and actually I want to keep it that way if possible). I installed slime and it works well with clisp.

Unfortunately there is no SBCL which is compatible with Cygwin it seems, so I installed the Windows-Version of SBCL and tried to run it in slime. I get the error message that SIGPIPE was sent to the application. SIGPIPE means - as far as I read - that some pipe which was opened wasnt opened by the other side.

I tried with directly opening a tcp-swank-server and connecting emacs, and seems like emacs is able to connect to it, but doesnt start a repl.

Any suggestions?
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

TheGZeus
Posts: 79
Joined: Mon Jun 30, 2008 10:46 am

Re: Slime: Windows SBCL with Cygwin Emacs

Post by TheGZeus » Thu Feb 11, 2010 5:52 am

SBCL-windows isn't that well-supported, as I recall.

Kinda what comes with a legacy OS.

schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Re: Slime: Windows SBCL with Cygwin Emacs

Post by schoppenhauer » Thu Feb 11, 2010 6:03 am

Whats a good alternative then? CLISP works but is too slow for graphics output with lispbuilder-sdl. I could try ECL but it will certainly also be comparably slow (and isnt yet supported afaik).

Maybe Clozure? I read it has x86_64 support also for Windows, but not yet tried it.
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Re: Slime: Windows SBCL with Cygwin Emacs

Post by schoppenhauer » Thu Feb 11, 2010 2:02 pm

Ok, I tried clozure. Directly connecting via TCP works (would be a solution if nothing else works). But when starting through emacs, it complains that it cannot find the given lisp-file swank-loader.lisp, since it has a cygwin-path, not a windows-path.

I had similar problems with petite scheme. I just overloaded the load-function there. But maybe there is a default way of handling cygwin-filenames with clozure?
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Slime: Windows SBCL with Cygwin Emacs

Post by gugamilare » Thu Feb 11, 2010 6:47 pm

schoppenhauer wrote:Whats a good alternative then? CLISP works but is too slow for graphics output with lispbuilder-sdl. I could try ECL but it will certainly also be comparably slow (and isnt yet supported afaik).
Are you sure Clisp is not fast enough, did you test it? Some people tested it and it worked well enough. And ECL is supported in Windows, but you will have to compile it using Cygwin or Microsoft Visual C++ Toolkit (the later is recommended).

AFAIK, ECL is faster than Clisp, since it compiles to C, not to bytecode, but it is not as stable. ECL might get even faster with the new compiler being developed now, but the new compiler is not stable yet.
schoppenhauer wrote:Ok, I tried clozure. Directly connecting via TCP works (would be a solution if nothing else works). But when starting through emacs, it complains that it cannot find the given lisp-file swank-loader.lisp, since it has a cygwin-path, not a windows-path.
Then change the reference in the file .emacs to the correct windows path.

schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Re: Slime: Windows SBCL with Cygwin Emacs

Post by schoppenhauer » Thu Feb 11, 2010 7:17 pm

gugamilare wrote:Are you sure Clisp is not fast enough, did you test it? Some people tested it and it worked well enough. And ECL is supported in Windows, but you will have to compile it using Cygwin or Microsoft Visual C++ Toolkit (the later is recommended).
Clisp wasnt fast enough one year ago. Its the ffi-calls. And the dffi-calls of ECL were also slow (and I couldnt find out how to turn their bytecode-interpreter off).
gugamilare wrote:Then change the reference in the file .emacs to the correct windows path.
There is no reference to swank-loader.lisp in the .emacs, seems hardcoded in slime.
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Slime: Windows SBCL with Cygwin Emacs

Post by gugamilare » Thu Feb 11, 2010 8:20 pm

schoppenhauer wrote:(and I couldnt find out how to turn their bytecode-interpreter off).
Just compile the files or the functions you need and you are done 8-)
schoppenhauer wrote:
gugamilare wrote:Then change the reference in the file .emacs to the correct windows path.
There is no reference to swank-loader.lisp in the .emacs, seems hardcoded in slime.
Sorry, my mistake. Slime gets the path of swank-loader.lisp from Emacs. So you can try to change Slime's code or download the windows version of Emacs. You can also try finding some option from Slime's manual as well if you want to keep Cygwin's Emacs.

schoppenhauer
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany
Contact:

Re: Slime: Windows SBCL with Cygwin Emacs

Post by schoppenhauer » Fri Feb 12, 2010 11:23 am

The reason why I want to keep Cygwin's Emacs is that I want one emacs for all things I do, I dont want to maintain multiple .emacs-files.

In Scheme, I wrote a little script

Code: Select all

;; hack for mzscheme substrings in petite
(define old-substring substring)
(define (substring str x . y)
  (if (pair? y)
      (old-substring str x (car y))
      (old-substring str x (string-length str))))

(define (backslash-replace x . y)
  (if (equal? "" x) (list->string (reverse y))
      (apply backslash-replace
             (substring x 1)
             (cons
              (let ((a (string-ref x 0)))
                (if (equal? a #\/) #\\ a)) y))))

(define (translate-pathname x username)
  "Translate a given cygwin-pathname to a windows-pathname"
  (cond
   ((equal? (substring x 0 10) "/cygdrive/")
    ;; if pathname starts with /cygdrive/, then we need to add a drive
    ;; letter and leave out the C:\cygwin\ at the beginning
    (string-append
     (string (string-ref x 11) #\:)
     (backslash-replace (substring x 12))))
   ((equal? (string-ref x 0) #\/)
    ;; pathname begins with / - is absolute
    (string-append "C:\\cygwin" (backslash-replace x)))
   ((and (equal? (string-ref x 0) #\~)
         (equal? (string-ref x 1) #\/))
    ;; pathname is own homedir
    (translate-pathname
     (string-append "/home/" username (substring x 1)) username))
   ((equal? (string-ref x 0) #\~)
    ;; pathname is other homedir
    (translate-pathname
     (string-append "/home/" (substring x 1)) username))
   (#t ;; pathname is not absolute
    (backslash-replace x))))

(define (maybe-translate-pathname x username)
  "Implement a simple heuristic what type a pathname is and convert it
into a windows-pathname."
  (let ((x-list (string->list x)))
    (cond
     ((member #\/ x-list)
      ;; path contains slash - which is forbidden under windows
      (translate-pathname x username))
     ((member #\\ x-list)
      ;; path contains backslash - is likely to be windows-pathname
      x)
     ((equal? (cadr x-list) #\:)
      ;; is second sign a colon? - then its likely to be a windows-path
      x)
     ((equal? (car x-list) #\~)
      ;; begins with tilde - more likely to be unix-pathname
      (translate-pathname x username))
     (#t
      ;; no backslash or slash - shouldnt matter
      x))))

(define old-load load)

(set! load (lambda (path)
             (old-load (maybe-translate-pathname path "schoppenhauer"))))
I will probably port it to ccl and overwrite its load-function (hopefully it will work then).
Sorry for my bad english.
Visit my blog http://blog.uxul.de/

Post Reply