mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-23 07:18:53 +00:00
ob-core: Fix `org-babel-goto-named-src-block' at point-min
* lisp/ob-core.el (org-babel-find-named-block): (org-babel-src-block-names): Fix behaviour when match is at point-min. Reported-by: "Berry, Charles" <ccberry@ucsd.edu> <http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00324.html>
This commit is contained in:
parent
6f5cacd607
commit
b862c24b9f
@ -1752,16 +1752,20 @@ NAME, or nil if no such block exists. Set match data according
|
||||
to `org-babel-named-src-block-regexp'."
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(ignore-errors
|
||||
(org-next-block 1 nil (org-babel-named-src-block-regexp-for-name name)))))
|
||||
(let ((regexp (org-babel-named-src-block-regexp-for-name name)))
|
||||
(or (and (looking-at regexp)
|
||||
(progn (goto-char (match-beginning 1))
|
||||
(line-beginning-position)))
|
||||
(ignore-errors (org-next-block 1 nil))))))
|
||||
|
||||
(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
|
||||
(goto-char (point-min))
|
||||
(let ((re (org-babel-named-src-block-regexp-for-name))
|
||||
names)
|
||||
(let* ((re (org-babel-named-src-block-regexp-for-name))
|
||||
(names (and (looking-at re)
|
||||
(list (match-string-no-properties 9)))))
|
||||
(while (ignore-errors (org-next-block 1 nil re))
|
||||
(push (match-string-no-properties 9) names))
|
||||
names)))
|
||||
|
Loading…
Reference in New Issue
Block a user