Re: slime-edit-definition from within of (defpackage )
Pascal Bourguignon <[email protected]> Fri, 2 Sep 2022 10:29:28 +0200
| Newsgroups | gmane.lisp.slime.devel |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_AAE8B57E-B0BE-4C45-BF40-58C4D8891DD0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 2 Sep 2022, at 04:42, Anton Vodonosov <[email protected]> wrote: >=20 > Hello. > =20 > 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. > =20 > I use slime-edit-definition (with the M-. shortcut) for navigation to = docstrings. > =20 > 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 > =20 > (in-package :cl-user) >=20 > (defpackage :some-lib > (:export #:some-function > #:another-function > ...)) > =20 > =20 > So when cursor stays on #:some-function and M-. is pressed > slime says "No known definition for: #:some-function (in :cl-user)" > =20 > As a workaround I temporarily insert (in-pakcage :some-lib) above the = (defpackage ). > =20 > 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 ). > =20 > 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=E2=80=99s 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=E2=80=99s often = obvious, but there are a lot of cases where multiple definitions of = different kinds exist). =46rom the documentation, the symbols are usually tagged, with a prefix = or suffix [macro] or [function] or [class] etc=E2=80=A6. The = identification of the package may be more difficult since it=E2=80=99s = often more informal, (just a title). --=20 __Pascal J. Bourguignon__ --Apple-Mail=_AAE8B57E-B0BE-4C45-BF40-58C4D8891DD0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 2 Sep 2022, at 04:42, Anton Vodonosov <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div = class=3D"">Hello.</div><div class=3D""> </div><div class=3D"">People = may want to open package.lisp of some library to study the public = API,</div><div class=3D"">and quickly navigate to definition of any = symbol from the :export list,</div><div class=3D"">in order to read the = docstring.</div><div class=3D""> </div><div class=3D"">I use = slime-edit-definition (with the M-. shortcut) for navigation to = docstrings.</div><div class=3D""> </div><div class=3D"">But that = usually does not work from within of (defpackage ) form,</div><div = class=3D"">because slime determines the current package based on the = (in-package)</div><div class=3D"">at the top of the file and usually = package files have</div><div class=3D""> </div><div class=3D""><div = class=3D""> (in-package :cl-user)</div><div class=3D""><br = class=3D""> (defpackage :some-lib</div><div class=3D""> = (:export #:some-function</div><div class=3D""> = = #:another-function</div><div class=3D""> = ...))</div><div = class=3D""> </div><div class=3D""> </div><div class=3D"">So = when cursor stays on #:some-function and M-. is pressed</div><div = class=3D"">slime says "No known definition for: #:some-function (in = :cl-user)"</div><div class=3D""> </div><div class=3D"">As a = workaround I temporarily insert (in-pakcage :some-lib) above the = (defpackage ).</div><div class=3D""> </div><div class=3D"">But it = would be convenient if slime understood that the within the = :export</div><div class=3D"">option of defpackage the symbols belong to = the package being defined</div><div class=3D"">and not to the closest = (in-package ).</div><div class=3D""> </div><div class=3D"">So that = the proposal for consideration of the slime = maintainers.</div></div></div></blockquote><br class=3D""></div><div>And = slightly more difficult, but it would be nice too, to consider making = M-. work from documentation files.</div><div><br = class=3D""></div><div>It=E2=80=99s 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=E2=80=99s often obvious, but there are a lot of cases where multiple = definitions of different kinds exist).</div><div><br = class=3D""></div><div>=46rom the documentation, the symbols are usually = tagged, with a prefix or suffix [macro] or [function] or [class] etc=E2=80= =A6. The identification of the package may be more difficult since = it=E2=80=99s often more informal, (just a title).</div><div><br = class=3D""></div><br class=3D""><div class=3D""> <div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D""><div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D""><div style=3D"color: rgb(0, 0, 0); letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D"">-- <br class=3D"">__Pascal J. Bourguignon__</div><div = style=3D"color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: = break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D""><br class=3D""><br class=3D""><br class=3D""></div></div></div>= </div> <br class=3D""></body></html>= --Apple-Mail=_AAE8B57E-B0BE-4C45-BF40-58C4D8891DD0--