From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Is it possible for a macro to expand to nothing? Date: Mon, 23 Nov 2009 16:31:34 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1258994536 22033 80.91.229.12 (23 Nov 2009 16:42:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2009 16:42: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 Mon Nov 23 17:42:09 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 1NCbzM-0000wO-SZ for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 17:42:09 +0100 Original-Received: from localhost ([127.0.0.1]:53501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCbzM-00087o-F1 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 11:42:08 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!kanaga.switch.ch!switch.ch!news.belwue.de!news.tu-darmstadt.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: marvin.muc.de Original-X-Trace: colin2.muc.de 1258993894 58542 2001:608:1000::2 (23 Nov 2009 16:31:34 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Mon, 23 Nov 2009 16:31:34 +0000 (UTC) User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386)) Original-Xref: news.stanford.edu gnu.emacs.help:174981 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:70052 Archived-At: Drew Adams wrote: >> 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." >> ......) > Hi Alan, > I'm not sure what you mean. You might not be the only one. ;-) I think I want to be able to do this: (defun foo () (setq bar 1) (ifdef baz (setq bar 2))) , and if baz is nil at compile time, this function should be identical to (defun foo () (setq bar 1)) . > But if you mean something like "insert nothing", then you can do that > by producing nil and then using ,@ inside a backquote. IOW, instead of > inserting nil, you splice it in, which means inserting nothing. That means I need to have "`,@" in the invoking defun, doesn't it? Maybe that would work, even if it is ugly. > HTH. -- Alan Mackenzie (Nuremberg, Germany).