[slime-cvs] CVS slime

heller heller at common-lisp.net
Sat Feb 16 19:26:23 UTC 2008


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv9557

Modified Files:
	ChangeLog swank-loader.lisp slime.el swank.lisp 
Log Message:
Split loading and initialization (again).

* swank-loader.lisp (init): New.  Delete old packages only if
explicitly requested.  Also, if the swank package already exists
don't load swank again.
(setup): New function.

* swank.lisp (setup): New function.  Moved over here from
swank-loader.lisp.

* slime.el (slime-init-command): Call swank-loader:init.


In the REPL, mark the trailing newline also as input.

* slime.el (slime-repl-send-input): Mark the newline with
the 'slime-repl-old-input property.
(slime-repl-grab-old-input): Strip the newline.



--- /project/slime/cvsroot/slime/ChangeLog	2008/02/10 08:32:04	1.1289
+++ /project/slime/cvsroot/slime/ChangeLog	2008/02/16 19:26:22	1.1290
@@ -1,3 +1,25 @@
+2008-02-16  Helmut Eller  <heller at common-lisp.net>
+
+	In the REPL, mark the trailing newline also as input.
+
+	* slime.el (slime-repl-send-input): Mark the newline with
+	the 'slime-repl-old-input property.
+	(slime-repl-grab-old-input): Strip the newline.
+
+2008-02-16  Helmut Eller  <heller at common-lisp.net>
+
+	Split loading and initialization (again).
+
+	* swank-loader.lisp (init): New.  Delete old packages only if
+	explicitly requested.  Also, if the swank package already exists
+	don't load swank again.
+	(setup): New function.
+
+	* swank.lisp (setup): New function.  Moved over here from
+	swank-loader.lisp.
+
+	* slime.el (slime-init-command): Call swank-loader:init.
+
 2008-02-10  Helmut Eller  <heller at common-lisp.net>
 
 	Remove remaining traces of make-default-inspector.
@@ -2875,15 +2897,15 @@
 	* slime.el (slime-repl-previous-input-starting-with-current-input)
 	(slime-repl-next-input-starting-with-current-input): New functions,
 	work like the old slime-repl-previous-input / next-input.
-	(slime-repl-matching-input-regexp): Restore old version.	
+	(slime-repl-matching-input-regexp): Restore old version.
 	(slime-repl-mode-map): Bind s-r-p-i-s-w-c-i and s-r-n-i-s-w-c-i
 	to M-p and M-n respectively. slime-repl-previous-input and
 	slime-repl-next-input are still accessible with C-up / C-down.
-	
+
 2006-11-25  Helmut Eller  <heller at common-lisp.net>
 
 	* slime.el (slime-repl-read-break): Use a :emacs-interrupt message
-	instead of a RPC to swank:simple-break.  Suggested by Taylor R
+	instead of a RPC to swank:simple-break.  Suggested by Taylor R.
 	Campbell.
 
 2006-11-24  Helmut Eller  <heller at common-lisp.net>
@@ -3428,7 +3450,7 @@
 	* swank.lisp (format-iso8601-time): Properly handle non integer
 	time zones.
 
-2006-09-13  Taylor R Campbell <campbell at mumble.net>
+2006-09-13  Taylor R. Campbell <campbell at mumble.net>
 
 	* slime.el (slime-init-output-buffer): Initial directory and
 	package stacks should be empty.
@@ -3613,7 +3635,7 @@
 2006-07-28  Helmut Eller  <heller at common-lisp.net>
 
 	* slime.el (slime-thread-quit): Call swank:quit-thread-browser.
-	Reported by Taylor R Campbell.
+	Reported by Taylor R. Campbell.
 
 2006-07-28  Willem Broekema <metawilm at gmail.com>
 
@@ -4970,7 +4992,7 @@
 
 	* slime.el (slime48): New command.
 
-2005-09-19 Taylor Campbell <campbell at mumble.net>
+2005-09-19 Taylor R. Campbell <campbell at mumble.net>
 
 	* swank-scheme48/: New backend.
 
--- /project/slime/cvsroot/slime/swank-loader.lisp	2008/02/04 12:15:27	1.77
+++ /project/slime/cvsroot/slime/swank-loader.lisp	2008/02/16 19:26:22	1.78
@@ -18,15 +18,10 @@
 ;;   (defparameter swank-loader::*fasl-directory* "/tmp/fasl/")
 ;;   (load ".../swank-loader.lisp")
 
-(eval-when (:compile-toplevel :load-toplevel :execute)
-  (when (find-package :swank)
-    (delete-package :swank)
-    (delete-package :swank-io-package)
-    (delete-package :swank-backend)))
-
 (cl:defpackage :swank-loader
   (:use :cl)
   (:export :load-swank
+           :init
            :*source-directory*
            :*fasl-directory*))
 
