Function: tuareg-interactive--send-region
tuareg-interactive--send-region is a natively compiled function
defined in tuareg.el.
Signature
(tuareg-interactive--send-region START END)
Documentation
Send the region between START and END to the OCaml REPL.
It is assumed that the range START-END delimit valid OCaml phrases.
Source Code
;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg.el
(defun tuareg-interactive--send-region (start end)
"Send the region between START and END to the OCaml REPL.
It is assumed that the range START-END delimit valid OCaml phrases."
(save-excursion (tuareg-run-process-if-needed))
(comint-preinput-scroll-to-bottom)
(setq tuareg-interactive-last-phrase-pos-in-source start)
(let* ((phrases (buffer-substring-no-properties start end))
(phrases (replace-regexp-in-string "[ \t\n]*\\(;;[ \t\n]*\\)?\\'" ""
phrases))
(phrases-semicolon (concat phrases ";;")))
(if (string= phrases "")
(message "Cannot send empty commands to OCaml REPL!")
(with-current-buffer tuareg-interactive-buffer-name
(goto-char (point-max))
(setq tuareg-interactive-last-phrase-pos-in-repl (point))
(comint-send-string tuareg-interactive-buffer-name phrases-semicolon)
(let ((pos (point)))
(comint-send-input)
(when tuareg-interactive-echo-phrase
(save-excursion
(goto-char pos)
(insert phrases-semicolon)))))))
(when tuareg-display-buffer-on-eval
(display-buffer tuareg-interactive-buffer-name)))