unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jean Louis <bugs@gnu.support>
Cc: 40596@debbugs.gnu.org
Subject: bug#40596: 28.0.50; Function with more than one key gives "wrong number of arguments" error
Date: Mon, 13 Apr 2020 15:30:21 +0300	[thread overview]
Message-ID: <831rork1pe.fsf@gnu.org> (raw)
In-Reply-To: <86ftd78wgh.fsf@protected.rcdrun.com> (message from Jean Louis on Mon, 13 Apr 2020 14:19:10 +0300)

> From: Jean Louis <bugs@gnu.support>
> Date: Mon, 13 Apr 2020 14:19:10 +0300
> 
> Here is something that could be a bug, I cannot know at this moment, as
> I am researching yet if I can use &key with Emacs's `defun':
> 
> (defun tmp-function-1 (text html &key one)
>   "This one works fine"
>   (message one))
> 
> (tmp-function-1 "text" "<html>" :one "Hello")
> 
> (defun tmp-function-2 (text html &key one two)
>   "This one does not work, wrong number of arguments"
>   (message one))
> 
> (tmp-function-1 "text" "<html>" :one "Hello" :two "But not alright")
> 
> Evaluating the last function does not work, it gives the error:

You need to use cl-defun, not defun.  The latter doesn't support &key.





  reply	other threads:[~2020-04-13 12:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 11:19 bug#40596: 28.0.50; Function with more than one key gives "wrong number of arguments" error Jean Louis
2020-04-13 12:30 ` Eli Zaretskii [this message]
2020-04-13 13:02   ` Jean Louis
2020-04-13 13:37     ` Eli Zaretskii
2020-04-13 13:43       ` Jean Louis
2020-04-13 13:57         ` Eli Zaretskii
     [not found] <<86ftd78wgh.fsf@protected.rcdrun.com>
     [not found] ` <<831rork1pe.fsf@gnu.org>
     [not found]   ` <<20200413130230.GG15872@protected.rcdrun.com>
     [not found]     ` <<83y2qzik0g.fsf@gnu.org>
2020-04-13 15:01       ` Drew Adams
2020-04-14  2:16         ` Richard Stallman

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=831rork1pe.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=40596@debbugs.gnu.org \
    --cc=bugs@gnu.support \
    /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).