mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
org-babel-jupyter-cleanup-file-links: Fix search bound
This commit is contained in:
parent
4878f6a41e
commit
51a4d9b2d6
1 changed files with 10 additions and 10 deletions
|
@ -232,20 +232,20 @@ parameter will be used."
|
|||
Do this only if the file exists in
|
||||
`org-babel-jupyter-resource-directory'."
|
||||
(when-let ((result-pos (org-babel-where-is-src-block-result))
|
||||
(link-re (format "^[ \t]*%s[ \t]*$" org-bracket-link-regexp))
|
||||
(bound (org-babel-result-end)))
|
||||
(link-re (format "^[ \t]*%s[ \t]*$" org-bracket-link-regexp)))
|
||||
(save-excursion
|
||||
(goto-char result-pos)
|
||||
;; This assumes that `jupyter-org-client' only emits bracketed links as
|
||||
;; images
|
||||
(while (re-search-forward link-re bound t)
|
||||
(let* ((link-path (org-element-property :path (org-element-context)))
|
||||
(link-dir (expand-file-name (file-name-directory link-path)))
|
||||
(resource-dir
|
||||
(expand-file-name org-babel-jupyter-resource-directory)))
|
||||
(when (and (equal link-dir resource-dir)
|
||||
(file-exists-p link-path))
|
||||
(delete-file link-path)))))))
|
||||
(let ((bound (org-babel-result-end)))
|
||||
(while (re-search-forward link-re bound t)
|
||||
(let* ((link-path (org-element-property :path (org-element-context)))
|
||||
(link-dir (expand-file-name (file-name-directory link-path)))
|
||||
(resource-dir
|
||||
(expand-file-name org-babel-jupyter-resource-directory)))
|
||||
(when (and (equal link-dir resource-dir)
|
||||
(file-exists-p link-path))
|
||||
(delete-file link-path))))))))
|
||||
|
||||
(defun org-babel-execute:jupyter (body params)
|
||||
"Execute BODY according to PARAMS.
|
||||
|
|
Loading…
Add table
Reference in a new issue