From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EBHqJtpmrmTsjgAASxT56A (envelope-from ) for ; Wed, 12 Jul 2023 10:39:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id aEIWJtpmrmTBcQEAG6o9tA (envelope-from ) for ; Wed, 12 Jul 2023 10:39:54 +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 4E8055C26E for ; Wed, 12 Jul 2023 10:39:54 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=HrmrUNAC; dmarc=pass (policy=none) header.from=posteo.net; 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=1689151194; 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=KVVaKXU+axCczp4wLkRSGbzGYriloPyqM7JY0gYfF7Q=; b=jQ72QrpsF2+4BJGOU2WXBMfmP2f6n/5i2LaFYTw4tsvAgEd6+AjsOxRcVSZlXLjEgHo0Q2 gzOonif0m85AFajDdEBkkbOYZ6bW3Rr6pNMkO5ILTi3asg0yucBOeRJc/VmwFha77a8Vbk ucP6vu/gxqQUk/Weo8yDZRXcO9f8XmJfOo+Z4LU0EwfAGtzF3MuqkFDwz5camsQVRmLmO1 NcemWGlnbwe1I6O3w8bR5zm5LKRxc7q6lr7cCDk4tx9IjS+GV6KvTN6vjsIIP965DrUYjc hbd1Uz7BmPIdarZOo93GnjWC+ZZ1ofNiRAwH/Xqbt1NFEuKtps7zlxXpu9YHDQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=HrmrUNAC; dmarc=pass (policy=none) header.from=posteo.net; 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=1689151194; a=rsa-sha256; cv=none; b=O4i+j1ciqyrgj86gPAUPuCG3WVPsLzL7j8qLO/CQJ7Uu9WEUUETzXy0glTwUo6R4/zYPz/ Fk+7NwB0S9ROTMkYA7gFGe5lz1x8U/lcdVu15JlW/6xouVSIlnKXlSIY7tjURD76trPB/V xeOCufhj8bQcgdUs5sa5/9+fjPjFdzQq4IOftLDObW2hlJ322NlVyGS2C36a+ANH9/oM2f 2LzN27twqS0JK/R1AenBauWk2OK91Md4125Ah5oJohl44UHgetSOEw0DnguWQMM2GiQHkR dxneRdgev0TpqBtUryjelCl772ILHrKFQ7O36mZF/8KAr59qKWG8wFSebnjtYg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJVNC-0000op-Ef; Wed, 12 Jul 2023 04:38:58 -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 1qJVN9-0000oN-Bc for emacs-orgmode@gnu.org; Wed, 12 Jul 2023 04:38:57 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJVN6-0008PJ-M2 for emacs-orgmode@gnu.org; Wed, 12 Jul 2023 04:38:55 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 6D57E240104 for ; Wed, 12 Jul 2023 10:38:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1689151130; bh=lmViTD5I1/U8FOXIMYlKDaOG1TTq7AZ+pDS/aYDXhBc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=HrmrUNACKFh8elhEf8EhlY8p866LAo3uJateEbP/HMQSsqluWaNCeNOWyfbLsBEb0 xBdSWIYyPKdlZrS6N25/4kezeQ8kX0+szXuqLhBGjoB7PQJ4h7oE+TuTGbiIb4sbrc KA0zftnnSR53pwPkKiPWcw6Ofaqq5mJkA8C6NLDvYov5pbojshhvFAyK+6nUyEtLc7 1x1KiCEp64TPktNMv+TJAppa4JmYWJkBm3sI8u2RysPIVj6cGh0kxxDh1DkeE1rBhN 0RHS6UJClmfbJhvt+Byl9tj68hxqKk65Eqpkf7d0fyGU3kpu0/C3JBdU7L2gFZ3nDx JU2pVOZrBnisQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R1B3Y4KHkz6tvc; Wed, 12 Jul 2023 10:38:49 +0200 (CEST) From: Ihor Radchenko To: Jack Kamm Cc: Liu Hui , emacs-orgmode@gnu.org Subject: Re: [PATCH] ob-python: support header argument `:results file graphics' In-Reply-To: <87fs5tk94a.fsf@gmail.com> 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> <87fs5tk94a.fsf@gmail.com> Date: Wed, 12 Jul 2023 08:38:58 +0000 Message-ID: <87ttu95xst.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 4E8055C26E X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -7.79 X-Spam-Score: -7.79 X-TUID: OI7AoCI/vy6i Jack Kamm writes: > 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. Not necessarily. We may instead arrange org-lint and possibly ob-core to throw a warning when an src block uses confusing setting combinations. Without changing the underlying behaviour. Basically, discourage using confusing staff. > 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. We should update the docs to avoid such examples. > 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). We should generally rewrite that part of the manual, I think. My previous message was a tentative outline on how the things should be presented in the manual. And I do not think that we should do it on bugfix. It is a non-trivial change, so it should go on main. >> 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. >From the point of view of ob-core.el, the output is stdout. We even display stderr separately (except sessions, where they are indistinguishable). But I can see where the confusion is coming from. "Output" can mean many things, including stdout, stderr, graphical display (plot window), a file, a sound, or maybe even interactive terminal ncurses interface. I do not have a solid idea how to deal with such confusion on design level. > 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. Sounds reasonable. Let me know if you need any help along the way. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at