The attached patch makes the mpd-client egg maintained by Vasilij Schneidermann 
work with C6. I also took the liberty of renaming disconnect to disconnect!, as 
it “destroys” its argument, and many other procedures exported by the egg also 
use the ! suffix.
In case if the current maintainer does not want to maintain the egg for C6, I 
can also publish the C6 version in a separate repo.
 
--- a/mpd-client.scm
+++ b/mpd-client.scm
@@ -5,7 +5,7 @@
   (;; mpd connection
    mpd-connection?
    mpd-host mpd-port mpd-password mpd-version
-   connect disconnect ping
+   connect disconnect! ping
 
    ;; server information and status
    get-commands get-stats get-status clear-error! shutdown-server!
@@ -26,18 +26,23 @@
    ;; playback control
    play! pause! stop! next-song! previous-song!)
 
-  (import scheme)
-  (import scheme)
-  (import (chicken base))
-  (import (chicken condition))
-  (import (chicken io))
-  (import (chicken port))
-  (import (chicken string))
-  (import (chicken tcp))
-  (import (chicken time))
-  (import (only (srfi 1) filter-map))
-  (import (only regex regexp string-search))
-
+  (cond-expand
+   (chicken-5
+    (import (scheme)))
+   (chicken-6
+    (import (scheme base)
+            (scheme char)
+            (scheme cxr)
+            (scheme write))))
+  (import (chicken base)
+          (chicken condition)
+          (chicken io)
+          (chicken port)
+          (chicken string)
+          (chicken tcp)
+          (chicken time)
+          (only (srfi-1) filter-map)
+          (only (regex) regexp string-search))
   
   (define-record-type :mpd-conn
     (make-mpd-conn host port password i o version time)
@@ -73,7 +78,7 @@
 
   (define (reconnect conn)
     (if (in-port conn)
-        (disconnect conn))
+        (disconnect! conn))
     (receive (i o) (tcp-connect (mpd-host conn) (mpd-port conn))
       (let ((l (read-line i)))
         (cond
@@ -94,7 +99,7 @@
           (close-output-port o)
           (raise-mpd-error "unexpected greeting" l))))))
 
-  (define (disconnect conn)
+  (define (disconnect! conn)
     (close-input-port (in-port conn))
     (close-output-port (out-port conn))
     (in-port-set! conn #f)
@@ -128,7 +133,7 @@
     (let loop ((l (read-line (in-port conn))) (r '()))
       (cond
        ((eof-object? l)
-        (disconnect conn)
+        (disconnect! conn)
         (raise-mpd-error "connection closed unexpectedly"))
        ((equal? l "OK")
         (update-time conn)

Reply via email to