[slime-devel] New command for starting and loading

Lars Magne Ingebrigtsen larsi at gnus.org
Sun May 2 13:58:03 UTC 2004


I'm not sure the following command is generally useful or not.

I usually work the following way: I want to start an Emacs to handle
some specific problem.  So I go to the file where I want to edit,
start up a Lisp, load the file, set the package, call some functions,
edit, call some more functions.

The following command finds the current package, loads that package
and sets the package name, thereby saving me a whole lot of typing.

If useful, this could be bound to a key like `C-c M-l'.

(The implementation might not be optimal.  :-)

*** slime.el.~1.288.~	Sun May  2 14:07:33 2004
--- slime.el	Sun May  2 15:53:32 2004
***************
*** 4547,4552 ****
--- 4556,4573 ----
  				 ,(expand-file-name default-directory)))))
      (message "package: %s  default-directory: %s" package directory)))
  	
+ (defun slime-start-and-load ()
+   "Start Slime, load the current file and set the package."
+   (interactive)
+   (let ((package (slime-find-buffer-package)))
+     (if (not package)
+         (error "No package to load")
+       (slime)
+       (while (not (slime-connected-p))
+         (sit-for 0.1))
+       (slime-repl-send-string
+        (format "(progn (load \"%s\") (in-package %s))\n" package package)))))
+ 
  
  ;;; Debugger (SLDB)
  

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi at gnus.org * Lars Magne Ingebrigtsen





More information about the slime-devel mailing list