summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs/custom/fcuny-org.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/emacs/custom/fcuny-org.el b/emacs/custom/fcuny-org.el
index 5aff1c9..39cfbe6 100644
--- a/emacs/custom/fcuny-org.el
+++ b/emacs/custom/fcuny-org.el
@@ -1,4 +1,5 @@
 (require 'fcuny-vars)
+(require 'fcuny-clipboard)
 
 (use-package org-ml
   :ensure t)
@@ -108,6 +109,7 @@
                       ,(expand-file-name "notes.org" org-directory)
                       ,(expand-file-name "tasks.org" org-directory)
                       ,(expand-file-name "projects.org" org-directory)
+                      ,(expand-file-name "bookmarks.org" org-directory)
                       ,(expand-file-name "journal.org" org-directory)))
   (org-agenda-show-all-dates t)
   (calendar-week-start-day 1)
@@ -130,6 +132,22 @@
                         ((org-agenda-overriding-header "Not yet started")
                          (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled))))))))
 
+(defun fcuny/org-capture/link ()
+  "Make a TODO entry with a link in clipboard. Page title is used as an entry heading."
+  (let* ((url-string (s-trim (fcuny/clipboard-get-contents)))
+         (pdf (string-suffix-p "pdf" url-string)))
+    (unless pdf
+      (let ((page-title (org-web-tools--html-title (org-web-tools--get-url url-string))))
+        (concat "* "
+                page-title
+                "\t%^g"
+                "\n:PROPERTIES:\n:CREATED: %T\n:URL: "
+                url-string
+                "\n:END:\n%?")))))
+
+(use-package org-web-tools
+  :ensure t)
+
 (use-package org-capture
   :ensure nil
   :after (org)
@@ -141,6 +159,9 @@
      ("n" "Note" entry (file "notes.org")
       "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n")
 
+     ("l" "Bookmark" entry (file "bookmarks.org")
+      (function fcuny/org-capture/link))
+
      ("j" "Journal" entry
       (file+olp+datetree "journal.org")
       "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n" :tree-type day))))