1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-23 07:18:53 +00:00

ob: better error messages when searches for code blocks fail

* lisp/ob.el (org-babel-next-src-block): now raising more informative
  error when no further code blocks can be found
  (org-babel-previous-src-block): now raising more informative error
  when no previous code blocks can be found
This commit is contained in:
Eric Schulte 2010-09-07 23:59:04 -06:00
parent 58fe371299
commit e92a4b0813

View File

@ -1097,7 +1097,9 @@ buffer or nil if no such result exists."
With optional prefix argument ARG, jump forward ARG many source blocks."
(interactive "P")
(when (looking-at org-babel-src-block-regexp) (forward-char 1))
(re-search-forward org-babel-src-block-regexp nil nil (or arg 1))
(condition-case nil
(re-search-forward org-babel-src-block-regexp nil nil (or arg 1))
(error (error "No further code blocks")))
(goto-char (match-beginning 0)) (org-show-context))
;;;###autoload
@ -1105,7 +1107,9 @@ With optional prefix argument ARG, jump forward ARG many source blocks."
"Jump to the previous source block.
With optional prefix argument ARG, jump backward ARG many source blocks."
(interactive "P")
(re-search-backward org-babel-src-block-regexp nil nil (or arg 1))
(condition-case nil
(re-search-backward org-babel-src-block-regexp nil nil (or arg 1))
(error (error "No previous code blocks")))
(goto-char (match-beginning 0)) (org-show-context))
(defvar org-babel-lob-one-liner-regexp)