aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-06-15 12:14:56 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-06-15 12:14:56 +0200
commit2dfcd876dde600fea62adf126b572a1fb3a3357a (patch)
tree02131afd97d667bd94a6151e7c4013577e65b3f0 /lisp
parentc7d026da82e901b9f1264e1f1a6369dd9c921921 (diff)
rough bookmarks, make record and handler
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-tl.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 122e7fb..f74bc8b 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -3026,5 +3026,28 @@ When DOMAIN, force inclusion of user's domain in their handle."
(unless (mastodon-tl--profile-buffer-p)
(mastodon-tl--goto-first-item)))
+;;; BOOKMARKS
+
+(defun mastodon-tl--bookmark-handler (record)
+ "Jump to a bookmarked location in mastodon.el.
+RECORD is the bookmark record."
+ (let ((id (bookmark-prop-get record 'id)))
+ ;; we need to handle thread and single toot for starters
+ (mastodon-tl--thread id)))
+
+(defun mastodon-tl--bookmark-make-record ()
+ "Return a bookmark record for the current mastodon buffer."
+ (let ((id (mastodon-tl--property 'item-id :no-move))
+ (name (buffer-name)))
+ `(,name
+ (buf . ,name)
+ (id . ,id)
+ (handler . mastodon-tl--bookmark-handler))))
+
+(add-hook 'mastodon-mode-hook
+ (lambda ()
+ (setq-local bookmark-make-record-function
+ #'mastodon-tl--bookmark-make-record)))
+
(provide 'mastodon-tl)
;;; mastodon-tl.el ends here