From: "Felix Freeman" via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: <emacs-orgmode@gnu.org>
Cc: <kaushal.modi@gmail.com>, <nick@nicksavage.ca>, <yantar92@gmail.com>
Subject: Re: babel output seems to drop anything before % (in session)
Date: Tue, 07 Jun 2022 17:50:01 -0400 [thread overview]
Message-ID: <CKK8FJQTI95A.8G4DMH6FO2C@laptop> (raw)
In-Reply-To: <CKJGLRBMA8H4.X5ZB29JFNR56@laptop>
I've been able to bypass the error by adding the following to my .emacs
(require 'ob-shell)
(defun org-babel-sh-strip-weird-long-prompt (string)
"Remove prompt cruft from a string of shell output."
(while (string-match shell-prompt-pattern string)
(setq string (substring string (match-end 0))))
string)
(setq shell-prompt-pattern "^sh-[[:digit:]].[[:digit:]]\$ ")
Of course, this is is just a dirty hack not suitable for a release.
It seems logical that `org-babel-sh-strip-weird-long-prompt` on
`ob-shell.el` respects `shell-prompt-pattern` from `shell.el`. It's not
like this on the released source code.
But to be honest still the idea ripping a dynamic string from the shell
output seems pretty hackish to me. I'm not really aware of the internals
of `comint.el`, but I think that instead it should set the shell $PS1 to
an empty value and read the thing afterwards, or - if this changes
things too much - at least set $PS1 to a very unique and distinctive
value in order to avoid these kind of bugs.
Felix Freeman
next prev parent reply other threads:[~2022-06-07 23:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 15:15 babel output seems to drop anything before % (in session) Daniele Pizzolli
2021-05-06 2:35 ` John Corless
2021-05-06 11:39 ` Nicholas Savage
2021-05-06 12:24 ` Ihor Radchenko
2021-05-06 23:44 ` Nick Savage
2021-05-15 20:47 ` Bastien
2021-06-09 3:41 ` Kaushal Modi
2021-06-09 3:54 ` Kaushal Modi
2021-06-09 4:01 ` Kaushal Modi
2021-11-09 21:21 ` Kaushal Modi
2021-11-10 4:13 ` Ihor Radchenko
2022-06-07 0:01 ` Felix Freeman via General discussions about Org-mode.
2022-06-07 21:50 ` Felix Freeman via General discussions about Org-mode. [this message]
2022-06-07 22:55 ` Felix Freeman via General discussions about Org-mode.
2022-06-18 3:20 ` [PATCH] " Ihor Radchenko
2022-08-26 12:51 ` Ihor Radchenko
2022-09-25 1:44 ` Ihor Radchenko
2022-09-25 2:02 ` Bastien Guerry
2022-07-16 10:04 ` 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=CKK8FJQTI95A.8G4DMH6FO2C@laptop \
--to=emacs-orgmode@gnu.org \
--cc=kaushal.modi@gmail.com \
--cc=libsys@hacktivista.org \
--cc=nick@nicksavage.ca \
--cc=yantar92@gmail.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).