From 20b41bfa9512cc643c23b8e3d8062c8bebf0be79 Mon Sep 17 00:00:00 2001 From: Björn Bidar Date: Thu, 5 Oct 2023 21:24:08 +0300 Subject: Avoid error when there's only one window in a frame when closing window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use `(quit-window 'kill)` instead of `(kill-buffer-and-window)` to avoid error when there's only one window instead the frame: `kill-buffer-and-window: Attempt to delete minibuffer or sole ordinary window` Signed-off-by: Björn Bidar --- lisp/mastodon-toot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-toot.el') diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index c96ee5b..c26db1e 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -64,6 +64,7 @@ (autoload 'mastodon-http--put "mastodon-http") (autoload 'mastodon-http--read-file-as-string "mastodon-http") (autoload 'mastodon-http--triage "mastodon-http") +(autoload 'mastodon-kill-window "mastodon") (autoload 'mastodon-profile--fetch-server-account-settings "mastodon-profile") (autoload 'mastodon-profile--fetch-server-account-settings-maybe "mastodon-profile") (autoload 'mastodon-profile--get-source-pref "mastodon-profile") @@ -682,7 +683,7 @@ CANCEL means the toot was not sent, so we save the toot text as a draft." mastodon-toot-draft-toots-list :test 'equal))) ;; prevent some weird bug when cancelling a non-empty toot: (delete #'mastodon-toot--save-toot-text after-change-functions) - (kill-buffer-and-window) + (quit-window 'kill) (mastodon-toot--restore-previous-window-config prev-window-config))) (defun mastodon-toot--cancel () -- cgit v1.2.3