emacs-devel
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
Re: Arbitrary function: find the number(s) of expected arguments
From
:
Paul Pogonyshev
Subject
:
Re: Arbitrary function: find the number(s) of expected arguments
Date
:
Sat, 26 Mar 2016 12:42:17 +0100
Eli Zaretskii wrote:
> > In the attached patch I modified `doc/lispref/functions.texi': text about
> > `subr-arity' is moved to a new section above about `func-arity' and
> > adapted as needed. `subr-arity' is still in the documentation, but I
> > replaced its description with an advice to use `func-arity' instead. Is
> > that enough?
>
> It's enough, but in the future please also provide a NEWS entry, like
> the one I added.
>
> > Do you still need changelog entries? Long time since I committed
> > anything to Emacs, maybe you finally got rid of them (I hope)?
>
> We no longer maintain ChangeLog files in the repository, but we do
> request commit log messages in the ChangeLog format, so please do
> provide them in the future. (I wrote them for you this time.)
OK.
> I pushed the changes to the master branch, thanks.
Thank you.
> There's one potential issue left:
>
> (func-arity 'with-temp-buffer) => error-> Invalid function: with-temp-buffer
>
> Is it possible to support macros as well? If not, how about producing
> a more meaningful error message?
Well, according to `functionp' macros are not functions, so it's
sort of correct. On the other hand, it seems (symbol-function ...)
works, returning ('macro . FUNCTION) for them. However, I can't
find any real C-level way to handle macros, e.g. `macrop' is even
not a builtin.
Or is just treating them as lists fine? If so, we could add
something like this (untested):
diff --git a/src/eval.c b/src/eval.c
index 64a6655..5c594b8 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2958,6 +2958,9 @@ function with `&rest' args, or `unevalled' for a special form. */)
&& (function = XSYMBOL (function)->function, SYMBOLP (function)))
function = indirect_function (function);
+ if (CONSP (function) && EQ (XCAR (function), Qmacro))
+ function = XCDR (function);
+
if (SUBRP (function))
result = Fsubr_arity (function);
else if (COMPILEDP (function))
However, I'm not exactly sure what will happen with autoloaded
macros.
Paul
reply via email to
[
Prev in Thread
]
Current Thread
[
Next in Thread
]
Re: Arbitrary function: find the number(s) of expected arguments
,
(continued)
Re: Arbitrary function: find the number(s) of expected arguments
,
Paul Pogonyshev
,
2016/03/25
RE: Arbitrary function: find the number(s) of expected arguments
,
Drew Adams
,
2016/03/25
Re: Arbitrary function: find the number(s) of expected arguments
,
Clément Pit--Claudel
,
2016/03/25
Use plain-text for mail [was: Arbitrary function: find the number(s) of expected arguments]
,
Drew Adams
,
2016/03/25
Re: Use plain-text for mail [
,
Lars Magne Ingebrigtsen
,
2016/03/25
Re: Use plain-text for mail [
,
Andreas Schwab
,
2016/03/25
Re: Use plain-text for mail [was: Arbitrary function: find the number(s) of expected arguments]
,
Yuri Khan
,
2016/03/25
Re: Arbitrary function: find the number(s) of expected arguments
,
Eli Zaretskii
,
2016/03/25
RE: Arbitrary function: find the number(s) of expected arguments
,
Drew Adams
,
2016/03/25
Re: Arbitrary function: find the number(s) of expected arguments
,
Eli Zaretskii
,
2016/03/26
Re: Arbitrary function: find the number(s) of expected arguments
,
Paul Pogonyshev
<=
Re: Arbitrary function: find the number(s) of expected arguments
,
Stefan Monnier
,
2016/03/15
Prev by Date:
Re: [elpa] master 84579a9: * packages/seq/seq-25.el: Better declarations for seq--when-emacs-25-p
Next by Date:
Re: [Emacs-diffs] master 269d563: Support completion of attribute values in CSS mode
Previous by thread:
Re: Arbitrary function: find the number(s) of expected arguments
Next by thread:
Re: Arbitrary function: find the number(s) of expected arguments
Index(es):
Date
Thread