Function: org-babel-comint--prompt-filter

org-babel-comint--prompt-filter is a byte-compiled function defined in ob-comint.el.gz.

Signature

(org-babel-comint--prompt-filter STRING &optional PROMPT-REGEXP)

Documentation

Remove PROMPT-REGEXP from STRING.

PROMPT-REGEXP defaults to comint-prompt-regexp.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-comint.el.gz
(defun org-babel-comint--prompt-filter (string &optional prompt-regexp)
  "Remove PROMPT-REGEXP from STRING.

PROMPT-REGEXP defaults to `comint-prompt-regexp'."
  (let* ((prompt-regexp (or prompt-regexp comint-prompt-regexp))
         ;; We need newline in case if we do progressive replacement
         ;; of agglomerated comint prompts with `comint-prompt-regexp'
         ;; containing ^.
         (separator "org-babel-comint--prompt-filter-separator\n"))
    (while (string-match-p prompt-regexp string)
      (setq string
            (replace-regexp-in-string
             (format "\\(?:%s\\)?\\(?:%s\\)[ \t]*" separator prompt-regexp)
             separator string)))
    (delete "" (split-string string separator))))