summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el6
-rw-r--r--lisp/+org-drawer-list.el41
2 files changed, 47 insertions, 0 deletions
diff --git a/init.el b/init.el index a69081f..f6ed814 100644 --- a/init.el +++ b/init.el
@@ -1913,6 +1913,12 @@ See also `crux-reopen-as-root-mode'."
1913 (:else 'url-retrieve))) 1913 (:else 'url-retrieve)))
1914 (add-hook 'dired-mode-hook 'org-download-enable)) 1914 (add-hook 'dired-mode-hook 'org-download-enable))
1915 1915
1916(setup (:straight (org-drawer-list
1917 :host github
1918 :repo "d12frosted/org-drawer-list"))
1919 (:load-after org)
1920 (:also-load +org-drawer-list))
1921
1916(setup (:straight org-mime) 1922(setup (:straight org-mime)
1917 (:option org-mime-export-ascii 'utf-8)) 1923 (:option org-mime-export-ascii 'utf-8))
1918 1924
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