From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id nPbHJh66eWCcFwEAgWs5BA (envelope-from ) for ; Fri, 16 Apr 2021 18:23:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id wG83IB66eWBUEgAAbx9fmQ (envelope-from ) for ; Fri, 16 Apr 2021 16:23:58 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9FD001B424 for ; Fri, 16 Apr 2021 18:23:57 +0200 (CEST) Received: from localhost ([::1]:56626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXRG8-00068L-Hj for larch@yhetil.org; Fri, 16 Apr 2021 12:23:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXREx-0005Xd-Jf for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 12:22:43 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:14506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXREv-000752-Cv for emacs-orgmode@gnu.org; Fri, 16 Apr 2021 12:22:42 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8DA67801F1; Fri, 16 Apr 2021 12:22:39 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E701E80240; Fri, 16 Apr 2021 12:22:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1618590157; bh=mXtFXoHAeKnPRTYO2OoqrkSTssXYH+T1FPalIRTAqIM=; h=From:To:Subject:References:Date:In-Reply-To:From; b=XXtm3mvYAV1olyB5JwnmSdT88WvKmwTfJx25Q2q5H0yF2hgbF2DIbaQcg3qzPjVLg YunXLDei6yGrKCg7l2NO8i7GiNVItX0/yHHXYINhFAzDYmQY+L1AOnMeS+i0pv2/jo hkO07Mdu93Pb0qy/iMxRP3CuoE2IvB65dXcVacSaXIzhBi3PNUW6jIHEtcmoBfQSJs PywgftEYw1YAEnApZfc+NyyqPll4Sx3yWSsv8RpXy6sXFu8AunQMLiyVuZYfoEeUB7 7S5UetGP9nljbG9Hdm81QiFDFp3pYl6lIsncnn8cOEtqdwf78LravUWBMH7ca38qee BsBSF0h4HIVIg== Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BF9401200C3; Fri, 16 Apr 2021 12:22:37 -0400 (EDT) From: Stefan Monnier To: emacs-orgmode@gnu.org Subject: Re: Improving org-macro.el Message-ID: References: <87y2diffqi.fsf@nicolasgoaziou.fr> Date: Fri, 16 Apr 2021 12:22:36 -0400 In-Reply-To: <87y2diffqi.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Fri, 16 Apr 2021 16:47:49 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.057 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618590238; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=uYoOOrTaIHM4uXOZvgZ7GRQUjwLJD5eng/ccm89WHzM=; b=nM5IpAJaFgK0xtu6tos92YlsoHigLWBDGTwA35Y7KQZOeY1mnyCr1goaWh8haBp88vpIRd wVZMCnDSPFUGf9sJx1tH0alnd+/HczzhuyoAV5x2ie/2lUEsZNpIjIUtSYsvdQ7FGS8Z9o hI9ESlscYPTbmMOaGm/zW+pOjpmSU0pRv9OuNVdzIR0tELyFFd/i89WCUd7xzqHKAyVqY1 o7scRPyWrghtSR7oszF8ngA0IHS3hHi6N96i+9Gs1PoVtUmqj+ExoNkwxDPMh29G0KT7j9 m1YXK6+z6Rubj72oq+Dk0huEkzjsDFXja5Jt8ohZfMIp9ENHiHFpqUM7EqrRzw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618590238; a=rsa-sha256; cv=none; b=PCzshbyg2GurRS0XX9YvM2R9tcY8OauLQsukcnMpJP3xu9Z2Tojdqvm92zHDgbtI/oVzIx M9WipiSLz23QMigaf5qWP4+15NirV/oyCS1e/M/aPPXZgBWSwG0neCI0oeJaSFyNjjtZb2 8G7Gx+J8vR6pza7MTHeTXTMiobb/ZF1rrGeDoMAKilwpbT5K6i55YTJov1cjSOip4Y0RXU 6NLi9tdoaIOUO5B4m9tP+oDnzatW0Qme2DZGf+E2hQ/cSBcfOv+BEE1GW/vz6afco30dk4 u+Qk5t9WMDb9NxZyBN43j4HRAVPudVn80lUTqpifO4MX8U56dR8v2wWB2uiwPg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=XXtm3mvY; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=XXtm3mvY; dmarc=pass (policy=none) header.from=iro.umontreal.ca; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 9FD001B424 X-Spam-Score: -2.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: qI15EWYfuRlA >> It seems to work on Org's own manual, but other than that I haven't gone >> out of my way to test it. > There were a few problems reported by the test suite that I tried to > address. I also updated `org-lint', which didn't handle macro > definitions as functions. Thanks. >> - It also changes the behavior when $N appears elsewhere than an >> "expression context". E.g.: >> #+macro: (eval (let (($1 foo)) (bar))) > This is not a valid macro definition anyway since placeholders are > strings. Indeed for this specific example it was invalid anyway, but I can imagine some variations on the theme where it still lead to valid code. >> #+macro: (eval (fun-with "code $1")) > I don't think this was valid previously either, for the same reason. I'm pretty sure this could be made to do interesting things, tho it does feel a bit like "exploiting a security hole" ;-) >> I don't think it requires changes to the manual because the semantics >> described in the manual is sufficiently incomplete that both the old and >> the new semantics satisfy it. > > One noticeable effect is that empty or missing placeholders in macro > call are now nil, instead of the empty string. This broke our internal > macros (e.g., {{{n}}} and {{{property}}}) so I updated them. Ah, indeed, that was indeed a more serious difference which I had missed (I see in one of my tests failed to catch it just because `concat` treats nil and "" in the same way). > I mentioned it in the ORG-NEWS file, and applied your changes. We'll see > how it goes. Great, thanks. BTW, macros of the form #+macro FOO (lambda ...) would lead to much simpler code on `org-macro.el` ;-) Stefan