[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23873: Emacs 24.0.94: With function argdesc bitstring, Elisp manual
bug#23873: Emacs 24.0.94: With function argdesc bitstring, Elisp manual does not say how to get arg list
Thu, 30 Jun 2016 10:11:34 -0400
Is there a Lisp function to extract the argument list of a byte-coded
function when it uses the bitstring arg descriptor in its first
element (see below for the Elisp manual doc on this)?
I would suggest that the documentation be updated to describe how to
get the argument signature in this situation, as it is silent on that.
This has come up when a standard function was advised and we need to
get its argument list for some code handling.
Internally, a byte-code function object is much like a vector; its
elements can be accessed using ‘aref’. Its printed representation is
like that for a vector, with an additional ‘#’ before the opening ‘[’.
It must have at least four elements; there is no maximum number, but
only the first six elements have any normal use. They are:
The descriptor of the arguments. This can either be a list of
arguments, as described in *note Argument List::, or an integer
encoding the required number of arguments. In the latter case, the
value of the descriptor specifies the minimum number of arguments
in the bits zero to 6, and the maximum number of arguments in bits
8 to 14. If the argument list uses ‘&rest’, then bit 7 is set;
otherwise it’s cleared.
If ARGDESC is a list, the arguments will be dynamically bound
before executing the byte code. If ARGDESC is an integer, the
arguments will be instead pushed onto the stack of the byte-code
interpreter, before executing the code.