From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Bosch=C3=A9_Aur=C3=A9lien?= Subject: [PATCH] Make org-babel-result-end work with :wrap keyword Date: Thu, 28 Mar 2019 17:27:23 +0100 Message-ID: <874l7mp3fd.fsf@yahoo.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:57295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9lYo-0003VJ-Ma for emacs-orgmode@gnu.org; Fri, 29 Mar 2019 03:04:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9lYn-0001SH-BL for emacs-orgmode@gnu.org; Fri, 29 Mar 2019 03:04:18 -0400 Received: from sonic314-21.consmr.mail.ir2.yahoo.com ([77.238.177.147]:40589) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9lYm-0001Pf-LR for emacs-orgmode@gnu.org; Fri, 29 Mar 2019 03:04:17 -0400 Received: from 176-170-20-144.abo.bbox.fr (EHLO joebar) ([176.170.20.144]) by smtp426.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID b0ac73b94b2977712d48756a8bdea771 for ; Fri, 29 Mar 2019 07:04:12 +0000 (UTC) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; format=flowed It seems that the :wrap header argument and the append option to the :results header argument are incompatible in source blocks. The reason is that `org-babel-result-end` does not find the end of the results when :wrap is used and this is due to `org-babel-result-end` only looking for blocks of type among `(drawer example-block export-block fixed-width item plain-list src-block table)` while the :wrap header argument produces blocks of type `special-block`. Appending `special-block` to the previous list seems to work. It has already been discussed in this thread http://lists.gnu.org/archive/html/emacs-orgmode/2018-10/threads.html#00393 which ends in a patch request that AFAIK has never been sent. Below is a patch. I also added some precisions in the docs concerning the raw option to the :results header argument (I am not a native speaker so do not hesitate to change my wording). I tried those changes on the master branch (commit a9d3eaa9f) and no new errors showed up during the ERT tests (4 tests failed but already failed without this fix). I also tried exporting to html and latex and it seemed to work fine here. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Make-org-babel-result-end-work-with-wrap-keyword.patch >From 3a7beadcc2a1d9e8d7b7f520f4caa992b2b1e6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bosch=C3=A9?= Date: Thu, 28 Mar 2019 17:25:15 +0100 Subject: [PATCH 1/2] Make org-babel-result-end work with :wrap keyword --- lisp/ob-core.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 7591e99ca..6f99ca6f2 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2486,7 +2486,7 @@ in the buffer." (if (memq (org-element-type element) ;; Possible results types. '(drawer example-block export-block fixed-width item - plain-list src-block table)) + plain-list src-block table special-block)) (save-excursion (goto-char (min (point-max) ;for narrowed buffers (org-element-property :end element))) -- 2.21.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Docs-specify-that-raw-option-does-not-delimit-the-re.patch >From a424317301c738e5d9d0325b594ff31be664d41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bosch=C3=A9?= Date: Fri, 29 Mar 2019 07:46:42 +0100 Subject: [PATCH 2/2] Docs: specify that raw option does not delimit the results --- doc/org-manual.org | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index b818b4bae..d006c5b73 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17275,8 +17275,10 @@ follows from the type specified above. - =raw= :: - Interpreted as raw Org mode. Inserted directly into the buffer. - Aligned if it is a table. Usage example: =:results value raw=. + Interpreted as raw Org mode. Inserted directly into the buffer. + Aligned if it is a table. No delimiters are added to mark the end of + the raw output so options like =replace=, =append= and =prepend= + won't work as intended. Usage example: =:results value raw=. #+cindex: @samp{wrap}, header argument The =wrap= header argument unconditionnally marks the results block by @@ -17286,14 +17288,14 @@ specified, Org wraps the results in a =#+BEGIN_results= value listed above. E.g., #+begin_example -,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown -"Welcome back to the 90's" -,#+END_SRC + ,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown + "Welcome back to the 90's" + ,#+END_SRC -,#+RESULTS: -,#+BEGIN_EXPORT markdown -Welcome back to the 90's -,#+END_EXPORT + ,#+RESULTS: + ,#+BEGIN_EXPORT markdown + Welcome back to the 90's + ,#+END_EXPORT #+end_example *** Handling @@ -17325,6 +17327,13 @@ Handling options after collecting the results. Does not remove previous results. Usage example: =:results output prepend=. +Options =replace=, =append= and =prepend= need to find the end of the +previously inserted results and so won't work as intended if the =raw= +option to the =results= header argument was in force. In this case +consider using the =:wrap= header argument. + +Handling options after collecting the results. + *** Post-processing :PROPERTIES: :UNNUMBERED: notoc -- 2.21.0 --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable <#secure method=3Dpgpmime mode=3Dsign> -- Bosch=C3=A9 Aur=C3=A9lien --=-=-=--