From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Is it possible for a macro to expand to nothing? Date: Mon, 23 Nov 2009 09:29:45 -0800 Message-ID: <8B943B65F2FE437EA64258F9865FE9FD@us.oracle.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 1258997944 2246 80.91.229.12 (23 Nov 2009 17:39:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2009 17:39:04 +0000 (UTC) To: "'Alan Mackenzie'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 23 18:38:57 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 1NCcsD-0001f1-Fr for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 18:38:49 +0100 Original-Received: from localhost ([127.0.0.1]:46170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCcsC-00020f-E4 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 12:38:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCcjg-0005PT-S3 for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 12:30:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCcjb-0005NC-Je for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 12:30:00 -0500 Original-Received: from [199.232.76.173] (port=50349 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCcjb-0005Mx-9m for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 12:29:55 -0500 Original-Received: from rcsinet11.oracle.com ([148.87.113.123]:55230 helo=rgminet11.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NCcjZ-0008CA-Ow for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 12:29:54 -0500 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rgminet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id nANHTqEM024877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Nov 2009 17:29:53 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id nANHTrA9021563; Mon, 23 Nov 2009 17:29:53 GMT Original-Received: from abhmt003.oracle.com by acsmt356.oracle.com with ESMTP id 542197101258997385; Mon, 23 Nov 2009 09:29:45 -0800 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 23 Nov 2009 09:29:45 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcpsW9oTnQi0rhlYTamEFJ8HIfW73wABgUFA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.4B0AC68C.010C:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) 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:70054 Archived-At: > 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)) (defmacro titi (fn) `(defun ,fn () (setq bar 1) ,@(ifdef baz '((setq bar 2)))))) Assuming that ifdef returns nil if baz is nil, that should give you (defun foo () (setq bar 1)). If baz is not nil, it should give you this: (defun foo () (setq bar 1) (setq bar 2)) Or something like that.