Commit 21ae13c6 authored by Luís Oliveira's avatar Luís Oliveira
Browse files

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.
parent c4dc1692
Showing with 11 additions and 31 deletions
+11 -31
......@@ -36,7 +36,7 @@ SELECTOR -- selector for ERT tests ($(SELECTOR))\n"
# Compilation
#
slime.elc: slime.el ChangeLog lib/hyperspec.elc
slime.elc: slime.el lib/hyperspec.elc
%.elc: %.el
$(EMACS) -Q $(LOAD_PATH) --batch -f batch-byte-compile $<
......
......@@ -138,32 +138,8 @@ CONTRIBS is a list of contrib packages to load. If `nil', use
(set (make-local-variable 'lisp-indent-function)
'common-lisp-indent-function))
(eval-and-compile
(defun slime--changelog-file-name ()
(expand-file-name "ChangeLog"
(if (and (boundp 'byte-compile-current-file)
byte-compile-current-file)
(file-name-directory byte-compile-current-file)
slime-path)))
(defun slime-changelog-date (&optional interactivep)
"Return the datestring of the latest entry in the ChangeLog file.
Return nil if the ChangeLog file cannot be found."
(interactive "p")
(let ((changelog (slime--changelog-file-name))
(date nil))
(when (file-exists-p changelog)
(with-temp-buffer
(insert-file-contents-literally changelog nil 0 100)
(goto-char (point-min))
(setq date (symbol-name (read (current-buffer))))))
(when interactivep
(message "Slime ChangeLog dates %s." date))
date)))
(defvar slime-protocol-version nil)
(setq slime-protocol-version
(eval-when-compile (slime-changelog-date)))
(setq slime-protocol-version slime-version)
;;;; Customize groups
......
......@@ -133,12 +133,19 @@ operating system, and hardware architecture."
"Returns true if NEW-FILE is newer than OLD-FILE."
(> (file-write-date new-file) (file-write-date old-file)))
(defun string-starts-with (string prefix)
(string-equal string prefix :end1 (min (length string) (length prefix))))
(defun slime-version-string ()
"Return a string identifying the SLIME version.
Return nil if nothing appropriate is available."
(with-open-file (s (merge-pathnames "ChangeLog" *source-directory*)
(with-open-file (s (merge-pathnames "slime.el" *source-directory*)
:if-does-not-exist nil)
(and s (symbol-name (read s)))))
(loop with prefix = ";; Version: "
for line = (read-line s nil :eof)
until (eq line :eof)
when (string-starts-with line prefix)
return (subseq line (length prefix)))))
(defun default-fasl-dir ()
(merge-pathnames
......@@ -300,9 +307,6 @@ If LOAD is true, load the fasl file."
(eval `(pushnew 'compile-contribs ,(q "swank::*after-init-hook*"))))
(funcall (q "swank::init")))
(defun string-starts-with (string prefix)
(string-equal string prefix :end1 (min (length string) (length prefix))))
(defun list-swank-packages ()
(remove-if-not (lambda (package)
(let ((name (package-name package)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment