diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-27 16:56:23 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-27 16:56:23 +0100 |
commit | 35a527c6562fb73da313c7e64f3eff1bb8c3001e (patch) | |
tree | c63a18df2a1a5fa44caed5541f24b3b7396bc25b | |
parent | f740c21d7957e0c1fd4099efcd01193374e8cee9 (diff) | |
download | dotfiles-35a527c6562fb73da313c7e64f3eff1bb8c3001e.tar.gz dotfiles-35a527c6562fb73da313c7e64f3eff1bb8c3001e.tar.bz2 dotfiles-35a527c6562fb73da313c7e64f3eff1bb8c3001e.zip |
(Emacs/elisp)+org-bookmark/make-bookmark function
This will allow for easy automation when using ytsearch: every pair of
results can be wrapped in this expression to generate the videos I
want.
-rw-r--r-- | Emacs/.config/emacs/elisp/org-bookmark.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Emacs/.config/emacs/elisp/org-bookmark.el b/Emacs/.config/emacs/elisp/org-bookmark.el index d2ab950..9d26c94 100644 --- a/Emacs/.config/emacs/elisp/org-bookmark.el +++ b/Emacs/.config/emacs/elisp/org-bookmark.el @@ -31,6 +31,16 @@ (defvar org-bookmark/file (expand-file-name (concat org-directory "/bookmarks.org"))) +(defun org-bookmark/make-bookmark (name url) + "Insert a properly formatted bookmark into ORG-BOOKMARK/FILE +composed of NAME and URL." + (with-current-buffer (find-file org-bookmark/file) + (org-insert-heading-respect-content) + (insert (concat name " :bookmark:")) + (org-set-property "url" url) + (next-line 2) + (org-insert-time-stamp (time-stamp) t))) + (defun org-bookmark/--get-heading-data () "In an org-mode buffer, with point on a heading: get the title, tags and url." @@ -80,8 +90,8 @@ are cached for faster lookup." (not (= cur-last-modified org-bookmark/--cache-last-modified))) ; file has been modified (setq org-bookmark/--cache-last-modified cur-last-modified org-bookmark/--cache (mapcar - #'org-bookmark/--format-heading-data - (org-bookmark/--get-all-heading-data)))))) + #'org-bookmark/--format-heading-data + (org-bookmark/--get-all-heading-data)))))) org-bookmark/--cache) (defconst org-bookmark/dispatch-list |