Function: org-in-src-block-p

org-in-src-block-p is a byte-compiled function defined in org.el.gz.

Signature

(org-in-src-block-p &optional INSIDE ELEMENT)

Documentation

Return t when point is at a source block element.

When INSIDE is non-nil, return t only when point is between #+BEGIN_SRC and #+END_SRC lines.

Note that affiliated keywords and blank lines after are considered a part of a source block.

When ELEMENT is provided, it is considered to be element at point.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-in-src-block-p (&optional inside element)
  "Return t when point is at a source block element.
When INSIDE is non-nil, return t only when point is between #+BEGIN_SRC
and #+END_SRC lines.

Note that affiliated keywords and blank lines after are considered a
part of a source block.

When ELEMENT is provided, it is considered to be element at point."
  (save-match-data (setq element (or element (org-element-at-point))))
  (when (org-element-type-p element 'src-block)
    (or (not inside)
        (not (or (<= (line-beginning-position)
                  (org-element-post-affiliated element))
               (>= (line-end-position)
                  (org-with-point-at (org-element-end element)
                    (skip-chars-backward " \t\n\r")
                    (point))))))))