Function: org-babel-src-block-names

org-babel-src-block-names is a byte-compiled function defined in ob-core.el.gz.

Signature

(org-babel-src-block-names &optional FILE)

Documentation

Return the names of source blocks in FILE or the current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
(defun org-babel-src-block-names (&optional file)
  "Return the names of source blocks in FILE or the current buffer."
  (with-current-buffer (if file (find-file-noselect file) (current-buffer))
    (org-with-point-at 1
      (let ((regexp "^[ \t]*#\\+begin_src ")
	    (case-fold-search t)
	    (names nil))
	(while (re-search-forward regexp nil t)
	  (let ((element (org-element-at-point)))
	    (when (eq 'src-block (org-element-type element))
	      (let ((name (org-element-property :name element)))
		(when name (push name names))))))
	names))))