aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el64
1 files changed, 40 insertions, 24 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 355c215..ebf3570 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -283,6 +283,18 @@ text, i.e. hidden spoiler text."
(mastodon-tl--init
(concat "tag-" tag) (concat "timelines/tag/" tag) 'mastodon-tl--timeline))
+(defun mastodon-tl--message-help-echo ()
+ "Call message on 'help-echo property at point.
+Do so if type of status at poins is not follow_request/follow."
+ (let ((type (alist-get
+ 'type
+ (get-text-property (point) 'toot-json)))
+ (echo (get-text-property (point) 'help-echo)))
+ (when echo ; not for followers/following in profile
+ (unless (or (string= type "follow_request")
+ (string= type "follow")) ; no counts for these
+ (message "%s" (get-text-property (point) 'help-echo))))))
+
(defun mastodon-tl--goto-toot-pos (find-pos refresh &optional pos)
"Search for toot with FIND-POS.
If search returns nil, execute REFRESH function.
@@ -295,7 +307,9 @@ Optionally start from POS."
(if npos
(if (not (get-text-property npos 'toot-id))
(mastodon-tl--goto-toot-pos find-pos refresh npos)
- (goto-char npos))
+ (goto-char npos)
+ ;; force display of help-echo on moving to a toot byline:
+ (mastodon-tl--message-help-echo))
(funcall refresh))))
(defun mastodon-tl--goto-next-toot ()
@@ -373,12 +387,12 @@ Used on initializing a timeline or thread."
(propertize (concat "@" handle)
'face 'mastodon-handle-face
'mouse-face 'highlight
- 'mastodon-tab-stop 'user-handle
+ 'mastodon-tab-stop 'user-handle
'account account
- 'shr-url profile-url
- 'keymap mastodon-tl--link-keymap
+ 'shr-url profile-url
+ 'keymap mastodon-tl--link-keymap
'mastodon-handle (concat "@" handle)
- 'help-echo (concat "Browse user profile of @" handle))
+ 'help-echo (concat "Browse user profile of @" handle))
")")))
(defun mastodon-tl--format-faves-count (toot)
@@ -398,22 +412,23 @@ image media from the byline."
toot)
(alist-get 'reblog toot) ; boosts
toot)) ; everything else
- (fol-req-p (equal (alist-get 'type toot-to-count) "follow"))
- (media-types (mastodon-tl--get-media-types toot))
- (format-faves (format "%s faves | %s boosts | %s replies"
- (alist-get 'favourites_count toot-to-count)
- (alist-get 'reblogs_count toot-to-count)
- (alist-get 'replies_count toot-to-count)))
- (format-media (when media-types
- (format " | media: %s"
- (mapconcat #'identity media-types " "))))
- (format-media-binding (when (and (or
- (member "video" media-types)
- (member "gifv" media-types))
- (require 'mpv nil :no-error))
- (format " | C-RET to view with mpv"))))
+ (fol-req-p (or (string= (alist-get 'type toot-to-count) "follow")
+ (string= (alist-get 'type toot-to-count) "follow_request"))))
(unless fol-req-p
- (format "%s" (concat format-faves format-media format-media-binding)))))
+ (let* ((media-types (mastodon-tl--get-media-types toot))
+ (format-faves (format "%s faves | %s boosts | %s replies"
+ (alist-get 'favourites_count toot-to-count)
+ (alist-get 'reblogs_count toot-to-count)
+ (alist-get 'replies_count toot-to-count)))
+ (format-media (when media-types
+ (format " | media: %s"
+ (mapconcat #'identity media-types " "))))
+ (format-media-binding (when (and (or
+ (member "video" media-types)
+ (member "gifv" media-types))
+ (require 'mpv nil :no-error))
+ (format " | C-RET to view with mpv"))))
+ (format "%s" (concat format-faves format-media format-media-binding))))))
(defun mastodon-tl--get-media-types (toot)
"Return a list of the media attachment types of the TOOT at point."
@@ -594,10 +609,10 @@ this just means displaying toot client."
'face 'mastodon-display-name-face
'follow-link t
'mouse-face 'highlight
- 'mastodon-tab-stop 'shr-url
- 'shr-url app-url
+ 'mastodon-tab-stop 'shr-url
+ 'shr-url app-url
'help-echo app-url
- 'keymap mastodon-tl--shr-map-replacement)))))
+ 'keymap mastodon-tl--shr-map-replacement)))))
(propertize "\n ------------\n" 'face 'default))
'favourited-p faved
'boosted-p boosted
@@ -1299,7 +1314,8 @@ ID is that of the toot to view."
;; this requires that 'base-toot-id always be set:
(get-text-property (point) 'base-toot-id)))
(type (mastodon-tl--field 'type (mastodon-tl--property 'toot-json))))
- (if (string= type "follow_request") ; no can thread this
+ (if (or (string= type "follow_request")
+ (string= type "follow")) ; no can thread these
(error "No thread")
(let* ((url (mastodon-http--api (format "statuses/%s/context" id)))
(buffer (format "*mastodon-thread-%s*" id))