diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-03-28 10:53:14 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-03-28 10:53:14 -0400 |
commit | 52d5771e0a803f57b8cdd7675bf15f2f9b946039 (patch) | |
tree | 26ff950a2c8527da7a2438d7ed1825555dbf2e40 /src/doc.c | |
parent | 3f19a23c1f60757c54a0ec7d84c625d83766ee08 (diff) | |
download | emacs-52d5771e0a803f57b8cdd7675bf15f2f9b946039.tar.gz emacs-52d5771e0a803f57b8cdd7675bf15f2f9b946039.tar.bz2 emacs-52d5771e0a803f57b8cdd7675bf15f2f9b946039.zip |
Add OClosures, a cross between functions and structs
We here just add the new type. It is not fully self-contained.
It requires cooperation from `cconv.el` on the one hand, and it
hijacks the docstring info to hold the type of OClosure objects.
This does imply that OClosures can't have docstrings, tho this
limitation will be lifted in subsequent patches.
* lisp/emacs-lisp/oclosure.el: New file.
* test/lisp/emacs-lisp/oclosure-tests.el: New file.
* doc/lispref/functions.texi (OClosures): New section.
* src/eval.c (Ffunction): Accept symbols instead of strings for docstrings.
* src/doc.c (store_function_docstring): Avoid overwriting an OClosure type.
* lisp/emacs-lisp/cconv.el (cconv--convert-function): Tweak ordering of
captured variables.
(cconv-convert): Add case for `oclosure--fix-type`.
Diffstat (limited to 'src/doc.c')
-rw-r--r-- | src/doc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/doc.c b/src/doc.c index a9f77b25bfa..e361a86c1a1 100644 --- a/src/doc.c +++ b/src/doc.c @@ -514,11 +514,19 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset) { /* This bytecode object must have a slot for the docstring, since we've found a docstring for it. */ - if (PVSIZE (fun) > COMPILED_DOC_STRING) + if (PVSIZE (fun) > COMPILED_DOC_STRING + /* Don't overwrite a non-docstring value placed there, + * such as the symbols used for Oclosures. */ + && (FIXNUMP (AREF (fun, COMPILED_DOC_STRING)) + || STRINGP (AREF (fun, COMPILED_DOC_STRING)) + || CONSP (AREF (fun, COMPILED_DOC_STRING)))) ASET (fun, COMPILED_DOC_STRING, make_fixnum (offset)); else { - AUTO_STRING (format, "No docstring slot for %s"); + AUTO_STRING (format, + (PVSIZE (fun) > COMPILED_DOC_STRING + ? "Docstring slot busy for %s" + : "No docstring slot for %s")); CALLN (Fmessage, format, (SYMBOLP (obj) ? SYMBOL_NAME (obj) |