From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: `defun' doesn't complain when arglist is missing. Date: Thu, 24 Oct 2013 23:23:17 +0200 Organization: Informatimago Message-ID: <87d2mufjne.fsf@informatimago.com> References: <87zjpzybt9.fsf@linaro.org> <877gd3lcou.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1382649916 20205 80.91.229.3 (24 Oct 2013 21:25:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Oct 2013 21:25:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 24 23:25:21 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VZSPA-0007cY-B8 for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Oct 2013 23:25:20 +0200 Original-Received: from localhost ([::1]:56349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZSP9-0006XS-M7 for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Oct 2013 17:25:19 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-X-Trace: individual.net wJxBYPhFyZ5kruAYxARBaADzQtSa96/qGvrfogiHl93LgUaNhq Cancel-Lock: sha1:NjdhODFlYzVjYjVhNzNmYzBkNmQ1NGU1OWYxZThmMzdlY2YwYWEwMA== sha1:z7AJdip+naeZmvY7HU2Zjgw5/K0= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:201931 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94199 Archived-At: Nicolas Richard writes: > Alex Bennée 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/