Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-09 Thread Phil
* [2024-07-06 13:36] Max Nikulin: On 18/06/2024 00:57, Ihor Radchenko wrote: Max Nikulin writes: Some shells support "semantic shell" that allows terminal applications e.g. to copy whole command output. It is based on escape sequences.

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-06 Thread Ihor Radchenko
Max Nikulin writes: >>> Some shells support "semantic shell" that allows terminal applications >>> e.g. to copy whole command output. It is based on escape sequences. >>> https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md >> >> I am looking at

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-06 Thread Ihor Radchenko
Max Nikulin writes: >> +(defvar org-babel-sh-prompt "↸ " >>"String to set prompt in session shell.") > > I would use a longer prompt to reduce a chance that these pair of > characters appear in output of some program. I'd say that the odds that an output contains cuneiform are quite slim.

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-06 Thread Max Nikulin
On 01/07/2024 02:08, Ihor Radchenko wrote: +++ b/lisp/ob-shell.el @@ -273,7 +273,7 @@ (defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'" "String to indicate that evaluation has completed.") (defvar org-babel-sh-eoe-output "org_babel_sh_eoe" "String to indicate that evaluation

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-06 Thread Max Nikulin
On 18/06/2024 00:57, Ihor Radchenko wrote: Max Nikulin writes: Some shells support "semantic shell" that allows terminal applications e.g. to copy whole command output. It is based on escape sequences.

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-04 Thread Ihor Radchenko
Phil writes: > The error management channel is important. Only a very > small fraction of errors should be silenced, and we > must not have feedback displaying that a function ran > correctly when it did not. Sure. I completely agree. > Let's decouple an interactive shell from its >

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-03 Thread Phil
* [2024-07-02 22:05] Ihor Radchenko: Phil Estival writes: I'd like to add a few general remarks about *error status*. I'm starting to notice there are not much subprocesses that to do get called through =call-process= with ‘(REAL-DESTINATION ERROR-DESTINATION)’ kept as separate. You all

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-02 Thread Ihor Radchenko
Phil writes: > I'd like to add a few general remarks about *error status*. > I'm starting to notice there are not much subprocesses > that to do get called through =call-process= with > ‘(REAL-DESTINATION ERROR-DESTINATION)’ kept as > separate. You all know how useful stdin/out/err and > the

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-07-02 Thread Phil
* [2024-06-16 14:47] Max Nikulin: On 15/06/2024 20:19, Ihor Radchenko wrote: The underlying cause is a limitation of Emacs API for interactive shells - we cannot easily distinguish command output from prompt and other extra stuff your shell/other interactive command spits into the buffer. Some

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-30 Thread Ihor Radchenko
Ihor Radchenko writes: > Again, we know this problem, and we normally force the prompt to be > something more unique when creating sessions. But we do not touch the > prompt when you point Org to an existing interactive shell buffer - that > could be a surprise if Org mode changes the prompts by

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-30 Thread Ihor Radchenko
Ihor Radchenko writes: >> https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md > > I am looking at this gitlab link, and they way it is implemented is > simply setting PROMPT in a way that adds these escape sequences to the > original PROMPT value.

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-19 Thread Ihor Radchenko
"Cook, Malcolm" writes: > Since my (bash) shell prompt is a (more or less) constant string (e.g. > "myname@myhost> "). > > So, my workaround is to: > > (setq comint-prompt-regexp "myname@myhost> ") > > Then the filtering works perfectly. > > Of course if I change my name, this will fail.

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Cook, Malcolm
> So, my workaround is to: > > (setq comint-prompt-regexp "myname@myhost> ") > > Then the filtering works perfectly. > > Of course if I change my name, this will fail. Or, more likely, connect to a > different host within the shell. > > Or if I change PS1  > > It would be useful to

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Cook, Malcolm
>>>TL;DR: It is complicated. When we pull one string out, several more >>>get entangled. >> >> Might there be a solution wherein both the interactive shell buffer and Org >> are talking to a common underlying process? I would expect such to be >> significantly more complicated, but perhaps

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Ihor Radchenko
"Cook, Malcolm" writes: >>TL;DR: It is complicated. When we pull one string out, several more >>get entangled. > > Might there be a solution wherein both the interactive shell buffer and Org > are talking to a common underlying process? I would expect such to be > significantly more

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Ihor Radchenko
Max Nikulin writes: > Some shells support "semantic shell" that allows terminal applications > e.g. to copy whole command output. It is based on escape sequences. > > - > https://docs.kde.org/stable5/en/konsole/konsole/semantic-shell-integration.html > - >

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Cook, Malcolm
#+begin_src sh printf 'a\nb\nc\n>d\n>>> #+end_src #+RESULTS: : a : b : c : d : >>> Huh? what happened to the ">" before the "d"? >>> >>>I cannot reproduce. >>>May it be that you are setting global :session header argument? >> >> Yes, of course, so

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-16 Thread Max Nikulin
On 15/06/2024 20:19, Ihor Radchenko wrote: The underlying cause is limitation of Emacs API for interactive shells - we cannot easily distinguish command output from prompt and other extra staff your shell/other interactive command spits into the buffer. So, we have to either filter output the

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-15 Thread Ihor Radchenko
"Cook, Malcolm" writes: >>> #+begin_src sh >>> printf 'a\nb\nc\n>d\n>> #+end_src >>> >>> #+RESULTS: >>> : a >>> : b >>> : c >>> : d >>> : >> >>> Huh? what happened to the ">" before the "d"? >> >>I cannot reproduce. >>May it be that you are setting global :session header argument? > > Yes, of

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-14 Thread Cook, Malcolm
>"Cook, Malcolm" writes: > >> Let me walk you through the issue: >> >> #+begin_src sh >> printf 'a\nb\nc\n>d\n> #+end_src >> >> #+RESULTS: >> : a >> : b >> : c >> : >d >> : > >> Results look as expected. So far so good. >> >> Now create a shell buffer (which will be

Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-14 Thread Ihor Radchenko
"Cook, Malcolm" writes: > Let me walk you through the issue: > > #+begin_src sh > printf 'a\nb\nc\n>d\n #+end_src > > #+RESULTS: > : a > : b > : c > : >d > : > Results look as expected. So far so good. > > Now create a shell buffer (which will be named "*shell*") > > #+begin_src elisp > (shell)