|
@@ -148,21 +148,19 @@ the variable."
|
|
|
(save-restriction
|
|
|
(widen)
|
|
|
(goto-char (point-min))
|
|
|
- (if (let* ((rx (regexp-quote ref))
|
|
|
- (res-rx (concat org-babel-result-regexp rx "[ \t]*.*$"))
|
|
|
- (src-rx (concat org-babel-src-name-regexp
|
|
|
- rx "\\(\(.*\)\\)?" "[ \t]*$")))
|
|
|
+ (if (let ((src-rx (org-babel-named-src-block-regexp-for-name ref))
|
|
|
+ (res-rx (org-babel-named-data-regexp-for-name ref)))
|
|
|
;; goto ref in the current buffer
|
|
|
- (or (and (not args)
|
|
|
- (or (re-search-forward res-rx nil t)
|
|
|
- (re-search-backward res-rx nil t)))
|
|
|
- (re-search-forward src-rx nil t)
|
|
|
- (re-search-backward src-rx nil t)
|
|
|
- ;; check for local or global headlines by id
|
|
|
- (setq id (org-babel-ref-goto-headline-id ref))
|
|
|
- ;; check the Library of Babel
|
|
|
- (setq lob-info (cdr (assoc (intern ref)
|
|
|
- org-babel-library-of-babel)))))
|
|
|
+ (or
|
|
|
+ ;; check for code blocks
|
|
|
+ (re-search-forward src-rx nil t)
|
|
|
+ ;; check for named data
|
|
|
+ (re-search-forward res-rx nil t)
|
|
|
+ ;; check for local or global headlines by id
|
|
|
+ (setq id (org-babel-ref-goto-headline-id ref))
|
|
|
+ ;; check the Library of Babel
|
|
|
+ (setq lob-info (cdr (assoc (intern ref)
|
|
|
+ org-babel-library-of-babel)))))
|
|
|
(unless (or lob-info id) (goto-char (match-beginning 0)))
|
|
|
;; ;; TODO: allow searching for names in other buffers
|
|
|
;; (setq id-loc (org-id-find ref 'marker)
|