From 7fd6a014a7b7301c03a13e5561d92f9f7e6ca208 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 29 Nov 2022 15:47:22 +0100 Subject: add var scheduled-id, so we can cancel it if we reschedule --- lisp/mastodon-tl.el | 3 ++- lisp/mastodon-toot.el | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 70e882e..8ce2333 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1931,6 +1931,7 @@ NO-CONFIRM means don't ask, just do." "Edit scheduled status as new toot." (interactive) (let* ((toot (get-text-property (point) 'scheduled-json)) + (id (alist-get 'id toot)) (scheduled (alist-get 'scheduled_at toot)) (params (alist-get 'params toot)) (text (alist-get 'text params)) @@ -1945,7 +1946,7 @@ NO-CONFIRM means don't ask, just do." (insert text) ;; adopt properties from scheduled toot: (mastodon-toot--set-toot-properties reply-id visibility cw - scheduled lang))) + lang scheduled id))) ;;; FILTERS diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index d775727..2c5c523 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -184,6 +184,9 @@ change the setting on the server, see "An ISO 8601 timestamp that specifying when the post should be published. Should be at least 5 minutes into the future.") +(defvar-local mastodon-toot--scheduled-id nil + "The id of the scheduled post that we are now editing.") + (defvar-local mastodon-toot--reply-to-id nil "Buffer-local variable to hold the id of the toot being replied to.") @@ -526,16 +529,18 @@ REPLY-ID, TOOT-VISIBILITY, and TOOT-CW of deleted toot are preseved." (mastodon-toot--set-toot-properties reply-id toot-visibility toot-cw ;; TODO set new lang/scheduled props here - nil nil)))) + nil)))) -(defun mastodon-toot--set-toot-properties (reply-id visibility cw - scheduled lang) +(defun mastodon-toot--set-toot-properties (reply-id visibility cw lang + &optional scheduled + scheduled-id) "Set the toot properties for the current redrafted or edited toot. REPLY-ID, VISIBILITY, CW, SCHEDULED, and LANG are the properties to set." (when reply-id (setq mastodon-toot--reply-to-id reply-id)) (setq mastodon-toot--visibility visibility) (setq mastodon-toot--scheduled-for scheduled) + (setq mastodon-toot--scheduled-id scheduled-id) (when (not (string-empty-p lang)) (setq mastodon-toot--language lang)) (mastodon-toot--set-cw cw) -- cgit v1.2.3