]> git.eshelyaron.com Git - emacs.git/commit
OClosure: New function `function-documentation`
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 7 Apr 2022 19:59:09 +0000 (15:59 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 7 Apr 2022 19:59:09 +0000 (15:59 -0400)
commit39e8fd357dd0a1f3776c05eee2cc5be451686712
tree7783c644dc02cef24ebb231d3aeb20292b0ec07d
parent3b411417086ceb2ce3838160d01c6f250e47bbf3
OClosure: New function `function-documentation`

As mentioned in the original OClosure commit, OClosures (ab)use the
bytecode's docstring slot to hold the OClosure's type.  This currently
prevents OClosures from having their own docstring.

Introduce a new generic function `function-documentation` to fetch the
docstring of a function, which can then be implemented in various
different ways depending on the OClosure's type.

* lisp/simple.el (function-documentation): New generic function.
(bad-package-check): Strength-reduce `eval` to `symbol-value`.
* src/doc.c (Fdocumentation): Use it.

* lisp/emacs-lisp/oclosure.el (oclosure--accessor-docstring): New function.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test):
Add test for accessor's docstrings.
doc/lispref/help.texi
etc/NEWS
lisp/emacs-lisp/oclosure.el
lisp/simple.el
src/doc.c
test/lisp/emacs-lisp/oclosure-tests.el