[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon dd1b0ab770 42/63: add mastodon-tl--fold-post
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon dd1b0ab770 42/63: add mastodon-tl--fold-post |
Date: |
Sun, 4 Aug 2024 04:00:35 -0400 (EDT) |
branch: elpa/mastodon
commit dd1b0ab77043508623e0bb0e7861beeeb00c8e2f
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>
add mastodon-tl--fold-post
---
lisp/mastodon-tl.el | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index d3a11ed600..908a063cf2 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1566,7 +1566,8 @@ When DOMAIN, force inclusion of user's domain in their
handle."
(mastodon-media--inline-images start-pos (point)))))
(defun mastodon-tl--fold-body-maybe (body &optional unfolded)
- "Fold toot BODY if it is very long."
+ "Fold toot BODY if it is very long.
+Folding decided by `mastodon-tl--fold-toots-at-length'."
(if (or unfolded
(eq nil mastodon-tl--fold-toots-at-length)
(length< body mastodon-tl--fold-toots-at-length))
@@ -1581,30 +1582,37 @@ When DOMAIN, force inclusion of user's domain in their
handle."
(propertize display
'read-more body))))
-(defun mastodon-tl--unfold-post ()
+(defun mastodon-tl--unfold-post (&optional fold)
"Unfold the toot at point if it is folded (read-more)."
(interactive)
;; if at byline, must search backwards:
(let* ((byline (mastodon-tl--property 'byline :no-move))
(read-more-p (mastodon-tl--find-property-range
'read-more (point) byline)))
- (if (not read-more-p)
+ (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)))
+ (range (mastodon-tl--find-property-range 'item-json (point)))
(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 to slow, our hack from fedi.el is
+ ;; much simpler and much faster
(let ((beg (car range))
(end (cdr range)))
(save-excursion
(goto-char beg)
(delete-region beg end)
- (mastodon-tl--toot toot nil nil nil :unfolded))
+ (mastodon-tl--toot toot nil nil nil
+ (when (not fold) :unfolded)))
;; move point to line where text formerly ended:
- (goto-char end)
- (beginning-of-line))))))
+ (unless fold
+ (goto-char end)
+ (beginning-of-line)))))))
+
+(defun mastodon-tl--fold-post ()
+ "Fold post at point, if it is too long."
+ (interactive)
+ (mastodon-tl--unfold-post :fold))
;; from mastodon-alt.el:
(defun mastodon-tl--toot-for-stats (&optional toot)
- [nongnu] elpa/mastodon 49261b91b0 59/63: Revert "replace persist with multisession", (continued)
- [nongnu] elpa/mastodon 49261b91b0 59/63: Revert "replace persist with multisession", ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 351bd73875 54/63: fix prev-item-id, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 712a2af648 29/63: update info, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 0cd77c1880 37/63: Merge branch 'with-toot-item' into develop, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 82931c0869 14/63: readme, emoji, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 4e8d286164 12/63: mastodon-use-emojify customize, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 4697c073e8 19/63: message -> user-error, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 344da8f2f2 23/63: fold toots customize/ refactor, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon db227a8c25 31/63: flip an if clause, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 4844a1147a 44/63: no newline after READ MORE heading, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon dd1b0ab770 42/63: add mastodon-tl--fold-post,
ELPA Syncer <=
- [nongnu] elpa/mastodon 30b02296ca 48/63: fix where we leave point on (un)folding, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 8d6983667d 51/63: refactor toot--toggle-bookmark, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon da0e348bc7 61/63: Revert "multisession var in -toot.el", ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 45903de823 63/63: info update, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 3f9b305b5f 24/63: flymake, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon bb1b33e2fb 39/63: toot.el: use mastodon-toot--base-toot-or-item-json, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon e66ce7b6fb 52/63: folding comments / action docstring, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 4ac5b57ae6 62/63: Merge branch 'develop', ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon f8ee682bb4 36/63: flip an if clause, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 5621b2df84 56/63: add underscores to user-like url regexes, ELPA Syncer, 2024/08/04