help writing a contrib
Jim Newton
jimka.issy at gmail.com
Thu Dec 3 10:07:31 UTC 2015
I hope someone can help me with a few things I'm confused on.
I've trying to write a slime contrib (for the first time).
I have already written the common-lisp function which works fine.
But I want to write the elisp front-end to this function.
The elisp function should get the symbol at the point create a temporary
file name,
then it should call the common lisp function passing those two arguments.
After the CL function returns, emacs should open the file named by the tmp
file name.
There are several issues I'm not sure how to answer.
1. the symbol at the point has an implicit package name, I want the CL
function to receive the correct symbol. E.g. suppose the symbol is xyzzy
which is CL parses as abc::xyzzy (because if an in-package earlier in the
file), I want the CL function called with 'abc::xyzzy not with 'CL::xyzzy.
2. If I try to call the CL function using slime-eval with a string, then
CL understand the correct symbol, but slime-eval returns t before the CL
function returns, and when I call find-file, the file is not ready to open
yet.
3. If I try to call the CL function with slime-eval-async, then the CL
function receives the wrong symbol: CL::xyzzy rather than abc::xyzzy.
4. I would like to put the .lisp file also in the contrib directory, but
the CL code depends on c2mop. Does this pose a problem? What do I need to
assure that if a user loads the file that c2mop has
already been loaded? I.e., is there an asd file I need to create or modify?
If someone could point me in the right direction, it would be great.
BTW here is the elisp function as I currently have it.
(defun class-graph (class-name)
(interactive "P")
(let* ((class-name (or class-name
(slime-symbol-at-point)))
(tmp-file (make-temp-file (format "%s-" class-name) nil ".png")))
(cond
((slime-eval
(format "(class-graph:class-graph-for-slime '%s %S)"
class-name
tmp-file))
;; this does not work, becasue tmp-file is not ready as
class-graph-for-slime has not yet finished.
(find-file tmp-file)
(image-mode-fit-frame))
(t
(error "failed to create graph in %s" tmp-file)))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20151203/39deb056/attachment.html>
More information about the slime-devel
mailing list