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-profile.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 0d93747..22dd586 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -50,6 +50,7 @@ (autoload 'mastodon-http--patch-json "mastodon-http") (autoload 'mastodon-http--post "mastodon-http.el") (autoload 'mastodon-http--triage "mastodon-http.el") +(autoload 'mastodon-kill-window "mastodon") (autoload 'mastodon-media--get-media-link-rendering "mastodon-media.el") (autoload 'mastodon-media--inline-images "mastodon-media.el") (autoload 'mastodon-mode "mastodon.el") @@ -294,7 +295,7 @@ NO-REBLOGS means do not display boosts in statuses." "Cancel updating user profile and kill buffer and window." (interactive) (when (y-or-n-p "Cancel updating your profile note?") - (kill-buffer-and-window))) + (mastodon-kill-window))) (defun mastodon-profile--note-remove-header () "Get the body of a toot from the current compose buffer." @@ -310,9 +311,9 @@ Ask for confirmation if length > 500 characters." (url (mastodon-http--api "accounts/update_credentials"))) (if (> (mastodon-toot--count-toot-chars note) 500) (when (y-or-n-p "Note is over mastodon's max for profile notes (500). Proceed?") - (kill-buffer-and-window) + (quit-window 'kill) (mastodon-profile--user-profile-send-updated-do url note)) - (kill-buffer-and-window) + (quit-window 'kill) (mastodon-profile--user-profile-send-updated-do url note)))) (defun mastodon-profile--user-profile-send-updated-do (url note) -- cgit v1.2.3