mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -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
|
||||
;; 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-let* ((link-path
|
||||
(org-element-property :path (org-element-context)))
|
||||
(link-dir
|
||||
(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)
|
||||
(file-exists-p link-path))
|
||||
(delete-file link-path))))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue