From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sNHLB0g1819dWQAA0tVLHw (envelope-from ) for ; Mon, 04 Jan 2021 15:33:28 +0000 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 gPWLA0g1818RIgAAbx9fmQ (envelope-from ) for ; Mon, 04 Jan 2021 15:33:28 +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 6FA169406F7 for ; Mon, 4 Jan 2021 15:33:27 +0000 (UTC) Received: from localhost ([::1]:33466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwRrK-0007vg-Dd for larch@yhetil.org; Mon, 04 Jan 2021 10:33:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwRqB-0007vK-E3 for emacs-orgmode@gnu.org; Mon, 04 Jan 2021 10:32:15 -0500 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:44692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwRq9-0004QX-G7 for emacs-orgmode@gnu.org; Mon, 04 Jan 2021 10:32:15 -0500 Received: by mail-il1-x132.google.com with SMTP id r17so25580260ilo.11 for ; Mon, 04 Jan 2021 07:32:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=iAeXwENHOYjgi6wHCgGG/3cBEMkhXZEHRjyX74BtIQw=; b=dT2zIypAGfROBTjaZwmLUtp1WayJBtLBM/crp5GhCSi+hXQKUv1Kqv7xlPNGolgMuS Nq+See7Yy6ayL3SfaOB10a8oI3gerk0fGwTqjFHhwOgfsDqvVfu1RrEMSHbdEYcletst l7efsIekTa+3re2sSV54dqOUEi/EAkrUOZyM2p+T6QM5lreHf5/OVuXq1DEgI8KhsaMV 9Q2C6wmV6v5dyOVqJgK/Lk2MohbnrTSP39qFlglDujSZhowpcNsoDj4mL3XZMYlM3DJJ jc2Og9TdEBKcgzOKGrncOG/HE2IZRA4tDS9XRGziMzM07cp6d342sigL9FaYOD6qwGbN 3alg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=iAeXwENHOYjgi6wHCgGG/3cBEMkhXZEHRjyX74BtIQw=; b=iLKRKgFNrdVE3D1flTSoH8CFaeEuFzkyWzYEnFwfBy5MXCbBOaYyoK6wOShNmYNhcs NuzJEwgIjTuuKKUXNexS+00qQq7I+NA4hbKEY9oAtJilUUJOg0Y8hcmyXaQ4TWO/v3iL mpvLnfHWS5rIqHULjVH1OifQCzCwKt9rvgUVtbVD/4aAMIXK9A7jkflNfwhzwrLUebpT 8jPbex4mrznCnp58wE0qoAmqbvhgCzeXp9Lvee2toQAjsibmEwi8n8rOhnv3XAzgXyUG nOIuAaE2Qim05eRO5g0DLlcyTs/HVHNQesTGB5+fDr4fYizmAeyiUAaCVhVL1YziYygD cT6Q== X-Gm-Message-State: AOAM530fbHfbq2vCM55waTU6CNqroewlCCdIj/cTw0ef4qtuozps9VFe wV4srD1EL5Eko45ihEObqaO0NhxYpT6oKu0eqw== X-Google-Smtp-Source: ABdhPJwnMVfFEL/4ZJIaqVlM3/97odAT8TUbnWDi/EERbkIpBUER8Or28MSHqFUHUPS5eSRDhA/0z713IMXRZ0aodeo= X-Received: by 2002:a92:9144:: with SMTP id t65mr69555475ild.175.1609774332031; Mon, 04 Jan 2021 07:32:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Immanuel Litzroth Date: Mon, 4 Jan 2021 16:31:36 +0100 Message-ID: Subject: Re: ist here a :post header arg for tangling? To: Diego Zamboni Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::132; envelope-from=immanuel.litzroth@gmail.com; helo=mail-il1-x132.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Cc: gmauer@gmail.com, emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.03 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dT2zIypA; dmarc=pass (policy=none) header.from=gmail.com; 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: 6FA169406F7 X-Spam-Score: -2.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: twQIZ5LdPNoC Well I solved the problem by writing a tangler which can be configured with tangle-config you define a tangler by making a hash "language" -> tangle-hooks. The tangle-hooks are called at beginning of tangling, on each source block, on each noweb-ref and at the end of tangling. They receive the full source-block-info to do their work, and in the case of noweb-references they receive the full stack of sbi's that lead up to this noweb reference. >>> (tangled-buffer "Buffer that is being tangled") (name "Name of the code block") (tangle-file "Filename to tangle to") (properties "Properties of this block") (full-block "Text of the full block") (beg-block "Buffer pos of beginning of the block in the tangled buffer") (end-block "end of the block in the tangled buffer") (lang "language of the tangled buffer") (beg-lang "beginning of the language in the tangled buffer") (end-lang "end of the language in the tangled buffer") (switches "switches of this block") (beg-switches "begin of the switches in this block") (end-switches "end of the switches in this block") (header-args "header args of this block") (beg-header-args "buffer pos of header args beginning") (end-header-args "buffer pos of header args end") (body "body of the tangled block") (beg-body "buffer pos of the beginning of the body") (end-body "buffer pos of the end of the body")) >>> That way I can tangle a multi language org file and do the correct thing fo= r each of the language by defining functions of interest. It's quite flexible, I'm going to use it to do some aspect-oriented programming/tangling when I find the time. Immanuel On Mon, Jan 4, 2021 at 4:11 PM Diego Zamboni wrote: > > Agree. It should be possible to make the hook file-local, but still it's = not trivial to have good control over where and how the changes are made. > > --Diego > > > On Mon, Jan 4, 2021 at 3:51 PM Immanuel Litzroth wrote: >> >> There's that, but you're not gonna do much with that since it is >> global to emacs. If you're brimming >> with vigour you might achieve what you want by rebinding that each >> time you tangle to do the correct >> thing. Not much information is available in that hook, you get dropped >> into a temp buffer containing the >> result of tangling. >> Immanuel >> >> On Mon, Jan 4, 2021 at 3:07 PM Diego Zamboni wrote: >> > >> > There's =3Dorg-babel-post-tangle-hook=3D, which AFAICT specifies hooks= that will be run with the tangled code in a temporary buffer. I couldn't f= ind much documentation nor examples, but it is mentioned at https://orgmode= .org/manual/Extracting-Source-Code.html#Hooks-3 >> > >> > --Diego >> > >> > >> > >> > >> > >> > On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth wrote: >> >> >> >> I don't think there is an arg for that. I have written a tangler that >> >> reuses a lot >> >> of the org-babel machinery and has a more flexible mechanism to decid= e what >> >> to do with the tangled code -- I use it for example to not write a >> >> tangled file if it >> >> hasn't changed, meaning that it will not trigger recompile. >> >> The project is private now but if you're interested I can give you ac= cess to it. >> >> What exactly are you trying to do? >> >> Immanuel >> >> >> >> On Fri, Jan 1, 2021 at 2:09 AM George Mauer wrote: >> >> > >> >> > I'd like to run some code to post-process files after they are tang= led. Is there a header-arg for that? >> >> >> >> >> >> >> >> -- >> >> -- Researching the dual problem of finding the function that has a >> >> given point as fixpoint. >> >> >> >> >> -- >> -- Researching the dual problem of finding the function that has a >> given point as fixpoint. --=20 -- Researching the dual problem of finding the function that has a given point as fixpoint.