aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-discover.el29
-rw-r--r--lisp/mastodon-notifications.el25
-rw-r--r--lisp/mastodon-profile.el12
-rw-r--r--lisp/mastodon-tl.el64
4 files changed, 78 insertions, 52 deletions
diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el
index f33b25d..0ef64e2 100644
--- a/lisp/mastodon-discover.el
+++ b/lisp/mastodon-discover.el
@@ -51,10 +51,14 @@
("b" "Boost" mastodon-toot--boost)
("f" "Favourite" mastodon-toot--favourite)
("c" "Toggle hidden text (CW)" mastodon-tl--toggle-spoiler-text-in-toot)
+ ("k" "Bookmark toot" mastodon-toot--bookmark-toot-toggle)
+ ("v" "Vote on poll" mastodon-tl--poll-vote)
("n" "Next" mastodon-tl--goto-next-toot)
("p" "Prev" mastodon-tl--goto-prev-toot)
("TAB" "Next link item" mastodon-tl--next-tab-item)
("S-TAB" "Prev link item" mastodon-tl--previous-tab-item)
+ (when (require 'mpv nil :noerror)
+ ("C-RET" "Play media" mastodon-tl--mpv-play-video-at-point))
("t" "New toot" mastodon-toot)
("r" "Reply" mastodon-toot--reply)
("C" "Copy toot URL" mastodon-toot--copy-toot-url)
@@ -62,10 +66,12 @@
("D" "Delete and redraft (your) toot" mastodon-toot--delete-toot)
("i" "Pin/Unpin (your) toot" mastodon-toot--pin-toot-toggle)
("P" "View user profile" mastodon-profile--show-user)
+ (when (require 'lingva nil :noerror)
+ "s" "Translate toot at point" mastodon-toot--translate-toot-text)
("T" "View thread" mastodon-tl--thread)
("v" "Vote on poll" mastodon-tl--poll-vote))
- ("Timelines"
- ("h" "View mode help/keybindings" describe-mode)
+ ("Views"
+ ("h/?" "View mode help/keybindings" describe-mode)
("#" "Tag search" mastodon-tl--get-tag-timeline)
("F" "Federated" mastodon-tl--get-federated-timeline)
("H" "Home" mastodon-tl--get-home-timeline)
@@ -73,8 +79,13 @@
("N" "Notifications" mastodon-notifications--get)
("u" "Update timeline" mastodon-tl--update)
("S" "Search" mastodon-search--search-query)
- ("C-S-P" "Jump to your profile" mastodon-profile--my-profile)
- ("K" "View bookmarks" mastodon-profile--view-bookmarks))
+ ("O" "Jump to your profile" mastodon-profile--my-profile)
+ ("U" "Update your profile note" mastodon-profile--update-user-profile-note)
+ ("K" "View bookmarks" mastodon-profile--view-bookmarks)
+ ("V" "View favourites" mastodon-profile--view-favourites)
+ ("R" "View follow requests" mastodon-profile--view-follow-requests)
+ ("G" "View follow suggestions" mastodon-tl--get-follow-suggestions)
+ ("I" "View filters" mastodon-tl--view-filters))
("Users"
("W" "Follow" mastodon-tl--follow-user)
("C-S-W" "Unfollow" mastodon-tl--unfollow-user)
@@ -89,16 +100,10 @@
("-" "zoom out" 'image-decrease-size)
("u" "copy URL" 'shr-maybe-probe-and-copy-url))
("Profile view"
- ("g" "Show following" mastodon-profile--open-following)
- ("s" "Show followers" mastodon-profile--open-followers)
- ("C-c C-c" "Cycle profile views" mastodon-profile-account-view-cycle)
- ("R" "View follow requests" mastodon-profile--view-follow-requests)
- ("a" "Accept follow request" mastodon-profile--follow-request-accept)
- ("j" "Reject follow request" mastodon-profile--follow-request-reject)
- ("U" "Update your profile note" mastodon-profile--update-user-profile-note))
+ ("C-c C-c" "Cycle profile views" mastodon-profile-account-view-cycle))
("Quit"
("q" "Quit mastodon and bury buffer." kill-this-buffer)
("Q" "Quit mastodon buffer and kill window." kill-buffer-and-window)))))))
-(provide 'mastodon-discover)
+ (provide 'mastodon-discover)
;;; mastodon-discover.el ends here
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 4e8fbdb..7c5d40b 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -52,7 +52,6 @@
(autoload 'mastodon-tl--reload-timeline-or-profile "mastodon-tl")
(defvar mastodon-tl--buffer-spec)
(defvar mastodon-tl--display-media-p)
-(defvar mastodon-tl--buffer-spec)
(defvar mastodon-notifications--types-alist
'(("mention" . mastodon-notifications--mention)
@@ -87,7 +86,6 @@
With no argument, the request is accepted. Argument REJECT means
reject the request. Can be called in notifications view or in
follow-requests view."
- (interactive)
(if (not (mastodon-tl--find-property-range 'toot-json (point)))
(message "No follow request at point?")
(let* ((toot-json (mastodon-tl--property 'toot-json))
@@ -269,19 +267,20 @@ of the toot responded to."
"notifications"
'mastodon-notifications--timeline))
-(defun mastodon-notifications-clear ()
+(defun mastodon-notifications--clear-all ()
"Clear all notifications."
(interactive)
- (let ((response
- (mastodon-http--post (mastodon-http--api "notifications/clear")
- nil nil)))
- (mastodon-http--triage
- response (lambda ()
- (when mastodon-tl--buffer-spec
- (mastodon-tl--reload-timeline-or-profile))
- (message "All notifications cleared!")))))
-
-(defun mastodon-notifications-clear-current-notif ()
+ (when (y-or-n-p "Clear all notifications?")
+ (let ((response
+ (mastodon-http--post (mastodon-http--api "notifications/clear")
+ nil nil)))
+ (mastodon-http--triage
+ response (lambda ()
+ (when mastodon-tl--buffer-spec
+ (mastodon-tl--reload-timeline-or-profile))
+ (message "All notifications cleared!"))))))
+
+(defun mastodon-notifications--clear-current ()
"Dismiss the notification at point."
(interactive)
(let* ((id (or (mastodon-tl--property 'toot-id)
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 56e5fef..63c062b 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -82,8 +82,11 @@
(defvar mastodon-profile-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map (kbd "s") #'mastodon-profile--open-followers)
- (define-key map (kbd "g") #'mastodon-profile--open-following)
+ ;; conflicts with `s' keybinding to translate toot at point
+ ;; seeing as we now have the C-c C-c cycle functionality,
+ ;; maybe we can retire both of these awful bindings
+ ;; (define-key map (kbd "s") #'mastodon-profile--open-followers)
+ ;; (define-key map (kbd "g") #'mastodon-profile--open-following)
(define-key map (kbd "C-c C-c") #'mastodon-profile-account-view-cycle)
map)
"Keymap for `mastodon-profile-mode'.")
@@ -91,7 +94,10 @@
(defvar mastodon-profile--view-follow-requests-keymap
(let ((map ;(make-sparse-keymap)))
(copy-keymap mastodon-mode-map)))
- (define-key map (kbd "r") #'mastodon-notifications--follow-request-reject)
+ ;; make reject binding match the binding in notifs view
+ ;; 'r' is then reserved for replying, even tho it is not avail
+ ;; in foll-reqs view
+ (define-key map (kbd "j") #'mastodon-notifications--follow-request-reject)
(define-key map (kbd "a") #'mastodon-notifications--follow-request-accept)
(define-key map (kbd "n") #'mastodon-tl--goto-next-item)
(define-key map (kbd "p") #'mastodon-tl--goto-prev-item)
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))