aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-toot.el9
-rw-r--r--lisp/mastodon.el2
2 files changed, 6 insertions, 5 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 2da6cec..104df1c 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -62,15 +62,16 @@ 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 (faved)
+(defun mastodon-toot--toggle-favourite ()
"Favourite/unfavourite toot based on current state.
If FAVED is nil, favourite the toot.
If FAVED is non-nil, unfavourite the toot."
(interactive)
- (let ((action (if faved "unfavourite" "favourite"))
- (remove (when faved t))
- (id (mastodon-tl--property 'toot-id)))
+ (let* ((id (mastodon-tl--property 'toot-id))
+ (faved (get-text-property (point) 'favourite-p))
+ (action (if faved "unfavourite" "favourite"))
+ (remove (when faved t)))
(mastodon-toot--action action (lambda () (mastodon-toot--action-success "F" remove)))
(message (format "%sd #%s" action id))))
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 5921e2a..ea55559 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -100,7 +100,7 @@ If REPLY-TO-ID is non-nil, attach new toot to a conversation."
:group 'mastodon
(let ((map mastodon-mode-map))
(define-key map (kbd "b") #'mastodon-toot--boost)
- (define-key map (kbd "f") #'mastodon-toot--favourite)
+ (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)
(define-key map (kbd "j") #'mastodon-tl--goto-next-toot)