Ihor Radchenko <yanta...@gmail.com> writes: > Dear Narendra, > > Here is what I am using: > > (defun org-att-complete-link (&optional arg) > "Completion dispatcher for att: links (rewritten from org-attach-open)" > (let* ((attach-dir (org-attach-dir t)) > (files (org-attach-file-list attach-dir)) > (file (if (= (length files) 1) > (car files) > (completing-read "att: " > (mapcar #'list files) nil t))) > (path (expand-file-name file attach-dir))) > (concat "att:" file))) > (add-to-list 'org-link-abbrev-alist '("att" . org-attach-expand-link)) > (org-link-set-parameters > "att" > :complete 'org-att-complete-link) #+begin_src emacs-lisp (defun org-att-complete-link (&optional arg) "Completion dispatcher for att: links (rewritten from org-attach-open)" (let* ((attach-dir (expand-file-name org-attach-directory org-directory)) (file-paths (directory-files-recursively attach-dir ".*")) (completions (mapcar (lambda (f) (cons (file-name-base f) f)) file-paths)) (file-name (completing-read "att: " completions nil t)) (path (assoc-default file-name completions))) (concat "att:" path))) #+end_src
This worked for me. I had to change it a bit for my use case. Thanks a lot for the help! :) -- Narendra Joshi