From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: debug declaration. Date: Wed, 23 Mar 2005 13:18:32 -0500 Message-ID: References: <87br9a8ijc.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1111603026 27877 80.91.229.2 (23 Mar 2005 18:37:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 Mar 2005 18:37:06 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 23 19:37:06 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DEAdM-0004dH-MX for ged-emacs-devel@m.gmane.org; Wed, 23 Mar 2005 19:31:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEAuu-0003gp-Ab for ged-emacs-devel@m.gmane.org; Wed, 23 Mar 2005 13:49:20 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DEAqr-0002Dh-5H for emacs-devel@gnu.org; Wed, 23 Mar 2005 13:45:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DEAqf-00028F-PZ for emacs-devel@gnu.org; Wed, 23 Mar 2005 13:45:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEAqd-00024z-Uq for emacs-devel@gnu.org; Wed, 23 Mar 2005 13:44:56 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DEARC-000246-IB for emacs-devel@gnu.org; Wed, 23 Mar 2005 13:18:38 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id EF0F734000F; Wed, 23 Mar 2005 13:18:37 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 316164AC23C; Wed, 23 Mar 2005 13:18:32 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 2088C156065; Wed, 23 Mar 2005 13:18:32 -0500 (EST) Original-To: Lute Kamstra In-Reply-To: <87br9a8ijc.fsf@xs4all.nl> (Lute Kamstra's message of "Wed, 23 Mar 2005 16:54:15 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.824, requis 5, autolearn=not spam, AWL 0.08, BAYES_00 -4.90) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:35055 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35055 > (declare (debug (sexp form form form form form &optional stringp))) > X(define-generic-mode my-mode > (list ?# ?% (+ 50 9)) > (list "abba" "ebbe" (concat "ob" "bo")) > nil > X(list "\\.mm\\'")X > nil > "This is My mode.")X That's because when you execute the call to define-generic-mode, only the fourth argument is actually evaluated. All the others will only be evaluated when the defined function is actually called. I.e. it's normal. OTOH, with your definition you'll get bugs when you actually call my-mode because the instrumented code that's then executed is executed in an environment where edebugging is not expected. To fix this problem, you need to use `def-form' instead of `form' for them. Try (debug (sexp def-form def-form def-form form def-form [&optional stringp])) Another option is to evaluate those arguments before you plug them in the body of your major mode function, so they're only evaluated once, when the major mode is defined, thus reproducing the "pre-macro" behavior. Stefan