From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Arbitrary function: find the number(s) of expected arguments
Date: Sat, 26 Mar 2016 12:42:17 +0100 [thread overview]
Message-ID: <CAG7BpaqTPGQ-Mn-jLhM9um0D1jq=LK-F3K_Kv5C5nG2Ui3-v9A@mail.gmail.com> (raw)
In-Reply-To: <83zitlzlsj.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2025 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 2909 bytes --]
next prev parent reply other threads:[~2016-03-26 11:42 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 18:48 Arbitrary function: find the number(s) of expected arguments Paul Pogonyshev
2016-03-15 22:45 ` Davis Herring
2016-03-16 7:41 ` Paul Pogonyshev
2016-03-19 12:26 ` Paul Pogonyshev
2016-03-19 13:10 ` Eli Zaretskii
2016-03-19 13:42 ` Paul Pogonyshev
2016-03-19 13:54 ` Michael Heerdegen
2016-03-19 14:08 ` Eli Zaretskii
2016-03-19 15:20 ` Michael Heerdegen
2016-03-19 15:43 ` Eli Zaretskii
2016-03-19 15:57 ` Michael Heerdegen
2016-03-19 16:24 ` Eli Zaretskii
2016-03-19 17:43 ` Michael Heerdegen
2016-03-19 17:50 ` Eli Zaretskii
2016-03-19 17:59 ` Michael Heerdegen
2016-03-19 18:14 ` Eli Zaretskii
2016-03-19 16:14 ` Philipp Stephani
2016-03-19 16:27 ` Michael Heerdegen
2016-03-19 16:27 ` Eli Zaretskii
2016-03-19 16:30 ` Philipp Stephani
2016-03-19 16:32 ` Eli Zaretskii
2016-03-19 16:34 ` Philipp Stephani
2016-03-19 16:46 ` Philipp Stephani
2016-03-19 16:47 ` Eli Zaretskii
2016-03-19 17:16 ` Philipp Stephani
2016-03-19 17:48 ` Eli Zaretskii
2016-03-19 17:49 ` Philipp Stephani
2016-03-19 18:11 ` Eli Zaretskii
2016-03-19 18:35 ` Michael Heerdegen
2016-04-18 23:02 ` Davis Herring
2016-03-19 19:52 ` Stefan Monnier
2016-03-19 20:33 ` Eli Zaretskii
2016-03-19 22:43 ` Stefan Monnier
2016-03-26 15:55 ` Elias Mårtenson
2016-03-26 17:20 ` Stefan Monnier
2016-03-19 14:26 ` Philipp Stephani
2016-03-19 16:51 ` Paul Pogonyshev
2016-03-19 18:09 ` Eli Zaretskii
2016-03-19 19:32 ` Michael Heerdegen
2016-03-19 19:39 ` Eli Zaretskii
2016-03-19 20:59 ` Michael Heerdegen
2016-03-21 18:36 ` Paul Pogonyshev
2016-03-25 8:44 ` Eli Zaretskii
2016-03-25 16:16 ` Paul Pogonyshev
2016-03-25 16:35 ` Drew Adams
2016-03-25 17:16 ` Paul Pogonyshev
2016-03-25 18:19 ` Drew Adams
2016-03-25 18:28 ` Clément Pit--Claudel
2016-03-25 18:51 ` Use plain-text for mail [was: Arbitrary function: find the number(s) of expected arguments] Drew Adams
2016-03-25 18:57 ` Use plain-text for mail [ Lars Magne Ingebrigtsen
2016-03-25 19:49 ` Andreas Schwab
2016-03-26 1:12 ` Use plain-text for mail [was: Arbitrary function: find the number(s) of expected arguments] Yuri Khan
2016-03-25 17:39 ` Arbitrary function: find the number(s) of expected arguments Eli Zaretskii
2016-03-25 18:31 ` Drew Adams
2016-03-26 8:27 ` Eli Zaretskii
2016-03-26 11:42 ` Paul Pogonyshev [this message]
2016-04-02 9:48 ` Eli Zaretskii
[not found] ` <<83y49e731p.fsf@gnu.org>
2016-03-19 19:21 ` Drew Adams
2016-04-18 18:43 ` Davis Herring
2016-03-16 3:47 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAG7BpaqTPGQ-Mn-jLhM9um0D1jq=LK-F3K_Kv5C5nG2Ui3-v9A@mail.gmail.com' \
--to=pogonyshev@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).