diff options
| author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-29 16:25:08 +0100 | 
|---|---|---|
| committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-29 16:25:08 +0100 | 
| commit | 9f5ebd694be8033b3ea79b6e6f56ec777bbdfb80 (patch) | |
| tree | 4ad4cf93aff1d813c8d29eb2685068dc67aef20d | |
| parent | 24fec2f262123264c2b84d4f9c902b477b731bbb (diff) | |
make rescheduling without editing work, also with org-read-date
| -rw-r--r-- | lisp/mastodon-tl.el | 1 | ||||
| -rw-r--r-- | lisp/mastodon-toot.el | 16 | 
2 files changed, 12 insertions, 5 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 6971673..f28c7c5 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1859,6 +1859,7 @@ If ID, just return that toot."  (defun mastodon-tl--reschedule-toot ()    "Reschedule the scheduled toot at point." +  (interactive)    (mastodon-toot--schedule-toot :reschedule))  (defun mastodon-tl--view-scheduled-toots () diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 17b57ed..87b1b77 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1160,14 +1160,20 @@ Return its two letter ISO 639 1 code."  (defun mastodon-toot--schedule-toot (&optional reschedule)    "Read a date (+ time) in the minibuffer and schedule the current toot. -With RESCHEDULE, reschedule the scheduled toot at point." +With RESCHEDULE, reschedule the scheduled toot at point without editing."    (interactive)    (let* ((id (when reschedule (get-text-property (point) 'id))) -         ;; TODO if reschedule, set org-read-date to scheduled time +         (ts (when reschedule +               (alist-get 'scheduled_at +                          (get-text-property (point) 'scheduled-json))))           (time-value            (org-read-date t t nil "Schedule toot:"                           ;; default to scheduled timestamp if already set: -                         (mastodon-toot--iso-to-org mastodon-toot--scheduled-for))) +                         (mastodon-toot--iso-to-org +                          ;; we are rescheduling without editing: +                          (or ts +                              ;; we are maybe editing the scheduled toot: +                              mastodon-toot--scheduled-for))))           (iso8601-str (format-time-string "%FT%T%z" time-value))           (msg-str (format-time-string "%d-%m-%y at %H:%M[%z]" time-value)))      (if (not reschedule) @@ -1193,8 +1199,8 @@ With RESCHEDULE, reschedule the scheduled toot at point."  (defun mastodon-toot--iso-to-org (ts)    "Convert ISO8601 timestamp TS to something `org-read-date' can handle." -  (let* ((decoded (iso8601-parse ts))) -    (encode-time decoded))) +  (when ts (let* ((decoded (iso8601-parse ts))) +             (encode-time decoded))))  ;; we'll need to revisit this if the binds get  ;; more diverse than two-chord bindings  | 