@@ -79,7 +74,7 @@
                 (subseq s 0 (position #\space s)))
   #+armedbear (lisp-implementation-version))
 
-(defun unique-directory-name ()
+(defun unique-dir-name ()
   "Return a name that can be used as a directory name that is
 unique to a Lisp implementation, Lisp implementation version,
 operating system, and hardware architecture."
@@ -114,20 +109,20 @@
                      :if-does-not-exist nil)
     (and s (symbol-name (read s)))))
 
-(defun default-fasl-directory ()
+(defun default-fasl-dir ()
   (merge-pathnames
    (make-pathname
     :directory `(:relative ".slime" "fasl"
                  ,@(if (slime-version-string) (list (slime-version-string)))
-                 ,(unique-directory-name)))
+                 ,(unique-dir-name)))
    (user-homedir-pathname)))
 
-(defun binary-pathname (source-pathname binary-directory)
-  "Return the pathname where SOURCE-PATHNAME's binary should be compiled."
-  (let ((cfp (compile-file-pathname source-pathname)))
+(defun binary-pathname (src-pathname binary-dir)
+  "Return the pathname where SRC-PATHNAME's binary should be compiled."
+  (let ((cfp (compile-file-pathname src-pathname)))
     (merge-pathnames (make-pathname :name (pathname-name cfp)
                                     :type (pathname-type cfp))
-                     binary-directory)))
+                     binary-dir)))
 
 (defun handle-loadtime-error (condition binary-pathname)
   (pprint-logical-block (*error-output* () :per-line-prefix ";; ")
@@ -135,40 +130,37 @@
             "~%Error while loading: ~A~%Condition: ~A~%Aborting.~%"
             binary-pathname condition))
   (when (equal (directory-namestring binary-pathname)
-               (directory-namestring (default-fasl-directory)))
+               (directory-namestring (default-fasl-dir)))
     (ignore-errors (delete-file binary-pathname)))
   (abort))
 
-(defun compile-files-if-needed-serially (files fasl-directory load)
+(defun compile-files (files fasl-dir load)
   "Compile each file in FILES if the source is newer than
 its corresponding binary, or the file preceding it was
 recompiled."
   (let ((needs-recompile nil))
-    (dolist (source-pathname files)
-      (let ((binary-pathname (binary-pathname source-pathname
-                                              fasl-directory)))
+    (dolist (src files)
+      (let ((dest (binary-pathname src fasl-dir)))
         (handler-case
             (progn
               (when (or needs-recompile
-                        (not (probe-file binary-pathname))
-                        (file-newer-p source-pathname binary-pathname))
-                ;; need a to recompile source-pathname, so we'll
+                        (not (probe-file dest))
+                        (file-newer-p src dest))
+                ;; need a to recompile src-pathname, so we'll
                 ;; need to recompile everything after this too.
                 (setq needs-recompile t)
-                (ensure-directories-exist binary-pathname)
-                (compile-file source-pathname :output-file binary-pathname
-                              :print nil
-                              :verbose t))
+                (ensure-directories-exist dest)
+                (compile-file src :output-file dest :print nil :verbose t))
               (when load
-                (load binary-pathname :verbose t)))
+                (load dest :verbose t)))
           ;; Fail as early as possible
           (serious-condition (c)
-            (handle-loadtime-error c binary-pathname)))))))
+            (handle-loadtime-error c dest)))))))
 
 #+(or cormanlisp ecl)
-(defun compile-files-if-needed-serially (files fasl-directory load)
+(defun compile-files (files fasl-dir load)
   "Corman Lisp and ECL have trouble with compiled files."
-  (declare (ignore fasl-directory))
+  (declare (ignore fasl-dir))
   (when load
     (dolist (file files)
       (load file :verbose t)
@@ -180,22 +172,22 @@
                          (make-pathname :name ".swank" :type "lisp"))
         :if-does-not-exist nil))
 
-(defun load-site-init-file (directory)
+(defun load-site-init-file (dir)
   (load (make-pathname :name "site-init" :type "lisp"
-                       :defaults directory)
+                       :defaults dir)
         :if-does-not-exist nil))
 
-(defun source-files (names src-dir)
+(defun src-files (names src-dir)
   (mapcar (lambda (name)
             (make-pathname :name (string-downcase name) :type "lisp"
                            :defaults src-dir))
           names))
 
-(defun swank-source-files (src-dir)
-  (source-files `("swank-backend" ,@*sysdep-files* "swank") 
-                src-dir))
+(defun swank-src-files (src-dir)
+  (src-files `("swank-backend" ,@*sysdep-files* "swank") 
+             src-dir))
 
-(defvar *fasl-directory* (default-fasl-directory)
+(defvar *fasl-directory* (default-fasl-dir)
   "The directory where fasl files should be placed.")
 
 (defvar *contribs* '(swank-c-p-c swank-arglists swank-fuzzy
@@ -210,28 +202,30 @@
    (make-pathname :directory `(:relative ,name) :defaults absolute)
    absolute))
 
-(defun contrib-src-dir (src-dir)
-  (append-dir src-dir "contrib"))
-
-(defun contrib-source-files (src-dir)
-  (source-files *contribs* (contrib-src-dir src-dir)))
+(defun contrib-dir (base-dir)
+  (append-dir base-dir "contrib"))
 
-(defun load-swank (&key
-                   (source-directory *source-directory*)
-                   (fasl-directory *fasl-directory*)
-                   (contrib-fasl-directory 
-                    (append-dir fasl-directory "contrib")))
-  (compile-files-if-needed-serially (swank-source-files source-directory)
-                                    fasl-directory t)
-  (compile-files-if-needed-serially (contrib-source-files source-directory)
-                                    contrib-fasl-directory nil))
-
-(load-swank)
-
-(setq swank::*swank-wire-protocol-version* (slime-version-string))
-(setq swank::*load-path* 
-      (append swank::*load-path* (list (contrib-src-dir *source-directory*))))
-(swank-backend::warn-unimplemented-interfaces)
-(load-site-init-file *source-directory*)
-(load-user-init-file)
-(swank:run-after-init-hook)
+(defun load-swank (&key (src-dir *source-directory*)
+                   (fasl-dir *fasl-directory*))
+  (compile-files (swank-src-files src-dir) fasl-dir t))
+
+(defun compile-contribs (&key (src-dir (contrib-dir *source-directory*))
+                         (fasl-dir (contrib-dir *fasl-directory*)))
+  (compile-files (src-files *contribs* src-dir) fasl-dir nil))
+
+(defun setup ()
+  (flet ((q (s) (read-from-string s)))
+    (load-site-init-file *source-directory*)
+    (load-user-init-file)
+    (eval `(pushnew 'compile-contribs ,(q "swank::*after-init-hook*")))
+    (funcall (q "swank::setup") 
+             (slime-version-string)
+             (list (contrib-dir *fasl-directory*)    
+                   (contrib-dir *source-directory*)))))
+
+(defun init (&key delete reload)
+  (when (and delete (find-package :swank))
+    (mapc #'delete-package '(:swank :swank-io-package :swank-backend)))
+  (when (or (not (find-package :swank)) reload)
+    (load-swank))
+  (setup))
--- /project/slime/cvsroot/slime/slime.el	2008/02/09 18:44:12	1.904
+++ /project/slime/cvsroot/slime/slime.el	2008/02/16 19:26:22	1.905
@@ -1432,6 +1432,7 @@
     (format "%S\n\n"
             `(progn
                (load ,(expand-file-name loader) :verbose t)
+               (funcall (read-from-string "swank-loader:init"))
                (funcall (read-from-string "swank:start-server")
                         ,port-filename
                         :coding-system ,encoding)))))
@@ -3172,14 +3173,13 @@
   (let ((end (point))) ; end of input, without the newline
     (slime-repl-add-to-input-history 
      (buffer-substring slime-repl-input-start-mark end))
-    (let ((inhibit-read-only t))
-      (add-text-properties slime-repl-input-start-mark 
-                           (point)
-                           `(slime-repl-old-input
-                             ,(incf slime-repl-old-input-counter))))
     (when newline 
       (insert "\n")
       (slime-repl-show-maximum-output))
+    (add-text-properties slime-repl-input-start-mark 
+                         (point)
+                         `(slime-repl-old-input
+                           ,(incf slime-repl-old-input-counter)))
     (let ((overlay (make-overlay slime-repl-input-start-mark end)))
       ;; These properties are on an overlay so that they won't be taken
       ;; by kill/yank.
@@ -3206,7 +3206,10 @@
                (unless (eq (char-before) ?\ )
                  (insert " "))))
       (delete-region (point) slime-repl-input-end-mark)
-      (save-excursion (insert old-input))
+      (save-excursion 
+        (insert old-input)
+        (when (equal (char-before) ?\n) 
+          (delete-char -1)))
       (forward-char offset))))
 
 (defun slime-property-bounds (prop)
--- /project/slime/cvsroot/slime/swank.lisp	2008/02/09 18:47:05	1.531
+++ /project/slime/cvsroot/slime/swank.lisp	2008/02/16 19:26:23	1.532
@@ -23,7 +23,6 @@
            #:inspect-in-emacs
            #:print-indentation-lossage
            #:swank-debugger-hook
-           #:run-after-init-hook
            #:emacs-inspect
            ;;#:inspect-slot-for-emacs
            ;; These are user-configurable variables:
@@ -182,9 +181,6 @@
 (defvar *after-init-hook* '()
   "Hook run after user init files are loaded.")
 
-(defun run-after-init-hook ()
-  (run-hook *after-init-hook*))
-
 
 ;;;; Connections
 ;;;
@@ -2291,10 +2287,7 @@
     (make-pathname :directory `(:relative ,dirname) :defaults defaults)
     defaults)))
 
-(defvar *load-path*
-  (list (make-pathname :directory (merged-directory "contrib" *load-truename*)
-                       :name nil :type nil :version nil
-                       :defaults *load-truename*))
+(defvar *load-path* '()
   "A list of directories to search for modules.")
 
 (defun module-canditates (name dir)
@@ -3141,4 +3134,10 @@
 
 (add-hook *pre-reply-hook* 'sync-indentation-to-emacs)
 
+(defun setup (version load-path)
+  (setq *swank-wire-protocol-version* version)
+  (setq *load-path* load-path)
+  (swank-backend::warn-unimplemented-interfaces)
+  (run-hook *after-init-hook*))
+
 ;;; swank.lisp ends here




More information about the slime-cvs mailing list