|
@@ -1759,23 +1759,22 @@ If the point is not on a source block then return nil."
|
|
|
(defun org-babel-find-named-block (name)
|
|
|
"Find a named source-code block.
|
|
|
Return the location of the source block identified by source
|
|
|
-NAME, or nil if no such block exists. Set match data according to
|
|
|
-org-babel-named-src-block-regexp."
|
|
|
+NAME, or nil if no such block exists. Set match data according
|
|
|
+to `org-babel-named-src-block-regexp'."
|
|
|
(save-excursion
|
|
|
- (let ((case-fold-search t)
|
|
|
- (regexp (org-babel-named-src-block-regexp-for-name name)) msg)
|
|
|
- (goto-char (point-min))
|
|
|
- (when (or (re-search-forward regexp nil t)
|
|
|
- (re-search-backward regexp nil t))
|
|
|
- (match-beginning 0)))))
|
|
|
+ (goto-char (point-min))
|
|
|
+ (ignore-errors
|
|
|
+ (org-next-block 1 nil (org-babel-named-src-block-regexp-for-name name)))))
|
|
|
|
|
|
(defun org-babel-src-block-names (&optional file)
|
|
|
"Returns the names of source blocks in FILE or the current buffer."
|
|
|
+ (when file (find-file file))
|
|
|
(save-excursion
|
|
|
- (when file (find-file file)) (goto-char (point-min))
|
|
|
- (let ((case-fold-search t) names)
|
|
|
- (while (re-search-forward org-babel-src-name-w-name-regexp nil t)
|
|
|
- (setq names (cons (match-string 3) names)))
|
|
|
+ (goto-char (point-min))
|
|
|
+ (let (names)
|
|
|
+ (while (ignore-errors
|
|
|
+ (org-next-block 1 nil org-babel-src-name-w-name-regexp))
|
|
|
+ (push (match-string 3) names))
|
|
|
names)))
|
|
|
|
|
|
;;;###autoload
|