From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id AMgwKsMIWGZz4gAAe85BDQ:P1 (envelope-from ) for ; Thu, 30 May 2024 07:04:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id AMgwKsMIWGZz4gAAe85BDQ (envelope-from ) for ; Thu, 30 May 2024 07:04:03 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ifi.uio.no header.s=key2309 header.b=VXbaUBAE; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717045443; a=rsa-sha256; cv=none; b=tWjSNA9Ws4SJvWpBnEcOqzQD5qIVJ0i0AOoEU+LZQaS4+gUe64TrwoXtpQhbIthL2mkWkU cOmnYmv2dnPIwfZSHr1lTtJ+tF/u4jP/iWlNYzYLLrzv51PdXw+9oW+2PdLBWqTv5ofq4q QWnqN7uDrE2Klwwup3NrfL60/37wvIA+aF0sV23FxFMfcCGb+HA7oQqhvJd4DsIr5eGbgs xIdMl6+7ofGIXdfi3b0ycJs0k+a95XIm+aJjeHVO5z4yXj9hU4eG2yka4jaBNNotM3FkOP BCmtZNOzKtzJS1cyXJQx2YB99pLzHXUJFv4WZZv1yvOLwRiM7HPlu5Y0plBfJw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ifi.uio.no header.s=key2309 header.b=VXbaUBAE; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717045443; 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=Bz2UghPZ5ASDPraNheeNFHK6jRkhJNqcfA1N+9Fs/BQ=; b=d7drMz8toc2ks4lcwJfXnpCzOO22QwqZ8mmuTEf35vFHUZJl0rorSAlpnRlPyi9EePjjjn 3UJl2JyWbFKjUfIPeSt5/ZNDN2XZ9rhK8OpI7bBskCrBtWbSa1bvEnfdLxSk4wsMqMzTOg 5uMz3LZtwofEUB4einMFXN/BMErB/Ki8/SJdoztSi8aGWUNXX29iGIxwgUvPO0SFe+F+D+ ffqOC1kezeOOMfIT7KTYwaEHrstPoqQSWGJQUulXvOTeBArRPzG2GfQ2lfUKUtYjG9rS46 zmWWYyTubs7cfAKzngETkKKFEON0HEzB4VPsX9dKtqLkL8JEL8fOe/pM4xqIOg== 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 38B38127DC for ; Thu, 30 May 2024 07:04:03 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCXwi-0002ft-7e; Thu, 30 May 2024 01:03:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCXwf-0002fQ-Gk for emacs-orgmode@gnu.org; Thu, 30 May 2024 01:03:21 -0400 Received: from mail-out01.uio.no ([2001:700:100:10::50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCXwa-0006Ly-8j for emacs-orgmode@gnu.org; Thu, 30 May 2024 01:03:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ifi.uio.no; s=key2309; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Bz2UghPZ5ASDPraNheeNFHK6jRkhJNqcfA1N+9Fs/BQ=; b=VXbaUBAETswQIMrVp9CJXfWATp C9gcq5wmJwWr9P1bTq7jPut7wwAphoyKIhRO2SluM/aC+i5883bTTltui+z2fTYF5i0zMxV90Zd42 xMy99iwGCKNfbARFviNOG3ACaIz52JEtZgyn4b1SzV4M4lQgMNc4E0By5z+jcUpmFR39WAqY4ByNT WKd0o5tYhg+3Z0xIYMLvWtL3LbFfDJ0yANpSl/Khc9WD270U5IGn6/lRqG+X68rUEtmDX3Duh0uzy KSIEvT66NvzYFYZc7UUCbkeNRSBosc2SEvPjeiE2RRoEvI/yCpkMjWcIkPrD6DDmkqIjcpauEXAMc xMq6mjzQ==; Received: from mail-mx12.uio.no ([129.240.10.84]) by mail-out01.uio.no with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1sCXwW-00ELsC-2R for emacs-orgmode@gnu.org; Thu, 30 May 2024 07:03:12 +0200 Received: from afram.ifi.uio.no ([129.240.65.60] helo=afram.ifi.uio.no.shmi.ifi.uio.no) by mail-mx12.uio.no with esmtps (TLS1.2:ECDHE-ECDSA-AES256-GCM-SHA384:256) (Exim 4.96.2) (envelope-from ) id 1sCXwU-000BHN-2g; Thu, 30 May 2024 07:03:12 +0200 From: Martin Steffen To: Org Mode List Subject: Re: question about links, macros + org-publish and "parametrization" References: <877cfdovmb.fsf@ucl.ac.uk> Date: Thu, 30 May 2024 07:03:04 +0200 In-Reply-To: (Martin Steffen's message of "Thu, 30 May 2024 05:52:31 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-UiO-SPF-Received: Received-SPF: neutral (mail-mx12.uio.no: 129.240.65.60 is neither permitted nor denied by domain of ifi.uio.no) client-ip=129.240.65.60; envelope-from=msteffen@ifi.uio.no; helo=afram.ifi.uio.no.shmi.ifi.uio.no; X-UiO-Spam-info: not spam, SpamAssassin (score=-4.8, required=5.0, autolearn=disabled, T_SCC_BODY_TEXT_LINE=-0.01, UIO_HTTP=0.2, UIO_MAIL_IS_INTERNAL=-5) X-UiO-Scanned: 8C2CB1A51AC3E0322E926583F3743025CD9589DB X-UiOonly: BADAA9C8AE5ED54FA33239567C0671C28BA79E36 Received-SPF: pass client-ip=2001:700:100:10::50; envelope-from=msteffen@ifi.uio.no; helo=mail-out01.uio.no X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_CSS=0.1 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 38B38127DC X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -2.35 X-Spam-Score: -2.35 X-TUID: sJS6OXon6g/0 Hi, maybe my email was premature. The combination of macros and links you described is nice and useful for me (I did not much in the ways of macros in org before). However, one aspect I am after seems not to work. Your example was as follows, and it works: --8<---------------cut here---------------start------------->8--- #+macro: link [[file:t.org][$1]] #+macro: target {{{link($1)}}} This is some text where I can look at {{{target(blah)}}} --8<---------------cut here---------------end--------------->8--- There are 2 tweaks I had in mind in addition to your example, which I can't get to work. The first one is that the argument for the macro link should (also) occur in the first part, a part of the link, not the text: #+macro: source [[file:./$1/t.org][for the subdirectory $1]] That actually works, if one uses in the text {{{target(bla)}}} that's great, but it leaves me replacing in the text many occurrences of "bla" across many files. The second tweak is that "bla" is a macro as well (centrally defined). something like the following (modifing your example) --8<---------------cut here---------------start------------->8--- #+macro: year 24 #+macro: source [[file:./$1/t.org][for the year $1]] #+macro: target {{{source({{{year}}})}}} --8<---------------cut here---------------end--------------->8--- Then of I call the macros 1) {{{source(24)}}} : that works, $1 is replaced both times and the link points to file:./24/t.org 2) {{{source({{{year}}})}}}: that does not work 3) {{{target}}} : that does not work either In both cases 2) and 3), the result of the macro expansion is the following (I export to markdown) [for the year 24](./{{{year}}}/t.md) - [for the year 24](./{{{year}}}/t.md) i.e, the argument (intended to be 24) is properly replaced in ``text part'' but not in the `` link'' part. I don't know if I simply expect ``too much'' from the macro-expansion facilities.... best, Martin >>>>> "Martin" == Martin Steffen writes: >>>>> "Fraga," == Fraga, Eric writes: Martin> Fraga,> Hello, Martin> Fraga,> I'm not entirely sure if I am missing something Martin> but, in case Martin> thanks, it was more that I was missing something. I tried to Martin> combine links and macros in a naive ways (without much Martin> studying the manual), so I thought perhaps nesting is not Martin> possible (or there is another way). Martin> Your suggestion solves my "problem" and makes the set-up a Martin> bit more "parametric" and easier to adapt, without that one Martin> forgets some bits, which is very nice. Martin> best, Martin Martin> Fraga,> it helps, macros can themselves invoke other Martin> macros and Fraga,> macros can make use of [[target][desc]] Martin> syntax directly. Fraga,> Can you not build up a hierarchy Martin> of macros that would Fraga,> achieve what you want, along Martin> these lines: Martin> Fraga,> #+macro: link [[file:t.org][$1]] Martin> Fraga,> #+macro: target {{{link($1)}}} Martin> Fraga,> This is some text where I can look at Martin> {{{target(blah)}}} Martin> Fraga,> HTH, eric Martin> Fraga,> -- : Eric S Fraga, with org Martin> release_9.6.19-1230-g407a55 in Fraga,> Emacs 30.0.50