From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55829 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.gnus.general Subject: Re: how to turn this Gnus function into a macro? Date: Thu, 08 Jan 2004 05:13:37 +0100 Sender: ding-owner@lists.math.uh.edu Message-ID: References: <4noetfo10c.fsf@collins.bwh.harvard.edu> <4nekubb8ry.fsf@collins.bwh.harvard.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1073535502 16243 80.91.224.253 (8 Jan 2004 04:18:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Jan 2004 04:18:22 +0000 (UTC) Original-X-From: ding-owner+M4369@lists.math.uh.edu Thu Jan 08 05:18:19 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AeRcg-0003Co-00 for ; Thu, 08 Jan 2004 05:18:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1AeRcT-0003Zx-00; Wed, 07 Jan 2004 22:18:05 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AeRcP-0003Zs-00 for ding@lists.math.uh.edu; Wed, 07 Jan 2004 22:18:01 -0600 Original-Received: from pfepb.post.tele.dk (pfepb.post.tele.dk [195.41.46.236]) by justine.libertine.org (Postfix) with ESMTP id A496B3A005B for ; Wed, 7 Jan 2004 22:18:00 -0600 (CST) Original-Received: from [195.215.224.211] (0xc3d7e0d3.esnxr4.ras.tele.dk [195.215.224.211]) by pfepb.post.tele.dk (Postfix) with ESMTP id D0B615EE0C5 for ; Thu, 8 Jan 2004 05:17:58 +0100 (CET) Original-To: Ding Mailing List Mail-Followup-To: Ding Mailing List In-Reply-To: <4nekubb8ry.fsf@collins.bwh.harvard.edu> (Ted Zlatanov's message of "Wed, 07 Jan 2004 19:09:53 -0500") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55829 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55829 Ted Zlatanov writes: > On Wed, 07 Jan 2004, harder@ifa.au.dk wrote: > >> Why do you want it as a macro? If it's just to save a function >> call, then `inline' or `defsubst' is better. > > Because it can be much simpler, in the form > > ;; field is 'from or 'message-id for instance > (eval (format "mail-header-%s" (symbol-name field))) > > Only a few lines, and it could be used with anything as the field, > instead of the hard-coded field names I have now. Yeah, I see what you mean. `mail-header-*' should really be defsubsts rather than macros, but unfortunately the Emacs byte compiler isn't good enough to make them as efficient (it should be possible for a sufficiently smart compiler). > It also seemed like an interesting challenge, but I failed it pretty > badly :) You can sometimes cheat and funcall a macro by wrapping a lambda around it: (funcall (lambda (x) (macro x)) y) But if you think about when macro expansion happens, it's obvious that it can only work in a few cases.