mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 23:41:38 -05:00
org-babel-jupyter-cleanup-file-links: Handle links with no directory
This commit is contained in:
parent
ee62fafdf6
commit
ee1078d0c7
1 changed files with 7 additions and 4 deletions
|
@ -223,10 +223,13 @@ Do this only if the file exists in
|
||||||
;; This assumes that `jupyter-org-client' only emits bracketed links as
|
;; This assumes that `jupyter-org-client' only emits bracketed links as
|
||||||
;; images
|
;; images
|
||||||
(while (re-search-forward link-re bound t)
|
(while (re-search-forward link-re bound t)
|
||||||
(let* ((link-path (org-element-property :path (org-element-context)))
|
(when-let* ((link-path
|
||||||
(link-dir (expand-file-name (file-name-directory link-path)))
|
(org-element-property :path (org-element-context)))
|
||||||
(resource-dir
|
(link-dir
|
||||||
(expand-file-name org-babel-jupyter-resource-directory)))
|
(when (file-name-directory link-path)
|
||||||
|
(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)
|
(when (and (equal link-dir resource-dir)
|
||||||
(file-exists-p link-path))
|
(file-exists-p link-path))
|
||||||
(delete-file link-path))))))))
|
(delete-file link-path))))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue