Fix #2429: replace defunct attach: links w/ download:

Forgot that support for attach: links were removed some time ago, but I
still want short org-download links, so I've added 'download:' links.
This commit is contained in:
Henrik Lissner 2020-01-26 02:20:39 -05:00
parent 871201dad6
commit 827225e331
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 49 additions and 40 deletions

View file

@ -1,5 +1,21 @@
;;; lang/org/autoload/org-link.el -*- lexical-binding: t; -*-
(defun +org--relpath (path root)
(if (and buffer-file-name (file-in-directory-p buffer-file-name root))
(file-relative-name path)
path))
;;;###autoload
(defun +org-def-link (key dir)
(org-link-set-parameters
key
:complete (lambda () (+org--relpath (+org-link-read-file key dir) dir))
:follow (lambda (link) (find-file (expand-file-name link dir)))
:face (lambda (link)
(if (file-exists-p (expand-file-name link dir))
'org-link
'error))))
;;;###autoload
(defun +org-link-read-file (key dir)
(let ((file (read-file-name (format "%s: " (capitalize key)) dir)))