From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: `defun' doesn't complain when arglist is missing.
Date: Thu, 24 Oct 2013 23:23:17 +0200 [thread overview]
Message-ID: <87d2mufjne.fsf@informatimago.com> (raw)
In-Reply-To: mailman.4604.1382612629.10748.help-gnu-emacs@gnu.org
Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
> Alex Bennée <kernel-hacker@bennee.com> writes:
>> You can happily C-x C-e eval-last-sexp both of those defuns without
>> complaint. The error in the defun only shows up when you try and execute them.
>
> I was caught by this a few times. Wouldn't it make sense to add
>
> (unless (and (listp arglist)
> (null (delq t (mapcar #'symbolp arglist))))
> (error "Malformed arglist: %s" arglist))
>
> near the beginning of "defun" in byte-run.el ? Or am I being naive
> again ?
>
>
> I guess it's not there for a reason, but what is it ?
(require 'cl)
(unless (and (listp arglist) (every (lambda (arg) (and arg (symbolp arg))) arglist))
(error "Malformed arglist: %s" arglist))
or if you insist on not using cl,
(dolist (arg (if (listp arglist) arglist '("")))
(unless (and arg (symbolp arg))
(error "Malformed arglist: %s" arglist)))
--
__Pascal Bourguignon__
http://www.informatimago.com/
prev parent reply other threads:[~2013-10-24 21:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 20:25 Help debugging backtrace Alex Bennée
2013-10-24 0:44 ` Michael Heerdegen
2013-10-24 9:54 ` Alex Bennée
2013-10-24 10:19 ` Alex Bennée
2013-10-24 10:57 ` Michael Heerdegen
2013-10-24 11:04 ` `defun' doesn't complain when arglist is missing Nicolas Richard
2013-10-24 17:14 ` Stefan Monnier
[not found] ` <mailman.4604.1382612629.10748.help-gnu-emacs@gnu.org>
2013-10-24 21:23 ` Pascal J. Bourguignon [this message]
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=87d2mufjne.fsf@informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@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.
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).