aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-toot.el24
-rw-r--r--lisp/mastodon.el2
2 files changed, 13 insertions, 13 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 41b69cc..6345e14 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -62,11 +62,19 @@ Remove MARKER if RM is non-nil."
(let ((response (mastodon-http--post url nil nil)))
(mastodon-http--triage response callback))))
-(defun mastodon-toot--toggle-favourite ()
- "Favourite/unfavourite toot based on current state.
+(defun mastodon-toot--toggle-boost ()
+ "Boost/unboost toot at `point'."
+ (interactive)
+ (let* ((id (mastodon-tl--property 'toot-id))
+ (boosted (get-text-property (point) 'boosted-p))
+ (action (if boosted "unreblog" "reblog"))
+ (msg (if boosted "unboosted" "boosted"))
+ (remove (when boosted t)))
+ (mastodon-toot--action action (lambda () (mastodon-toot--action-success "B" remove)))
+ (message (format "%s #%s" msg id))))
-If FAVED is nil, favourite the toot.
-If FAVED is non-nil, unfavourite the toot."
+(defun mastodon-toot--toggle-favourite ()
+ "Favourite/unfavourite toot at `point'."
(interactive)
(let* ((id (mastodon-tl--property 'toot-id))
(faved (get-text-property (point) 'favourited-p))
@@ -107,14 +115,6 @@ Set `mastodon-toot--content-warning' to nil."
(mastodon-http--triage response
(lambda () (message "Toot toot!")))))))
-(defun mastodon-toot--boost ()
- "Boost toot at `point'."
- (interactive)
- (let ((callback (lambda () (mastodon-toot--action-success "B")))
- (id (mastodon-tl--property 'toot-id)))
- (mastodon-toot--action "reblog" callback)
- (message (format "Boosted #%s" id))))
-
(defun mastodon-toot--reply ()
"Reply to toot at `point'."
(interactive)
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index ea55559..2926d08 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -99,7 +99,7 @@ If REPLY-TO-ID is non-nil, attach new toot to a conversation."
"Major mode for Mastodon, the federated microblogging network."
:group 'mastodon
(let ((map mastodon-mode-map))
- (define-key map (kbd "b") #'mastodon-toot--boost)
+ (define-key map (kbd "b") #'mastodon-toot--toggle-boost)
(define-key map (kbd "f") #'mastodon-toot--toggle-favourite)
(define-key map (kbd "F") #'mastodon-tl--get-federated-timeline)
(define-key map (kbd "H") #'mastodon-tl--get-home-timeline)