---- On Sun, 05 Mar 2023 07:14:21 -0500 Ihor Radchenko wrote --- > > Matt m...@excalamus.com> writes: > > > > Sorry for missing that. The issue is that when I replaced > > `org-babel-sh-prompt' with `comint-prompt-regexp', the regexp no > > longer matches the output and grabs the next prompt. It looks like > > the reason is `comint-prompt-regexp' is set to "^org_babel_sh_prompt> > > *" (with two spaces between the '>' and '*'). Attached is a revised > > patch which removes one of the spaces by changing how > > `org-babel-sh-initiate-session' sets the `comint-prompt-regexp'. > > Another place this could be done is in the defvar for > > `org-babel-sh-prompt' itself (which ends with a space). However, I > > think it's customary to leave a trailing space for prompts? > > The actual prompt is "org_babel_sh_prompt> ".
Agreed. > And we want to skip leading spaces in addition. What do you mean by this? > Adding " *" does not make the prompt match 2 spaces, but 1+. Agreed. It's not clear to me what pattern you're looking to match. > > > > + (let ((uuid (org-id-uuid))) > > > > > > Do you need to use `org-id-uuid' here? ob-python directly uses `md5'. > > > If you still prefer org-id-uuid, we probably need to move it to > > > org-macs.el > > > > I just need a random string. `md5' would work for that. However, > > might it be better to update ob-R and ob-python to use `org-id-uuid'? > > Both of those manually declare the randomness. It's conceivable that > > someone may delete or mistype the number (100000000), resulting in a > > lower entropy. An md5 is also not a uuid, strictly speaking. Of > > course, the chance of collision is still basically zero and the cost > > of collision about the same. Using `org-id-uuid' would only provide a > > consistent way to do things. > > `md5' will be slightly faster compared to `org-id-uuid'. But it should > not matter. > > If we want use `org-id-uuid', lets move it to org-macs.el. Requiring the > whole org-id.el must not be done. It has side effects of defining id: > links. In the next revision (once we figure out the regex), I can create a separate commit moving `org-id-uuid' to org-macs.el and updating ob-R and ob-python from `md5' to `org-id-uuid' (assuming that's not an issue for the maintainers of those). If you think speed is a concern, however, I can switch ob-shell.el to use plain `md5'. > > > (concat "^" (regexp-quote org-babel-sh-prompt) > > - " *")) > > + "*")) > > This is wrong. It unconditionally makes the last char in > `org-babel-sh-prompt' 0+. (Imagine it is changed to non-space in > future). When you say "imagine it is changed to non-space...", do you refer to `org-babel-sh-prompt'? Honestly, it's not clear to me what pattern(s) we need to match.