问题
Is there any kind of common lisp docs like javadoc, man or even intellisense-like popups? I've just started learning common lisp and do not have enough hand memory.
I am using emacs and slime — it has tab completion, but it seem not very informative.
Thanks!
回答1:
Just in case this question was meant to ask where the reference is - there are several Hyperspecs available online. If you search Google for something like "hyperspec function-name" there's a good chance you will land on one of them.
http://clhs.lisp.se/Front/index.htm
http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/FrontMatter/index.html
for example.
Depending on your editor, you can usually configure it to display it the hyperspec contents too. With SLIME in Emacs you can do M-x slime-hyperspec-lookup RET symbol-to-look-for
Another handy tool is apropos
- by running (apropos "substring-in-the-symbol-name")
you will get the list of all symbols that match the "substring-in-the-symbol-name".
SLIME itself provides good autocompletion. What might be tripping you is that the default keys may be bound to something that your system doesn't dispatch to Emacs (like M-TAB), in order to rebind it to something else you can do (in your .emacs file):
(define-key lisp-mode-map (kbd "C-x .")
'slime-complete-symbol)
(define-key lisp-mode-map (kbd "C-x /")
'slime-complete-form)
(define-key lisp-mode-map (kbd "C-x ,")
'slime-fuzzy-complete-symbol)
Besides, Emacs provides "lexical" completion on its own - if you hit M-/ this will try to complete the word to a word with the same suffix - it works surprisingly well, especially if you have to type in long variables/function names :)
Also, SLIME binds C-c C-d f to slime-describe-function-at-point
and C-c C-d d to slime-describe-symbol-at-point
and C-c C-v d to slime-describe-presentation-at-point
.
Besides... something that came as a revelation to me after quite some time... if you press RET while in the buffer containing the error stack trace, point on the stack entry, it will display the value of the local variables inside the function at that stack level. If you then press RET when the point is on either of those variables, it will open a buffer describing that variable.
回答2:
Look into manifest for package-based documentation. Keep in mind that Common Lisp is meant to be used as a dynamic system, and incorporates optional docstring slots into every declaration primitive it has. AFAIK, the standard way of getting documentation about a given function is to just run (describe #'function-name-here)
at the repl (without the #
if you're looking for documentation about a symbol).
That will give you access to docstrings as well as argument lists (in the case of methods, you get a compilation of the generic function's documentation, as well as each specific methods').
Look into autocomplete-mode, and possibly yasnippet for completions.
来源:https://stackoverflow.com/questions/11193313/man-or-javadoc-style-documentation-for-common-lisp