Matt <m...@excalamus.com> writes: > > The actual prompt is "org_babel_sh_prompt> ". > > Agreed. > > > And we want to skip leading spaces in addition. > > What do you mean by this?
I was following the pattern described in the docstring of `comint-prompt-regexp', where it is suggested that prompts should follow the pattern "^<regexp> *". In the case of ob-shell.el, `org-babel-sh-prompt' is a string to be used as a prompt and the corresponding regexp patter will be "^<prompt string> *". Hence (concat "^" (regexp-quote org-babel-sh-prompt) " *") > > 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. I hope the above clarified 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'. I am in favour of using `org-id-uuid'. It might also be a useful generic function for other purposes. A slight concern is that some third-party code might depend on the current pattern used for UUID string in ob-python. But we made no promises here. To be a bit safer, we can also refactor `org-uuidgen-p' exposing the regexp used to match UUID. Also, it will make sense to move `org-uuidgen-p' to org-macs.el. > > > > > (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'? Yes. -- 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>