diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-16 10:55:06 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-01-16 10:55:06 +0100 |
commit | 098f8b1e73e10801c55d4c470906bca6edd75251 (patch) | |
tree | ce02abbc4816c29737750f1679ca618686bd3e35 /lisp | |
parent | 1d3f82da36a8734e5489662fc8b4a4de0de811bb (diff) |
differentiate edit toot from new toot
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 5 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 12 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index dd17988..931fa0b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1417,7 +1417,10 @@ Should work in all mastodon buffers." (let ((endpoint-fun (mastodon-tl--get-endpoint nil :no-error)) (buffer-name-fun (mastodon-tl--buffer-name nil :no-error))) (cond (mastodon-toot-mode - 'compose-toot) + ;; composing/editing: + (if (string= "*edit toot*" (buffer-name)) + 'edit-toot + 'new-toot)) ;; main timelines: ((string= "timelines/home" endpoint-fun) 'home) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 2241805..0d4f9e2 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -793,9 +793,9 @@ instance to edit a toot." (toot-language (alist-get 'language toot)) (reply-id (alist-get 'in_reply_to_id toot))) (when (y-or-n-p "Edit this toot? ") - (mastodon-toot--compose-buffer) + (mastodon-toot--compose-buffer nil reply-id nil content :edit) (goto-char (point-max)) - (insert content) + ;; (insert content) ;; adopt reply-to-id, visibility, CW, and language: (mastodon-toot--set-toot-properties reply-id toot-visibility source-cw toot-language) @@ -1543,15 +1543,17 @@ Added to `after-change-functions'." ;; NB: now that we have toot drafts, to ensure offline composing remains ;; possible, avoid any direct requests here: (defun mastodon-toot--compose-buffer (&optional reply-to-user - reply-to-id reply-json initial-text) + reply-to-id reply-json initial-text + edit) "Create a new buffer to capture text for a new toot. If REPLY-TO-USER is provided, inject their handle into the message. If REPLY-TO-ID is provided, set the `mastodon-toot--reply-to-id' var. REPLY-JSON is the full JSON of the toot being replied to. INITIAL-TEXT is used by `mastodon-toot-insert-draft-toot' to add a draft into the buffer." - (let* ((buffer-exists (get-buffer "*new toot*")) - (buffer (or buffer-exists (get-buffer-create "*new toot*"))) + (let* ((buffer-name (if edit "*edit toot*" "*new toot*")) + (buffer-exists (get-buffer buffer-name)) + (buffer (or buffer-exists (get-buffer-create buffer-name))) (inhibit-read-only t) (reply-text (alist-get 'content reply-json)) (previous-window-config (list (current-window-configuration) |