Skip to content

Commit 21ae13c

Browse files
committed
Derive SWANK protocol version from slime-version
The main goal here is to remove the dependency on the ChangeLog file. This should work well enough if releases are frequent.
1 parent c4dc169 commit 21ae13c

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SELECTOR -- selector for ERT tests ($(SELECTOR))\n"
3636

3737
# Compilation
3838
#
39-
slime.elc: slime.el ChangeLog lib/hyperspec.elc
39+
slime.elc: slime.el lib/hyperspec.elc
4040

4141
%.elc: %.el
4242
$(EMACS) -Q $(LOAD_PATH) --batch -f batch-byte-compile $<

slime.el

+1-25
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,8 @@ CONTRIBS is a list of contrib packages to load. If `nil', use
138138
(set (make-local-variable 'lisp-indent-function)
139139
'common-lisp-indent-function))
140140

141-
(eval-and-compile
142-
(defun slime--changelog-file-name ()
143-
(expand-file-name "ChangeLog"
144-
(if (and (boundp 'byte-compile-current-file)
145-
byte-compile-current-file)
146-
(file-name-directory byte-compile-current-file)
147-
slime-path)))
148-
149-
(defun slime-changelog-date (&optional interactivep)
150-
"Return the datestring of the latest entry in the ChangeLog file.
151-
Return nil if the ChangeLog file cannot be found."
152-
(interactive "p")
153-
(let ((changelog (slime--changelog-file-name))
154-
(date nil))
155-
(when (file-exists-p changelog)
156-
(with-temp-buffer
157-
(insert-file-contents-literally changelog nil 0 100)
158-
(goto-char (point-min))
159-
(setq date (symbol-name (read (current-buffer))))))
160-
(when interactivep
161-
(message "Slime ChangeLog dates %s." date))
162-
date)))
163-
164141
(defvar slime-protocol-version nil)
165-
(setq slime-protocol-version
166-
(eval-when-compile (slime-changelog-date)))
142+
(setq slime-protocol-version slime-version)
167143

168144

169145
;;;; Customize groups

swank-loader.lisp

+9-5
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,19 @@ operating system, and hardware architecture."
133133
"Returns true if NEW-FILE is newer than OLD-FILE."
134134
(> (file-write-date new-file) (file-write-date old-file)))
135135

136+
(defun string-starts-with (string prefix)
137+
(string-equal string prefix :end1 (min (length string) (length prefix))))
138+
136139
(defun slime-version-string ()
137140
"Return a string identifying the SLIME version.
138141
Return nil if nothing appropriate is available."
139-
(with-open-file (s (merge-pathnames "ChangeLog" *source-directory*)
142+
(with-open-file (s (merge-pathnames "slime.el" *source-directory*)
140143
:if-does-not-exist nil)
141-
(and s (symbol-name (read s)))))
144+
(loop with prefix = ";; Version: "
145+
for line = (read-line s nil :eof)
146+
until (eq line :eof)
147+
when (string-starts-with line prefix)
148+
return (subseq line (length prefix)))))
142149

143150
(defun default-fasl-dir ()
144151
(merge-pathnames
@@ -300,9 +307,6 @@ If LOAD is true, load the fasl file."
300307
(eval `(pushnew 'compile-contribs ,(q "swank::*after-init-hook*"))))
301308
(funcall (q "swank::init")))
302309

303-
(defun string-starts-with (string prefix)
304-
(string-equal string prefix :end1 (min (length string) (length prefix))))
305-
306310
(defun list-swank-packages ()
307311
(remove-if-not (lambda (package)
308312
(let ((name (package-name package)))

0 commit comments

Comments
 (0)