aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-toot.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index d571b6e..022cbec 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -365,6 +365,12 @@ NO-REDRAFT means delete toot only."
toot-visibility
toot-cw)))))))))
+(defun mastodon-toot-set-cw (cw)
+ "Set content warning to CW if it is non-nil"
+ (unless (equal cw "")
+ (setq mastodon-toot--content-warning t)
+ (setq mastodon-toot--content-warning-from-reply-or-redraft cw)))
+
(defun mastodon-toot--redraft (response &optional reply-id toot-visibility toot-cw)
"Opens a new toot compose buffer using values from RESPONSE buffer.
REPLY-ID, TOOT-VISIBILITY, and TOOT-CW of deleted toot are preseved."
@@ -378,9 +384,7 @@ REPLY-ID, TOOT-VISIBILITY, and TOOT-CW of deleted toot are preseved."
(when reply-id
(setq mastodon-toot--reply-to-id reply-id))
(setq mastodon-toot--visibility toot-visibility)
- (when (not (equal toot-cw ""))
- (setq mastodon-toot--content-warning t)
- (setq mastodon-toot--content-warning-from-reply-or-redraft toot-cw))
+ (mastodon-toot-set-cw toot-cw)
(mastodon-toot--update-status-fields))))
(defun mastodon-toot--bookmark-toot-toggle ()
@@ -885,12 +889,10 @@ REPLY-JSON is the full JSON of the toot being replied to."
(when reply-to-user
(insert (format "%s " reply-to-user))
(setq mastodon-toot--reply-to-id reply-to-id)
- (if (not (equal mastodon-toot--visibility
- reply-visibility))
- (setq mastodon-toot--visibility reply-visibility))
- (when (not (equal reply-cw ""))
- (setq mastodon-toot--content-warning t)
- (setq mastodon-toot--content-warning-from-reply-or-redraft reply-cw)))))
+ (unless (equal mastodon-toot--visibility
+ reply-visibility)
+ (setq mastodon-toot--visibility reply-visibility))
+ (mastodon-toot-set-cw reply-cw))))
(defun mastodon-toot--update-status-fields (&rest _args)
"Update the status fields in the header based on the current state."
@@ -940,7 +942,7 @@ REPLY-JSON is the full JSON of the toot being replied to."
(switch-to-buffer-other-window buffer)
(text-mode)
(mastodon-toot-mode t)
- (when (not buffer-exists)
+ (unless buffer-exists
(mastodon-toot--display-docs-and-status-fields)
(mastodon-toot--setup-as-reply reply-to-user reply-to-id reply-json))
(unless mastodon-toot--max-toot-chars