Is there a way to see the arguments for a common lisp function and its documentation from within emacs? Or also to see a list of all available functions?
SLIME automatically loads eldoc-mode
- this is the mode that displays function arguments in the minibuffer. If you mean cl
library of Emacs Lisp, you can load it using M-xeldoc-mode
.
Another useful SLIME feature is the C-c C-d C-d - this pops a new buffer with documentation about the function.
These are very useful too:
- C-c C-w C-a
slime-who-specializes
- C-c C-w C-b
slime-who-binds
- C-c C-w C-c
slime-who-calls
- C-c C-w RET
slime-who-macroexpands
- C-c C-w C-r
slime-who-references
- C-c C-w C-s
slime-who-sets
- C-c C-w C-w
slime-calls-who
- C-c C-w a
slime-who-specializes
- C-c C-w b
slime-who-binds
- C-c C-w c
slime-who-calls
- C-c C-w m
slime-who-macroexpands
- C-c C-w r
slime-who-references
- C-c C-w s
slime-who-sets
- C-c C-w w
slime-calls-who
It should be obvious what they do from their names.
Addidionally, there's an auto-complete
plugin for SLIME which can show documentation and function arguments in a drop-down menu (well, sort of), visually similar to how Visual Studio or Eclipse do it. I think it's called ac-slime
and is installable through ELPA.
eldoc-mode
, the rest are the SLIME bindings. If you have SLIME installed you can find all these (and more) bindings by doing C-h m
(or M-x describe-mode
). Or C-h b
(M-x describe-keybindings
). –
Fiber You can get the documentation of a function with documentation
. (Following examples for getting information about the function list
.)
(documentation 'list 'function)
"Returns constructs and returns a list of its arguments."
To get the argument-list, there is typically an implementation dependent function arglist
in some package. You can search this function with (apropos 'arglist)
. This will give you a list of all interned symbols whose names contain arglist
.
For example in CMUCL it is (swank-backend::arglist 'list)
, in CLISP it is just (arglist 'list)
, etc.
N.B. If you use SLIME, you should see the available arguments below anyway.
(documenation
to for example lookup documenation for format
? –
Patio (documentation 'format 'function)
. –
Ergot Sort of. The manual GNU Emacs Common Lisp Emulation
comes with GNU Emacs -- it is CL
in the main (dir
-level) Info menu. Consult the function index for the list of documented functions. But the documentation is somewhat incomplete, and it documents only the Emacs implementation, which sometimes differs from the Common Lisp spec.
Consult the Common Lisp documentation for precise info about the language.
Everything below is from http://cl-cookbook.sourceforge.net/emacs-ide.html
Q2. Viewing HyperSpec from within Emacs
Q2 I like having access to the HyperSpec when I'm in Emacs, but why does it have to use an external browser? Why can't I just see the HyperSpec in Emacs?
A2 If you use the Emacs add-on package W3 (or W3M which provides similar functionality), you can display HTML pages inside of Emacs. Once you have W3 and the HyperSpec both installed, use code similar to the following to access the HyperSpec from the Shift-F1 key:
(global-set-key [(shift f1)]
'(lambda ()
(interactive)
(let ((browse-url-browser-function
'browse-url-w3)
(common-lisp-hyperspec-root
"file://c:/home/docs/Hyperspec/")
(common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root
"Data/Map_Sym.txt"))
(hyperspec-prog
"c:/home/site/ilisp/extra/hyperspec"))
(load-library hyperspec-prog)
(common-lisp-hyperspec
(thing-at-point 'symbol)))))
Note that the "let" in the above code sets the browse-url-browser-function to W3 for just the HyperSpec. You can either set the variable globally (if you want to always use W3 or some other specific browser) or locally (if you want to use a specific browser and not the default one).
© 2022 - 2024 — McMap. All rights reserved.