Function: verb--maybe-extract-babel-src-block

verb--maybe-extract-babel-src-block is a natively compiled function defined in verb.el.

Signature

(verb--maybe-extract-babel-src-block POINT START END)

Documentation

Return the text between START and END, with some exceptions.

If there are one or more Babel source blocks within the text, and the position POINT lies within one of these blocks, return that block's text contents. If POINT is nil, set it to START. Also, clamp POINT between START and END.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb--maybe-extract-babel-src-block (point start end)
  "Return the text between START and END, with some exceptions.
If there are one or more Babel source blocks within the text, and the
position POINT lies within one of these blocks, return that block's
text contents.
If POINT is nil, set it to START.  Also, clamp POINT between START and
END."
  (unless point (setq point start))
  (when (< point start) (setq point start))
  (when (< end point) (setq point end))
  (save-excursion
    (save-match-data
      (goto-char point)
      (let ((case-fold-search t)
            block-start)
        (when (re-search-backward "#\\+begin_src\\s-+verb" start t)
          ;; Found the start.
          (end-of-line)
          (forward-char)
          (setq block-start (point))
          (goto-char point)
          (when (re-search-forward "#\\+end_src" end t)
            ;; Found the end.
            (beginning-of-line)
            (backward-char)
            (setq start block-start)
            (setq end (point))))
        (buffer-substring-no-properties start end)))))