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 4LkhCI/6V2AebwAA0tVLHw (envelope-from ) for ; Mon, 22 Mar 2021 02:01:51 +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 KDG8A4/6V2DTLQAAbx9fmQ (envelope-from ) for ; Mon, 22 Mar 2021 02:01:51 +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 E490B22B52 for ; Mon, 22 Mar 2021 03:01:49 +0100 (CET) Received: from localhost ([::1]:35814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lO9t6-0002vN-Bg for larch@yhetil.org; Sun, 21 Mar 2021 22:01:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lO9sH-0002uo-0g for emacs-orgmode@gnu.org; Sun, 21 Mar 2021 22:00:57 -0400 Received: from mx1.riseup.net ([198.252.153.129]:38502) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lO9sE-0005He-Dk for emacs-orgmode@gnu.org; Sun, 21 Mar 2021 22:00:56 -0400 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4F3d4y6pZCzDqBM for ; Sun, 21 Mar 2021 19:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1616378450; bh=41YlW5I0aeRCELDfNmYz8RhoCO2a0it7KXafZPw5W08=; h=From:To:Subject:Date:From; b=kQQibckTxMD+jvsr6nFlYPwIHh6LqZYUMCznsDu86pQzbWY2r3IER45EO3hLVLg2L scSRDKtrBm49NTmsGKne5ASiuaCrZv5juGDVnhU9Wa8G2xbTdpMCgRCuxB/polRVGz cGvk1AYKZXCgqDZksc6leheYUaLToQuN6yyRSEn0= X-Riseup-User-ID: E10B9242C08E7742760DC9B77B84729E99497BA4491ACD1BAA918A88959B6A23 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4F3d4y1kmxz1yBB for ; Sun, 21 Mar 2021 19:00:50 -0700 (PDT) From: c4t0 To: emacs-orgmode@gnu.org Subject: source blocks DAG evaluation Date: Sun, 21 Mar 2021 23:00:46 -0300 Message-ID: <87k0q0ymk1.fsf@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=198.252.153.129; envelope-from=c4t0@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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=1616378510; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=+4RPAhKWoyrE73Ee9HxBP3pwN/nj1ygDy0gdVcnkoQ0=; b=XcqOPjQHPDvuGIIOfPFfCXQK0L6PApvoryOi9Y8ytnq+6m/N9UbZJlPjjJF+psmpnEyT2w NAgGPhKO9SlhpCkej9isdiPG4tpkmFZ2nTdBy3AfBfl5NMBWzzZ2a8WaCeXkHcGn0tmInx hi75tQ3SAJLiCUqveuAKzI3ZYcvlpR8Pa90nCchdNPHQCbMAU0cgyR7jpxRcPKEpQri7yU AV0G52rQjPvYhkfo2CarOkcprqtJSSSrAwUCWEYRDP5mH9poXlX00o193DPPDVHdYzRbJ4 BQu+JbBsABGOjW+RnTYKN4JTMbwxkrx0GsswGESxD2wmxCEY1XhULm/P33jhkg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616378510; a=rsa-sha256; cv=none; b=A1kDOWtZQDGch1rrohV1vY6w3Xt7pMGDgubQbQCcL5GHqJ9qcAwYVzHGRPwy5wWlNrBkFU /ZkWvEHnlPE8eKjaRTl7nTWxO+5DhSd6r5EzsoP/PFH+CqfIBnFQeytCOANlwiMaLZuA8T to0pqiUSh6WKce2od/XNBEa4YLpa3BQIbRMtJeshHCD8dEPQbw92rkKkMo9xikIdgAETLc /P1aZrAE2rHAO6xJful+ptnx9KoT1tSFTlz38xjvrcgxNyKMrOD+2JRAOTPn7oiBYVH3WD jOxcd7Stj6PDPUtQgQN2/XTJbDz+DXBmF4GrAhTYe64ZRoZlw4rdaJ4oHCpidA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=kQQibckT; 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: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=kQQibckT; dmarc=pass (policy=none) header.from=riseup.net; 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: E490B22B52 X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: nuGaw19N8lQ2 Hi, Is it possible to have a dependency hierarchy of source blocks? i.e.: in C, if you use libA from a compilation unit and that library needs = libB, you don't need to include it in main.c -> main.c #include "libB.h" -> libB.c #include "libA.h" you don't need to: -> main.c #include "libB.h" #include "libA.h" because library headers are closed under inclusion. I haven't succeeded in doing the same in org-mode. Even after populating or= g-babel-library-of-babel. Using #+call just doesn't work. Using :var is better, evaluates all, but th= ere appears to lack session support, it doesn't check for cycles and it fee= ls a little hacky With #+call I need to do it like this: #+name: libA #+begin_src scheme :results none (define hi "hello") #+end_src #+name: libB #+begin_src scheme :results none (define greetings (string-append hi ", " "to all the people!")) #+end_src here is my "main" I need to C-c C-c in each #+call line and write the :sess= ion that the code block uses in each one, and do it in the correct order. I= f I C-c C-c in libB first it won't eval because 'hi' is not defined. #+call: libB[:session example] #+call: libA[:session example] #+begin_src scheme :session example :results output (display greetings) #+end_src source blocks can be #+call(ed) but aren't closed under #+call (a source bl= ock can be called but then the callee won't)=20 instead I would like to : #+name: libA #+begin_src scheme :results none (define hi "hello") #+end_src #+call: libA #+name: libB #+begin_src scheme :results none (define greetings (string-append hi ", " "to all the people!")) #+end_src #+call: libB #+begin_src scheme :session example :results output (display greetings) #+end_src - there shouldn't be needed to C-c C-c in the #+call line, evaluating the s= ource block alone should suffice. - there shouldn't be a need to write the :session - it should use the session of the user evaled block, unless specified ot= herwise In the other hand, using :var with a dummy variable: #+name: libA #+begin_src scheme :results none (define hi "hello") #+end_src #+name: libB #+begin_src scheme :results none :var _=3DlibA (define greetings (string-append hi ", " "to all the people!")) #+end_src #+HEADER: :var _=3DlibB #+begin_src scheme :session example :results output=20 (display greetings) #+end_src It evals libA then libB and finally the (display greetings) code. But it fails, because the :session example is ignored. Even if I add a :ses= sion example to every source block (which would be really bad, sessi=C3=B3n= must be decided by the consumer) it doesn't work. I think that is because = :var expects a value, so it just opens a new session to evaluate code every= time. Besides if there are any dependency cycles, it just fails with: Lisp nestin= g exceeds =E2=80=98max-lisp-eval-depth=E2=80=99 So if I'm right and there is not an implemented way to do this, how can we = do it? Adding session support for :var? constructing a DAG of #+calls and t= hen evaluating in order? maybe using a new header? COD.