From 9f5b56b4003f4ff5b2c3e6183de228d22c94574c Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 17 Dec 2021 19:18:46 +0100 Subject: y-or-n-p before cancelling a toot. --- lisp/mastodon-toot.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-toot.el') diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index e813b33..230f7d2 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -359,7 +359,13 @@ Remove MARKER if REMOVE is non-nil, otherwise add it." (defun mastodon-toot--cancel () "Kill new-toot buffer/window. Does not POST content to Mastodon." (interactive) - (mastodon-toot--kill)) + (let* ((toot (mastodon-toot--remove-docs)) + (empty-toot-p (and (not mastodon-toot--media-attachments) + (string= "" (mastodon-tl--clean-tabs-and-nl toot))))) + (if empty-toot-p + (mastodon-toot--kill) + (when (y-or-n-p "Discard draft toot? ") + (mastodon-toot--kill))))) (defalias 'mastodon-toot--insert-emoji 'emojify-insert-emoji -- cgit v1.2.3