lang/org: remove dash.el references in autoload/attach.el

This commit is contained in:
Henrik Lissner 2017-02-25 01:34:53 -05:00
parent 6108d6929d
commit b80b4cf714

View file

@ -16,8 +16,8 @@
(defun +org-cleanup-attachments () (defun +org-cleanup-attachments ()
;; "Deletes any attachments that are no longer present in the org-mode buffer." ;; "Deletes any attachments that are no longer present in the org-mode buffer."
(let* ((attachments-local (+org-attachments)) (let* ((attachments-local (+org-attachments))
(attachments (f-entries org-attach-directory)) (attachments (directory-files org-attach-directory t "^[^.]" t))
(to-delete (-difference attachments-local attachments))) (to-delete (cl-set-difference attachments-local attachments)))
;; TODO ;; TODO
to-delete)) to-delete))
@ -28,19 +28,20 @@
(let ((attachments '()) (let ((attachments '())
element element
file) file)
(when (and (f-dir? org-attach-directory) (when (and (file-directory-p org-attach-directory)
(> (length (f-glob (concat (f-slash org-attach-directory) "*"))) 0)) (> (length (file-expand-wildcards (expand-file-name "*" org-attach-directory))) 0))
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (progn (org-next-link) (not org-link-search-failed)) (while (progn (org-next-link) (not org-link-search-failed))
(setq element (org-element-lineage (org-element-context) '(link) t)) (setq element (org-element-context))
(when element (when-let (file (and (eq (org-element-type element) 'link)
(setq file (expand-file-name (org-element-property :path element))) (expand-file-name (org-element-property :path element))))
(when (and (string= (org-element-property :type element) "file") (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)) (file-exists-p file))
(push file attachments)))))) (push file attachments))))))
(-distinct attachments)))) (cl-remove-duplicates attachments))))
;;;###autoload ;;;###autoload
(defun +org-download-dnd (uri action) (defun +org-download-dnd (uri action)