On 2 Sep 2022, at 04:42, Anton Vodonosov avodonosov@yandex.ru wrote:
Hello.
People may want to open package.lisp of some library to study the public API, and quickly navigate to definition of any symbol from the :export list, in order to read the docstring.
I use slime-edit-definition (with the M-. shortcut) for navigation to docstrings.
But that usually does not work from within of (defpackage ) form, because slime determines the current package based on the (in-package) at the top of the file and usually package files have
(in-package :cl-user)
(defpackage :some-lib (:export #:some-function #:another-function ...))
So when cursor stays on #:some-function and M-. is pressed slime says "No known definition for: #:some-function (in :cl-user)"
As a workaround I temporarily insert (in-pakcage :some-lib) above the (defpackage ).
But it would be convenient if slime understood that the within the :export option of defpackage the symbols belong to the package being defined and not to the closest (in-package ).
So that the proposal for consideration of the slime maintainers.
And slightly more difficult, but it would be nice too, to consider making M-. work from documentation files.
It’s a good idea to start from the package export list to browse a package, but I never did it, notably because the export list loses the kind of definition the symbols name. (Agreed, it’s often obvious, but there are a lot of cases where multiple definitions of different kinds exist).
From the documentation, the symbols are usually tagged, with a prefix or suffix [macro] or [function] or [class] etc…. The identification of the package may be more difficult since it’s often more informal, (just a title).