emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Matt <matt@excalamus.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: bug? org-babel-comint-with-output return value type
Date: Tue, 19 Mar 2024 14:20:49 +0000	[thread overview]
Message-ID: <87v85iwbem.fsf@localhost> (raw)
In-Reply-To: <18e4e01717d.b1bd307a696132.1612686871442583784@excalamus.com>

Matt <matt@excalamus.com> writes:

> Why =org-babel-comint-with-output= returns a list is unclear to me.
> The docstring for =org-babel-comint-with-output= says it should
> "return all process output". AFAIK, process output is a string, always
> has been, always will be, and Babel has always gotten a substring of
> the process buffer (for that code path). Yet for some reason, it was
> decided to have =org-babel-comint-with-output= return a list. This
> goes back to the beginning, in 2009, when the final expression used
> =split-string= instead of =delete=:
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/lisp/org-babel-comint.el?id=dd0392a4f23b40fae7491c55aa44a2324248c103
>
> ...
> It seems like the return type of =org-babel-comint-with-output= is not what it should be.  It looks like it should be a string.
>
> Am I missing something?

Inside `org-babel-comint-with-output', BODY may send multiple commands
to the shell; one by one. Their output will also arrive one by one,
separated by PROMPT. The return value is a list of these outputs.

If we were to concatenate this list, the information about which part of
the output belongs to which submitted command would be lost.

The docstring may indeed be improved.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2024-03-19 14:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 17:48 [BUG] Prompt appears in async shell results Matt
2024-02-05 14:02 ` Ihor Radchenko
2024-02-18 12:09   ` Matt
2024-02-19 11:10     ` Ihor Radchenko
2024-03-17 19:36       ` Matt
2024-03-17 20:01         ` bug? org-babel-comint-with-output return value type Matt
2024-03-19 14:20           ` Ihor Radchenko [this message]
2024-03-27 10:59         ` [BUG] Prompt appears in async shell results Ihor Radchenko
2024-03-29 11:15           ` Matt
2024-03-29 11:23             ` 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=87v85iwbem.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=matt@excalamus.com \
    /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).