aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-09-10 16:17:23 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-09-10 16:17:23 +0200
commita6d005987d45d742bd6f605932fd71a911648308 (patch)
tree61aa8d4bf35ac21554a2f643ff56942ad0cd6d02 /lisp
parentda2f44fffda52b96323faa2a2ecfb44643883ffc (diff)
handle delete draft when no drafts
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-toot.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index f239d7b..7048996 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -1093,23 +1093,26 @@ Added to `after-change-functions' in new toot buffers."
(mastodon-toot--compose-buffer nil nil nil text)))
(unless (mastodon-toot-compose-buffer-p)
(mastodon-toot--compose-buffer))
- (message "No drafts available")))
+ (message "No drafts available.")))
(defun mastodon-toot-delete-draft-toot ()
"Prompt for a draft toot and delete it."
(interactive)
- (let ((draft (completing-read "Select draft to delete: "
- mastodon-toot-draft-toots-list
- nil t)))
- (setq mastodon-toot-draft-toots-list
- (cl-delete draft mastodon-toot-draft-toots-list
- :test 'equal))
- (message "Draft deleted!")))
+ (if mastodon-toot-draft-toots-list
+ (let ((draft (completing-read "Select draft to delete: "
+ mastodon-toot-draft-toots-list
+ nil t)))
+ (setq mastodon-toot-draft-toots-list
+ (cl-delete draft mastodon-toot-draft-toots-list
+ :test 'equal))
+ (message "Draft deleted!"))
+ (message "No drafts to delete.")))
(defun mastodon-toot-delete-all-drafts ()
"Delete all drafts."
(interactive)
- (setq mastodon-toot-draft-toots-list nil))
+ (setq mastodon-toot-draft-toots-list nil)
+ (message "All drafts deleted!"))
(defun mastodon-toot-compose-buffer-p ()
"Return t if compose buffer is current."