emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vikas Kumar <kr.vikas@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Incorrect indentation in Org Babel list output with multiline text [9.4.4 (release_9.4.4 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
Date: Sun, 9 Jan 2022 00:42:58 -0800	[thread overview]
Message-ID: <CAPffxfdXTn+UEkSa4oUhxzTmbAQ28pRUdbxLNdEBQF7rz_oJxg@mail.gmail.com> (raw)
In-Reply-To: <CAPffxfeSOZVKUv6Yn94h+4FF0Na0v-zxp5NT5r3i114Fn9msMA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1122 bytes --]

Here is a patch with the fix.

-- 
Thanks,
Vikas

On Sat, Jan 8, 2022 at 9:22 PM Vikas Kumar <kr.vikas@gmail.com> wrote:

> Hello,
>
> When I use ':results value list' in an emacs-lisp source block it looks
> like Babel does
> not indent list items correctly when one of the items is a multi-line text.
>
> To reproduce evaluate the following code block:
>
> #+begin_src emacs-lisp :results value list
>   '("Foo1\nBar1" "Foo2\n\nBar2")
> #+end_src
>
>
> It outputs:
>
> #+RESULTS:
> - Foo1
> Bar1
> - Foo2
>
>
> Bar2
>
>
> Expected output:
>
> #+RESULTS:
> - Foo1
>   Bar1
> - Foo2
>
>
>   Bar2
>
>
> Since the second line of the first item is out of indentation, this makes
> the output list actually
> finish after the first line of the first item. Re-evaluating the block
> then only removes the first line
> of the previous output.
>
> My Emacs and Org mode version:
> Emacs  : GNU Emacs 27.2 (build 1, x86_64-apple-darwin20.6.0, Carbon
> Version 164 AppKit 2022.6)
>  of 2021-11-16
> Package: Org mode version 9.4.4 (release_9.4.4 @
> /Applications/Emacs.app/Contents/Resources/lisp/org/)
>
> --
> Thanks,
> VIkas
>

[-- Attachment #1.2: Type: text/html, Size: 2843 bytes --]

[-- Attachment #2: 0001-ob-core.el-Fix-indentation-of-multiline-text-in-list.patch --]
[-- Type: application/octet-stream, Size: 1195 bytes --]

From cb35cebb4164f85f7c3c1edd313c3555708b3388 Mon Sep 17 00:00:00 2001
From: Vikas Kumar <kr.vikas@gmail.com>
Date: Sun, 9 Jan 2022 00:12:48 -0800
Subject: [PATCH] ob-core.el: Fix indentation of multiline text in list output

* lisp/ob-core.el (org-babel-format-result): Use `org-list-to-org'
instead of `org-list-to-generic' to format result in Org list.

The problem was in formatting a multiline text result into an Org
list.  Additional lines of a list item should be indented with the
first line of the item.  The method used for this
formatting (`org-list-to-generic') does not add the extra indentation
to additional lines of an item.  Using `org-list-to-org' instead fixes
the problem.

TINYCHANGE
---
 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 239a57f96..7d17762bd 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2393,7 +2393,7 @@ INFO may provide the values of these header arguments (in the
 		   ((member "list" result-params)
 		    (insert
 		     (org-trim
-		      (org-list-to-generic
+		      (org-list-to-org
 		       (cons 'unordered
 			     (mapcar
 			      (lambda (e)
-- 
2.34.1


  reply	other threads:[~2022-01-09  8:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09  5:22 Bug: Incorrect indentation in Org Babel list output with multiline text [9.4.4 (release_9.4.4 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)] Vikas Kumar
2022-01-09  8:42 ` Vikas Kumar [this message]
2022-01-11 18:55   ` Vikas Kumar
2022-01-11 20:05   ` [PATCH] " Sébastien Miquel
2022-01-11 20:40     ` Vikas Kumar
2022-10-21  6:37   ` Ihor Radchenko
2022-10-21 14:42     ` [PATCH] " Rudolf Adamkovič
2022-10-22  4:33       ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPffxfdXTn+UEkSa4oUhxzTmbAQ28pRUdbxLNdEBQF7rz_oJxg@mail.gmail.com \
    --to=kr.vikas@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).