summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-04-20 10:43:20 -0500
committerCase Duckworth2022-04-20 10:43:20 -0500
commit1f7e7ebf24fd72aa4bcebd978b03590101f5df2f (patch)
tree0d2695e4381b7d814b3e0da5663fd2a6464434a0 /lisp
parentProperly set fixed-pitch height (diff)
downloademacs-1f7e7ebf24fd72aa4bcebd978b03590101f5df2f.tar.gz
emacs-1f7e7ebf24fd72aa4bcebd978b03590101f5df2f.zip
Add org-drawer-list
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+org-drawer-list.el41
1 files changed, 41 insertions, 0 deletions
diff --git a/lisp/+org-drawer-list.el b/lisp/+org-drawer-list.el new file mode 100644 index 0000000..2fc7234 --- /dev/null +++ b/lisp/+org-drawer-list.el
@@ -0,0 +1,41 @@
1;;; +org-drawer-list.el --- Add stuff to org drawers easy-style -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7(require 'org)
8(require '+org)
9(require 'ol)
10(require 'org-drawer-list)
11
12(defcustom +org-drawer-list-resources-drawer "RESOURCES"
13 "Where to add links with `+org-drawer-list-add-resource'.")
14
15(defun +org-drawer-list-add-resource (url &optional title)
16 "Add URL to the resource drawer of the current tree.
17The resource drawer is given by the variable
18`+org-drawer-list-resources-drawer'. If optional TITLE is given,
19format the list item as an Org link."
20 (interactive
21 (let* ((clipboard-url (if (string-match-p (rx (sequence bos
22 (or "http"
23 "gemini"
24 "gopher"
25 "tel"
26 "mailto")))
27 (current-kill 0))
28 (string-trim (current-kill 0))
29 (read-string "URL: ")))
30 (url-title (let ((clipboard-headings
31 (+org-insert--get-title-and-headings clipboard-url)))
32 (read-string "title (edit): "
33 (completing-read
34 "title: " clipboard-headings
35 nil nil nil nil (car clipboard-headings))))))
36 (list clipboard-url url-title)))
37 (org-drawer-list-add +org-drawer-list-resources-drawer
38 (org-link-make-string url title)))
39
40(provide '+org-drawer-list)
41;;; +org-drawer-list.el ends here