Function: org-attach-complete-link
org-attach-complete-link is a byte-compiled function defined in
org-attach.el.gz.
Signature
(org-attach-complete-link)
Documentation
Advise the user with the available files in the attachment directory.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-attach.el.gz
(defun org-attach-complete-link ()
"Advise the user with the available files in the attachment directory."
(let ((attach-dir (org-attach-dir)))
(if attach-dir
(let* ((attached-dir (expand-file-name attach-dir))
(file (read-file-name "File: " attached-dir))
(pwd (file-name-as-directory attached-dir))
(pwd-relative (file-name-as-directory
(abbreviate-file-name attached-dir))))
(cond
((string-match (concat "^" (regexp-quote pwd-relative) "\\(.+\\)") file)
(concat "attachment:" (match-string 1 file)))
((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
(expand-file-name file))
(concat "attachment:" (match-string 1 (expand-file-name file))))
(t (concat "attachment:" file))))
(error "No attachment directory exist"))))