From e66ce7b6fb55a5f78a840ca4c00aa9773bbc9e4f Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 1 Aug 2024 19:38:34 +0200 Subject: folding comments / action docstring --- lisp/mastodon-tl.el | 18 ++++++++++++++++-- lisp/mastodon-toot.el | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 651427a..797b355 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1588,14 +1588,28 @@ Folding decided by `mastodon-tl--fold-toots-at-length'." (let* ((byline (mastodon-tl--property 'byline :no-move)) (read-more-p (mastodon-tl--find-property-range 'read-more (point) byline))) + ;; FIXME: handle any point of the item body and byline + ;; ie if we are inbetween, try moving up or down (and check again?) (if (and (not fold) (not read-more-p)) (user-error "No folded item at point?") (let* ((inhibit-read-only t) (range (mastodon-tl--find-property-range 'item-json (point))) + ;; FIXME: we need to reload toot data if we want + ;; fave/boost/bookmark stats to display correctly. ie if we do + ;; an action then (un)fold, stats/(*)/etc display incorrectly. + + ;; another option may be to check favourited-p/boosted-p prop, + ;; and then call toot--action-success again with the relevant + ;; symbol (to insert it after re-display)? as per + ;; `mastodon-toot--toggle-boost-or-favourite' callback? + + ;; or, is it simpler to just not replace the byline? to do that, + ;; we need to call `mastodont-tl--insert-status' without + ;; inserting a byline, so that props are all correct... (toot (mastodon-tl--property 'item-json))) - ;; `replace-region-contents' is much to slow, our hack from fedi.el is - ;; much simpler and much faster + ;; `replace-region-contents' is much too slow, our hack from fedi.el + ;; is much simpler and much faster: (let ((beg (car range)) (end (cdr range)) (last-point (point))) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 0324c32..1269516 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -376,7 +376,7 @@ JSON is added to the string as its item-json." (mastodon-tl--goto-next-item))))) (defun mastodon-toot--action (action callback) - "Take ACTION on toot at point, then execute CALLBACK. + "Take ACTION, a string, on toot at point, then execute CALLBACK. Makes a POST request to the server. Used for favouriting, boosting, or bookmarking toots." (let* ((id (mastodon-tl--property 'base-item-id)) -- cgit v1.2.3