mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:00:49 +00:00
babel: resolving references outside of the visible portion of narrowed buffers
Thanks to Tom Dye for pointing out the need for this fix * contrib/babel/lisp/org-babel.el (org-babel-expand-noweb-references): now able to find noweb references even outside of the narrowed portion of the buffer when the buffer is narrowed * contrib/babel/lisp/org-babel-ref.el (org-babel-ref-resolve-reference): now able to resolve references which are located outside of the narrowed portion of the buffer when the buffer is narrowed
This commit is contained in:
parent
93ab492464
commit
ef931fcd3a
|
@ -120,6 +120,8 @@ return nil."
|
|||
(setq split-file (match-string 1 ref))
|
||||
(setq split-ref (match-string 2 ref))
|
||||
(find-file split-file) (setq ref split-ref))
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(if (let ((result_regexp (concat "^#\\+\\(TBLNAME\\|RESNAME\\|RESULTS\\):[ \t]*"
|
||||
(regexp-quote ref) "[ \t]*$"))
|
||||
|
@ -160,7 +162,7 @@ return nil."
|
|||
(format "%S" result)
|
||||
(if (and index (listp result))
|
||||
(org-babel-ref-index-list index result)
|
||||
result)))))
|
||||
result))))))
|
||||
|
||||
(defun org-babel-ref-index-list (index lis)
|
||||
"Return the subset of LIS indexed by INDEX. If INDEX is
|
||||
|
|
|
@ -1232,6 +1232,8 @@ block but are passed literally to the \"example-block\"."
|
|||
(let ((raw (org-babel-ref-resolve-reference
|
||||
source-name nil)))
|
||||
(if (stringp raw) raw (format "%S" raw)))
|
||||
(save-restriction
|
||||
(widen)
|
||||
(let ((point (org-babel-find-named-block source-name)))
|
||||
(if point
|
||||
(save-excursion
|
||||
|
@ -1246,7 +1248,8 @@ block but are passed literally to the \"example-block\"."
|
|||
(concat "<<%s>> could not be resolved "
|
||||
"(see `org-babel-noweb-error-langs')")
|
||||
source-name)
|
||||
"")))) "[\n\r]") (concat "\n" prefix)))))
|
||||
"")))))
|
||||
"[\n\r]") (concat "\n" prefix)))))
|
||||
(nb-add (buffer-substring index (point-max)))))
|
||||
new-body))
|
||||
|
||||
|
|
Loading…
Reference in a new issue