From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mF/ZAZsb6WLmIQEAbAwnHQ (envelope-from ) for ; Tue, 02 Aug 2022 14:42:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KJT2AZsb6WJIAAEA9RJhRA (envelope-from ) for ; Tue, 02 Aug 2022 14:42:03 +0200 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 C86CB1204F for ; Tue, 2 Aug 2022 14:42:02 +0200 (CEST) Received: from localhost ([::1]:35186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIrDl-0004rV-Ic for larch@yhetil.org; Tue, 02 Aug 2022 08:42:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIrDI-0004rA-V1 for emacs-orgmode@gnu.org; Tue, 02 Aug 2022 08:41:33 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:53912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIrDH-0003ap-CN for emacs-orgmode@gnu.org; Tue, 02 Aug 2022 08:41:32 -0400 Received: by mail-pj1-x1032.google.com with SMTP id pm17so7926824pjb.3 for ; Tue, 02 Aug 2022 05:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=iUx+VBftWr28+voOhcSyYb/y7yd4vWv/g57d9/JC+ZY=; b=lSOWeBmvzz2wjGZriS4vEBOqwNDsIKmP3qNhFFSlUtYfV4w8tY+8WrCnifNZVwhxSR FZP9rgtMe5EE1/IsreHWuLihH89F8kkGVNxjD+t0pWtbxXTJvCBZOPnzqt/xyzGWITJy YQ3Rl9r3gXcrQRaRL6NaPDmiNAaoehQvyIY7oS7cYu6PQUBxhZN3PMPV8ZlW14qZL9Ot WnbMS5mfj3qBdwHPnqiah4EJ8FVZd1PnTkZb6c+0qJg/gqU6wRsHispQ8/DxT2P9tiT+ GRUJ/JN4PRXXkG50kDbVcvstpSl2Vv6mOlTU0C8EEIqd9xUqyn/7+qNcnPY9M2D0UGjI rpig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=iUx+VBftWr28+voOhcSyYb/y7yd4vWv/g57d9/JC+ZY=; b=0fB0wh6cJWTadfGj6fZLnU2iS4U+LgVf22TASW37HD5cHcnMStihptfRgNhScpDngv THex5O/QANoL2PAs3tmsx6HfFa9BCLT5OQf9BfQuTcip3VWpKdR8h2dzY9eyXYiq9oLR sMYyy/cllzJUteAj9RzDl084VjeiHuTH6unXpM2Wp8XKhrooAeuj5Z7rpxgQ0veUKd1b wrlq1f3z6exM+TrFnIOoGRjpqyMxYzU9HaNa6zJFus//toGF6n6oCsWhhDsUXwFxniM2 gxb/Qz7wiX5MIe4aW+VWrQ8XN4cJntaPf0Tz01Y46T5TUXgsEgauGKNMOMwDxDiMZ+7G xGtQ== X-Gm-Message-State: ACgBeo2hxiHsqd0DN1wnHf2QU8klbdTpGtLxsbYLgtVWKixofhVcYV8w md9MZHt6XM62Tw7HEZcUuGwHY5Z9u5E= X-Google-Smtp-Source: AA6agR59xzlM3BEUzErURma3lpVkupN3+ZzNl/ToSfoESrm6rPDc4IsLK4p1AFuY7gjuMWxaloiKGA== X-Received: by 2002:a17:902:f30c:b0:16d:a79c:4aed with SMTP id c12-20020a170902f30c00b0016da79c4aedmr20935067ple.23.1659444089782; Tue, 02 Aug 2022 05:41:29 -0700 (PDT) Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id q14-20020a170902eb8e00b0016784c93f23sm5499727plg.197.2022.08.02.05.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 05:41:28 -0700 (PDT) From: Ihor Radchenko To: Joseph Turner Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/ob-plantuml.el: Insert results in buffer In-Reply-To: <875yjdkk25.fsf@breatheoutbreathe.in> References: <20220719231520.100206-1-joseph@breatheoutbreathe.in> <87bktduydf.fsf@localhost> <87o7xdot4d.fsf@breatheoutbreathe.in> <877d40ctho.fsf@localhost> <87h732w5og.fsf@breatheoutbreathe.in> <87a68t9uds.fsf@localhost> <875yjdkk25.fsf@breatheoutbreathe.in> Date: Tue, 02 Aug 2022 20:42:33 +0800 Message-ID: <874jyulsue.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1032.google.com 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, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Authentication-Results: aspmx1.migadu.com; none X-Migadu-Scanner: scn1.migadu.com X-TUID: CW7NcY7yCLWo Joseph Turner writes: > I've added a couple of (message ...) blocks to log the value of > do-export and params. It appears that this combination is producing a > params value which is equivalent to the value of params produced by the > current org-babel-execute:plantuml function. However, when the above > function is executed on a block like: > > #+begin_src plantuml :file "this.png" > Bob->Alice : Hello1! > #+end_src > > I get "Code block produced no output." > > I suspect that setting the scoped params variable has no effect on the > execution of the function, since I can set params to '((:results . > "none")), and I'll still get a printed result if > org-babel-default-header-args:plantuml is set to the above value. This is because you did not really modify the params value. Inserting results happens outside the org-babel-execute:plantuml. You can check out org-babel-execute-src-block function. (params (if do-export (map-merge 'list params '((:results . "file") (:result-params "replace" "file"))) params) This snippet only binds the value locally, restoring it after exiting the let-binding. You may need to modify the params destructively using setf and assq. > Is it safe to modify the value of org-babel-default-header-args:plantuml > from within the function? Would that even work? This is not only unsafe, but will also have no effect on the current execution. The passed params argument is a result of parsing global header args, default header args for specific language, file-local header args, subtree-local header args, and src block-specific header args combined. Strictly speaking, it is normal for org-babel to require the user to specify the output format explicitly via :results output or :results file or any other available setting. Having a :file argument must be accompanied by :results file. However, the ob-plantuml default value makes this generic org-babel requirement not necessary, which was a useful feature as long as only the :file output was supported. The most self-consistent way to introduce non-file output would be changing the default header args for plantuml to nil - it would make things consistent with all other generic backends. Unfortunately, such change is not an option because it will break the existing Org files for users accustomed to :file header arg implying :results file in their existing src blocks. Probably the most consistent way to approach the new output format would be throwing an error if :file is not provided, but :results is set to file. I'd say that it will be much more consistent with other babel backends, albeit less "smart". Best, Ihor