[slime-cvs] CVS update: slime/slime.el

Luke Gorrie lgorrie at common-lisp.net
Mon May 2 18:42:22 UTC 2005


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv30618

Modified Files:
	slime.el 
Log Message:
If ~/.slime-secret exists then send the contents to Lisp as
authentication.

Date: Mon May  2 20:42:11 2005
Author: lgorrie

Index: slime/slime.el
diff -u slime/slime.el:1.487 slime/slime.el:1.488
--- slime/slime.el:1.487	Mon May  2 20:17:19 2005
+++ slime/slime.el	Mon May  2 20:42:10 2005
@@ -1512,6 +1512,17 @@
   "A list of valid coding systems. 
 Each element is of the form: (NAME MULTIBYTEP CL-NAME)")
 
+(defun slime-secret ()
+  "Finds the magic secret from the user's home directory.
+Returns nil if the file doesn't exist or is empty; otherwise the first
+line of the file."
+  (condition-case err
+      (with-temp-buffer
+	(insert-file-contents "~/.slime-secret")
+	(goto-char (point-min))
+	(buffer-substring (point-min) (line-end-position)))
+    (file-error nil)))
+
 ;;; Interface
 (defun slime-net-connect (host port)
   "Establish a connection with a CL."
@@ -1528,6 +1539,8 @@
       (set-process-coding-system proc 
                                  slime-net-coding-system
                                  slime-net-coding-system))
+    (when-let (secret (slime-secret))
+      (slime-net-send secret proc))
     proc))
 
 (defun slime-make-net-buffer (name)
@@ -2499,6 +2512,8 @@
     (set-process-coding-system stream 
                                slime-net-coding-system 
                                slime-net-coding-system)
+    (when-let (secret (slime-secret))
+      (slime-net-send secret stream))
     stream))
 
 (defun slime-output-string (string)




More information about the slime-cvs mailing list