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)
Lars Magne Ingebrigtsen larsi@gnus.org writes:
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.
Wouldn't it work to just do C-c C-k when visiting a file?
Zach
Zach Beane xach@xach.com writes:
Wouldn't it work to just do C-c C-k when visiting a file?
`C-c C-k' doesn't start Slime or set the current package...
Lars Magne Ingebrigtsen larsi@gnus.org writes:
- (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)))))
I committed a patch that loads the current file, not the package. Is that OK?
By convention we don't send snippets of CL code to lisp, especially not encoded as strings (problematic with non-standard reader syntax). The preferred way is to use slime-eval-async or slime-eval and write the function in CL directly.
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
I committed a patch that loads the current file, not the package. Is that OK?
Sure, that's fine.
By convention we don't send snippets of CL code to lisp, especially not encoded as strings (problematic with non-standard reader syntax). The preferred way is to use slime-eval-async or slime-eval and write the function in CL directly.
Right. I experimented briefly with `slime-eval' and got strange backtraces, so I just did it the "easy" way. Looking at the backtrace more closely now, I see that it's looking up the symbols in the SWANK-IO-PACKAGE package, which explains why (slime-eval `(load "thing")) didn't work, and you have to prefix the symbols with their package...