From b80b4cf71464c318d4c5caf5151066e442e35fc0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 25 Feb 2017 01:34:53 -0500 Subject: [PATCH] lang/org: remove dash.el references in autoload/attach.el --- modules/lang/org/autoload/attach.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/lang/org/autoload/attach.el b/modules/lang/org/autoload/attach.el index 6db55734d..416445b6f 100644 --- a/modules/lang/org/autoload/attach.el +++ b/modules/lang/org/autoload/attach.el @@ -16,8 +16,8 @@ (defun +org-cleanup-attachments () ;; "Deletes any attachments that are no longer present in the org-mode buffer." (let* ((attachments-local (+org-attachments)) - (attachments (f-entries org-attach-directory)) - (to-delete (-difference attachments-local attachments))) + (attachments (directory-files org-attach-directory t "^[^.]" t)) + (to-delete (cl-set-difference attachments-local attachments))) ;; TODO to-delete)) @@ -28,19 +28,20 @@ (let ((attachments '()) element file) - (when (and (f-dir? org-attach-directory) - (> (length (f-glob (concat (f-slash org-attach-directory) "*"))) 0)) + (when (and (file-directory-p org-attach-directory) + (> (length (file-expand-wildcards (expand-file-name "*" org-attach-directory))) 0)) (save-excursion (goto-char (point-min)) (while (progn (org-next-link) (not org-link-search-failed)) - (setq element (org-element-lineage (org-element-context) '(link) t)) - (when element - (setq file (expand-file-name (org-element-property :path element))) + (setq element (org-element-context)) + (when-let (file (and (eq (org-element-type element) 'link) + (expand-file-name (org-element-property :path element)))) (when (and (string= (org-element-property :type element) "file") - (string= (concat (f-base (f-dirname file)) "/") org-attach-directory) + (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/") + org-attach-directory) (file-exists-p file)) (push file attachments)))))) - (-distinct attachments)))) + (cl-remove-duplicates attachments)))) ;;;###autoload (defun +org-download-dnd (uri action)