From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id SLgwOC43rmRb6QAASxT56A (envelope-from ) for ; Wed, 12 Jul 2023 07:16:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WBTANy43rmQJtgAAauVa8A (envelope-from ) for ; Wed, 12 Jul 2023 07:16:30 +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 7013E4CE9C for ; Wed, 12 Jul 2023 07:16:30 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bv4lfpwQ; dmarc=pass (policy=none) header.from=gmail.com; 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=1689138990; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=UtEqXJBmvQ4O4As6LMxoeono0w3Euq4YvOz1SHnvSLM=; b=OGnaAOaOOR2eLDBfdQK7QwPWQik5vLk692HHU/CtAxnZ+/9bG6TGm43/5qkV9uOd/IuHeB y2EvIUD69uczcgJg2rf9eaiy0i5LFjLKLPtXgYrFcDR3H4LvkKy9L95xo8jA6ZI3IhY4z+ a55BXy2+5c30+zIoq6HKlqv8XjtuofVAdr6Yk/xebtU3xXtTzEs311+9OgXSqVTHj/DJ+U P5NCr/uDodLyJx3F9PUc//uySX5xRzTOmVrF3vsX1GuW5aFc+wx2xqYxWdzLpahbCReRIV TT4cayLJpGfi7ZbrBkobKAfs0WmIINbAwevZPdaiYckdkvuXVB4Ss0bZSDaBvw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bv4lfpwQ; dmarc=pass (policy=none) header.from=gmail.com; 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=1689138990; a=rsa-sha256; cv=none; b=ZvKEzOGr/m6mcrTx8AoQbRO5JbginXCY1tjuCbI+Kj4CAWeCAsC9DRWegWLdyq+UgfVb4g C+FKjbgHotsuuTFWQkceDQK+uZ1DQH44ZxJMX8uvm286axmKATCEzC1QPT1103p+d9QKGi kQ1PLX5PqdIu9Pm8ThRGE3742rGPp96NnnCjzZbSwptk8rKE48GlmCJeKLjhof1zw6QONZ /i6/vx+IpgUH40tK+t6D71ftJca+skx4Ey+53BgyiKkrZV0/+E2V6qDV+HnbWOqFBfLVia yMGMk8jgbgGUHML3VDg6cDxjEXulb0/8ZlIG2EyIhF3yAJoJFiFZNcgag2PNnA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJS7h-0001ZN-Gi; Wed, 12 Jul 2023 01:10:45 -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 1qJS7g-0001Yr-Lj for emacs-orgmode@gnu.org; Wed, 12 Jul 2023 01:10:44 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qJS7e-0003xV-Vz for emacs-orgmode@gnu.org; Wed, 12 Jul 2023 01:10:44 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-67ef5af0ce8so5762540b3a.2 for ; Tue, 11 Jul 2023 22:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689138641; x=1691730641; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UtEqXJBmvQ4O4As6LMxoeono0w3Euq4YvOz1SHnvSLM=; b=bv4lfpwQyJoaEaOkn2vFEKJaHIsBiuOvTtnrT9uowsIrd6lilhp0HM5jJoA/cK0UAg HmOhleGpOo/RTouu9wyo0IbY7I7c9KhXnm+V9KQ5SOj5X9PHkAui4xtvkTK8DXrTXCxe nr59Nl1Z4oPSCgVxAWX01tyApFqcxvTsjzsElryiEo0Z/xcG0uder+X0bboIX6DPFVCs /xxG9Yi6fOjYq1JwktkbBrMpN3dMkYo3XyrGatSl4MGnhupsg8+duvcPKljN3qnPaOjU z7T+8wGKrsRyZ4r57IYjJXC34Oxer2wjkQ3WzhJ+F6j08G4fPjKcrokEIDabOIQ/pbT/ QVsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689138641; x=1691730641; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UtEqXJBmvQ4O4As6LMxoeono0w3Euq4YvOz1SHnvSLM=; b=B5Fy5yHFT/oE3i+MmY5qn8LDKzuTlxIrG8vTxrtxTPIAh356caRq0fh21gb/rRk8N6 eqN6XaWQC3c2UfiVky5HVB17Po8Pak3cS85Hi1VjDfz8NeFEjHgEXRNUDS66AHJ89u0G 36VUk1j0T2k+FOuKI+nJ7lzLNfClbh/IsCQHI29AKStKuuQniurvCAMlwHB+rfZSrOLG 3DYsk51gxkQ3RrW82g0OlbL5maMKIYbTlRKi+sx6+Au5sUplv8zAjry3OoBJnCGJSkW2 rjVzn3pZJD2pz4NqST4A6fzm0WaOZEmwBhNpfEj1cdZCSbaXevEgEHhTthTW7SZ5+W3m bK4A== X-Gm-Message-State: ABy/qLbyubWys7+g4ttuQV5n/tEVPFpagjRby9VtvGdqCT3JqM+xG/TC 4JgOv39Na7PuXTbiYZix6mk= X-Google-Smtp-Source: APBJJlHKZy2X4O2TNOnhCCWrphMTlg7kJyxaSrDQq3iW7ewtFDMwa6dbStjG/MpgSmxLNUA8dIMsGg== X-Received: by 2002:aa7:88c8:0:b0:681:50fd:2b98 with SMTP id k8-20020aa788c8000000b0068150fd2b98mr23426882pff.31.1689138641534; Tue, 11 Jul 2023 22:10:41 -0700 (PDT) Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id ey24-20020a056a0038d800b00666add7f047sm2559955pfb.207.2023.07.11.22.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 22:10:40 -0700 (PDT) From: Jack Kamm To: Ihor Radchenko Cc: Liu Hui , emacs-orgmode@gnu.org Subject: Re: [PATCH] ob-python: support header argument `:results file graphics' In-Reply-To: <87sf9x8n38.fsf@localhost> References: <877crh8htb.fsf@localhost> <875y71fcic.fsf@localhost> <877crfvrsf.fsf@localhost> <87v8ez0w41.fsf@gmail.com> <87y1ju8vpp.fsf@localhost> <87sfa121q1.fsf@gmail.com> <871qhkxaay.fsf@localhost> <87h6qe1pa2.fsf@gmail.com> <87sf9x8n38.fsf@localhost> Date: Tue, 11 Jul 2023 22:10:45 -0700 Message-ID: <87fs5tk94a.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=jackkamm@gmail.com; helo=mail-pf1-x434.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, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.99 X-Spam-Score: -7.99 X-Migadu-Queue-Id: 7013E4CE9C X-Migadu-Scanner: mx2.migadu.com X-TUID: gdyf1fTjCvbX Ihor Radchenko writes: > ":results file" imply that results of the code block are written to a file > (the file is specified using header args). > > ":results file link" imply that results of the code block are interpreted > as file link. The fact that presence of :file header arg overrides this > behaviour is something we may want to reconsider - it is confusing. I think this is a lot clearer and more intuitive than the current behavior, and worth doing. But it is a breaking change, so it would be good to provide a variable to re-enable the previous behavior, for back-compatibility of older Org documents. In particular, the Worg matplotlib example of ":results file" without ":file" header arg is fairly old, and I have a few Org docs using ":results file" this way as well. So I would appreciate a backwards-compatibility variable if we change this. > ":results graphics file" imply that graphics generated during code > block execution is saved to file specified in the :file header args. > This feature is only available for some backends that can derive > graphics data from the source block. When :file is not specified, > using the actual code block output is confusing, and we may want to > reconsider this behaviour. I agree. On a related note, I think we should revert most of b088389c6 on bugfix branch. That documentation causes more harm than good, and is based on some confusion in [1] ("graphics" and "link" are _not_ equivalent in general). > Sorry, but I do not fully understand. > Generated graphics is not what Org sees as "results of evaluation". > I think it is well illustrated by > > #+begin_src R :file img.png > hist(rnorm(100)) > "img.png is going to contain this string." > #+end_src > > #+begin_src R :file img.png :results graphics > hist(rnorm(100)) > "But now img.png is going to contain graphics." > #+end_src > > The latter has nothing to do with block output, which is a string. IMO block _value_ is string, while block _output_ is string AND graphics. So by my interpretation, ob-R is slightly incorrect in how it handles ":results output graphics" vs ":results value graphics". IMO the more technically correct approach is in the ob-python patch that I proposed a couple years ago [2], and plan to revisit soon. In that patch, ob-python ":results graphics output" will plot from pyplot.gcf(), while ":results graphics value" will expect a matplotlib.Figure object to be returned for plotting. (Note I do _not_ suggest changing ob-R -- even if my interpretation is correct, I think that common usage and backwards-compatibility outweighs strict technical correctness in this case). [1] https://list.orgmode.org/87fu41zcn2.fsf@nicolasgoaziou.fr/ [2] https://list.orgmode.org/87eenpfe77.fsf@gmail.com/