From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qBKRLD12gWPL5gAAbAwnHQ (envelope-from ) for ; Sat, 26 Nov 2022 03:13:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id WKiWLD12gWP/JQAA9RJhRA (envelope-from ) for ; Sat, 26 Nov 2022 03:13:17 +0100 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 6A2C73996E for ; Sat, 26 Nov 2022 03:13:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oykg3-00051C-GA; Fri, 25 Nov 2022 21:12:23 -0500 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 1oykg2-00050z-Hq for emacs-orgmode@gnu.org; Fri, 25 Nov 2022 21:12:22 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oykfy-0001XM-SG for emacs-orgmode@gnu.org; Fri, 25 Nov 2022 21:12:21 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id D0E70240026 for ; Sat, 26 Nov 2022 03:12:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1669428736; bh=Ngw7TGZP/ISyDwZlJR+oXvL0YE66nanZBfJ5ZU8Qy/A=; h=From:To:Cc:Subject:Date:From; b=nI3SA7acv23bIYMA7UDFRFoKftL1YFY6KhCzSAAcEI5w+wEGNuT5Xt/zC+STVn0Xi q7JAU1E/nOHyOrqBn2nSBiwPM7jtZiXkuwvV/SCbhj8OpGRBhI8fT70qrLsMlOztoE 0uN/rwKgEg/3LDrAfGQwY1C1GozlFOI76ZrI4J2XnObyQ4Srwxua0eX8pFiSUPgROC WGY0khH9+gToNzcGvbr4BQr4oXQQ+gSiPY5d9U4g10tP3vGrto3gNfDBPWTpbI3omc hbgt7FoJGEMpDuSJ3Qv8pKgoAlw3uG79mUaAdqnkEN1XmykG94f75hwGigAeJMwKt3 aTWQZ03qZmREg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NJwGj0KVMz9rxK; Sat, 26 Nov 2022 03:12:12 +0100 (CET) From: Ihor Radchenko To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= Cc: Daniel Ortmann , emacs-orgmode@gnu.org Subject: Re: [PATCH] Add new :results ignore header argument (was: [External] : Re: [BUG] executing sh source block with ':results none' encounters error region is longer than org-table-convert-region-max-lines [9.6-pre (release_9.5.5-1118-g70cee1 @ /home/dortmann/src/git-org-mode/lisp/)]) In-Reply-To: References: <290ab489-4c2a-d9b9-fb95-e4e246f3a85d@oracle.com> <87mt8ok5vg.fsf@localhost> <87tu2tjary.fsf@localhost> <1e89cf84-e38c-382b-71cf-e4a8ce9b1bf9@oracle.com> <87cz9fd9ed.fsf@localhost> Date: Sat, 26 Nov 2022 02:12:51 +0000 Message-ID: <87zgcelazg.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de 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, 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.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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669428797; 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=xYFNspbut6kEfGkZUB70vlGOrxJxnlXOOnXBENpG3jU=; b=f/ZurOeUGvwjfUuxFb7LSjA+p0UhZl2FQbPvR9EtskLcnIygZ4RLfSZq+JIRrcxFCADCrs xgF4AQrZuZQIpSBr7vGzVAtSlPyKJ+6o6REU24rE5P0foaut7MP1fZhoJrNGdIEKwLMSkf /WAUE+q79cmx59nPNs/ANdtmwea6HolXWiAwrzUpTVCykXmomuSyRpnc2lQVzlGk+hfajg cnr2N9ySHP0N9yoJVNsF5WGjBoYqscTxwhk+jrQWcZHVw9izgKrv3mlqlg7vkytfhYJw8D lIIR6cucRd8nov458QTSidJUz6hjVS/5eV7i/RiDHMzPgm+zCeTI0Xe2dLMLGw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669428797; a=rsa-sha256; cv=none; b=jGGOsqNMVNVJX8+7st8yqrbkXsBJQLbQTOy9zVyQ8WbiDk8OD0CSURiYaCNndXGXsThvEl eDKpwCkAgZNqsPHO0aSC9YnML+RsEX1NiFiNjhVUnQbsygaY3CgFqrBc4+etrzDhZKR36G AUmWCjYK8tBZWJ5gg0Bfa5hwBfyEIoF7vOh4SSl9tlaFHfuByJT1agLdSNHvMadnyyGLe4 zM+grJnqsCE/ysw5WTjeJjWUu+E1NUu3P/fNo74UVjSmNqFAeMSjg2ZZlfKLom1jtkM0UL UMCvQcHzxvJU6WLXmHG8nEETFeDM3AgwIDiLPUYQn7ouKV4TO9M1rRsmT0WYhQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nI3SA7ac; 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" X-Migadu-Spam-Score: -5.69 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nI3SA7ac; 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" X-Migadu-Queue-Id: 6A2C73996E X-Spam-Score: -5.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: xmSTtlxkP4gg --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Rudolf Adamkovi=C4=8D writes: >> Any objections? > > With the existing imprecise names, "silent" (that talks) and "none" > (that exists), we should try for maximum precision to avoid further > confusion. Looking at your documentation, the word "discard" conveys > the meaning better than "ignore". It says that we actually "throw the > result away" for all intents and purposes, this time. Other than > discard, I found scrap, drop, ditch, swallow. Good idea. I also like "discard" better. See the updated patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-org-babel-Add-new-results-discard-header-argument.patch >From c262579e8f1ef9ffecfc8e051fd5ea2539b4525e Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Tue, 22 Nov 2022 10:06:24 +0800 Subject: [PATCH v2] org-babel: Add new :results discard header argument * lisp/ob-core.el (org-babel-result-cond): Unconditionally return nil and suppress all the processing for :results discard. (org-babel-common-header-args-w-values): (org-babel-sha1-hash): Add the new value to know :results value list. * doc/org-manual.org (Handling): * etc/ORG-NEWS (New =:results discard= header argument): Document the new value. Reported-by: Daniel Ortmann Link: https://orgmode.org/list/87tu2tjary.fsf@localhost --- doc/org-manual.org | 8 ++++++++ etc/ORG-NEWS | 8 ++++++++ lisp/ob-core.el | 43 ++++++++++++++++++++++--------------------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 760c1ee86..67b8b4dee 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -18487,6 +18487,14 @@ *** Handling can still be used when referenced from another code block. Usage example: =:results none=. +- =discard= :: + + Ignore the results completely. This option is similar to =none=, + but no processing is performed on the return value. Calling the + code block programatically (see [[*How to evaluate source code]]) or by + reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will + always yield nil. + - =append= :: Append results to the Org buffer. Latest results are at the bottom. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 63ff5d749..fd569106a 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -373,6 +373,14 @@ value of ~org-babel-clojure-backend~. For example: (range 2) #+end_src +*** New =:results discard= header argument + +Unlike =:results none=, the return value of code blocks called with +=:results discard= header argument is always ~nil~. Org does not +attempt to analyze the results and simply returns nil. This can be +useful when the code block is used for side effects only but generates +large outputs that may be slow to analyze for Org. + ** New options *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 3a07c10d5..5f679a5e9 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -425,7 +425,7 @@ (defconst org-babel-common-header-args-w-values (prologue . :any) (results . ((file list vector table scalar verbatim) (raw html latex org code pp drawer link graphics) - (replace silent none append prepend) + (replace silent none discard append prepend) (output value))) (rownames . ((no yes))) (sep . :any) @@ -1345,7 +1345,7 @@ (defun org-babel-sha1-hash (&optional info context) (lambda (a b) (string< (car a) (car b))))) (let* ((rm (lambda (lst) (dolist (p '("replace" "silent" "none" - "append" "prepend")) + "discard" "append" "prepend")) (setq lst (remove p lst))) lst)) (norm (lambda (arg) @@ -1353,8 +1353,8 @@ (defun org-babel-sha1-hash (&optional info context) (copy-sequence (cdr arg)) (cdr arg)))) (when (and v (not (and (sequencep v) - (not (consp v)) - (= (length v) 0)))) + (not (consp v)) + (= (length v) 0)))) (cond ((and (listp v) ; lists are sorted (member (car arg) '(:result-params))) @@ -1382,10 +1382,10 @@ (defun org-babel-sha1-hash (&optional info context) (mapconcat #'identity (delq nil (mapcar (lambda (arg) - (let ((normalized (funcall norm arg))) - (when normalized - (format "%S" normalized)))) - (nth 2 info))) ":") + (let ((normalized (funcall norm arg))) + (when normalized + (format "%S" normalized)))) + (nth 2 info))) ":") expanded)) (hash (sha1 it))) (when (called-interactively-p 'interactive) (message hash)) @@ -3289,19 +3289,20 @@ (defmacro org-babel-result-cond (result-params scalar-form &rest table-forms) (declare (indent 1) (debug t)) (org-with-gensyms (params) `(let ((,params ,result-params)) - (if (or (member "scalar" ,params) - (member "verbatim" ,params) - (member "html" ,params) - (member "code" ,params) - (member "pp" ,params) - (member "file" ,params) - (and (or (member "output" ,params) - (member "raw" ,params) - (member "org" ,params) - (member "drawer" ,params)) - (not (member "table" ,params)))) - ,scalar-form - ,@table-forms)))) + (unless (member "discard" ,params) + (if (or (member "scalar" ,params) + (member "verbatim" ,params) + (member "html" ,params) + (member "code" ,params) + (member "pp" ,params) + (member "file" ,params) + (and (or (member "output" ,params) + (member "raw" ,params) + (member "org" ,params) + (member "drawer" ,params)) + (not (member "table" ,params)))) + ,scalar-form + ,@table-forms))))) (defmacro org-babel-temp-directory () "Return temporary directory suitable for `default-directory'." -- 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--