branch: elpa/sly
commit a5172a75cc4c14dd4ef88cb0cb88a2e13e71565f
Author: André A. Gomes <[email protected]>
Commit: André A. Gomes <[email protected]>

    slynk/slynk-loader(sly-version-string): Fix bug.
    
    sly-init-using-slynk-loader raised an error since "Version:" wasn't found 
in the
    SLY sources when installed via MELPA—they change the headers of file sly.el.
    
    The refactor ensures that sly-verson-string falls back to NIL, as per its
    docstring.
---
 slynk/slynk-loader.lisp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/slynk/slynk-loader.lisp b/slynk/slynk-loader.lisp
index 1d1dd56778b..efe06554d2f 100644
--- a/slynk/slynk-loader.lisp
+++ b/slynk/slynk-loader.lisp
@@ -141,15 +141,15 @@ Return nil if nothing appropriate is available."
   (let ((this-file #.(or #-clasp *compile-file-truename* *load-truename*)))
     (with-open-file (s (make-pathname :name "sly" :type "el"
                                       :directory (butlast
-                                                  (pathname-directory 
this-file)
-                                                  1)
-                                      :defaults this-file))
-      (let ((seq (make-array 200 :element-type 'character :initial-element 
#\null)))
-        (read-sequence seq s :end 200)
-        (let* ((beg (search ";; Version:" seq))
-               (end (position #\NewLine seq :start beg))
-               (middle (position #\Space seq :from-end t :end end)))
-          (subseq seq (1+ middle) end))))))
+                                                  (pathname-directory 
this-file))
+                                      :defaults this-file)
+                       :if-does-not-exist :error)
+      (loop :for line = (read-line s) :repeat 4
+            :for match = (or (search "Version:" line)           ; Source
+                             (search "Package-Revision:" line)) ; MELPA 
(commit)
+            :when match
+              :do (return-from sly-version-string
+                    (subseq line (1+ (position #\Space line :from-end t))))))))
 
 (defun default-fasl-dir ()
   (merge-pathnames

Reply via email to