From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jeff Clough Newsgroups: gmane.emacs.help Subject: Re: Is it possible for a macro to expand to nothing? Date: Mon, 23 Nov 2009 11:49:00 -0500 (EST) Message-ID: <20091123.114900.179029598.jeff@chaosphere.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1258995072 24119 80.91.229.12 (23 Nov 2009 16:51:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2009 16:51:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 23 17:51:06 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NCc81-00058a-Oi for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 17:51:06 +0100 Original-Received: from localhost ([127.0.0.1]:60514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCc81-00073I-7Z for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 11:51:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCc5Z-00065I-Bz for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 11:48:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCc5X-00064H-8n for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 11:48:32 -0500 Original-Received: from [199.232.76.173] (port=35598 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCc5W-00063y-V3 for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 11:48:31 -0500 Original-Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:45635) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCc5W-00010X-Kl for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 11:48:30 -0500 Original-Received: from localhost ([74.70.71.134]) by hrndva-comm-mta03.mail.rr.com with ESMTP id <20091123164828864.LLNY29910@hrndva-comm-mta03.mail.rr.com> for ; Mon, 23 Nov 2009 16:48:28 +0000 X-Mailer: Mew version 6.3rc1 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (1203?) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70053 Archived-At: From: Alan Mackenzie Date: Mon, 23 Nov 2009 14:56:47 +0000 (UTC) > That is, not to a call to a null defun, but truly to nothing: i.e., the > ensuing code (as least, when byte compiled) will be identical to what it > would have been, had the macro invocation been omitted. > > I want something like this: > > (defmacro ifdef (condition &rest forms) > "If the compile time CONDITION is non-nil, dump the FORMS to the > calling defun. Otherwise do nothing." > ......) I think the short answer to your question is no, you can't do what you are asking with a macro like this. You are looking for what you would get from a C pre-processor #ifdef and that's not what macros in Lisp do. Lisp macros do more and different magic than the C pre-processor. Jeff