emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Prompt appears in async shell results


From: Matt
Subject: Re: [BUG] Prompt appears in async shell results
Date: Sun, 17 Mar 2024 20:36:46 +0100
User-agent: Zoho Mail

 ---- On Mon, 19 Feb 2024 12:07:55 +0100  Ihor Radchenko  wrote ---
 > Matt matt@excalamus.com> writes:
 >
 > > - Split prompt filtering and input echoing into two filters
 > >   + this seems to imply a =-hook= or =-functions= type implementation
 >
 > Not necessarily. You may just split the filter into (1) prompt
 > remover; (2) body remover. The filter does not need to interact with
 > comint buffer and may simply be provided a regexp/string to be removed.
 > Then, the caller will be responsible to supply prompt regexp/body.

Attached are patches which split the prompt and echo filtering into separate 
functions.  These are then used to refactor =org-babel-comint-with-output= and 
to remove the prompt from async results.  I also wrote tests, one for the 
reported bug and two for the filter functions.  Tests for the filter functions 
are in a new file, 'test-ob-comint.el'.

Two thoughts:

1. Can people please test that the changes to =org-babel-comint-with-output= 
haven't broken other languages?

The filter, which I extracted from =org-babel-comint-with-output=, works 
according to the test I wrote.  The test is based on ob-shell output.  However, 
=org-babel-comint-with-output= is used by other languages.  I wasn't sure if 
echoes showed up for other languages and I had no examples from other languages 
to work from.  The filter is untested for anything but shell, aside from 
running 'make test' (which returns no unexpected errors).  If no echo argument 
is given, the filter simply returns the string it would otherwise try to remove 
the echo from.  So, I suspect the worst outcome would be that echoes might 
start showing up in output.  But when have my predictions ever been right? :)

2. Legacy code woes

I'll start another thread to rant, er, discuss.

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode

Attachment: 0001-testing-lisp-test-ob-comint.el-Make-test-for-prompt-.patch
Description: Binary data

Attachment: 0002-lisp-ob-comint.el-Create-comint-prompt-filter.patch
Description: Binary data

Attachment: 0003-testing-lisp-test-ob-comint.el-Make-test-for-echo-fi.patch
Description: Binary data

Attachment: 0004-lisp-ob-comint.el-Create-comint-echo-filter.patch
Description: Binary data

Attachment: 0005-lisp-ob-comint.el-Refactor-org-babel-comint-with-out.patch
Description: Binary data

Attachment: 0006-testing-lisp-test-ob-shell.el-Test-async-prompt-remo.patch
Description: Binary data

Attachment: 0007-lisp-ob-comint.el-Fix-prompt-appearing-in-async-shel.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]