[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon 20b41bfa95 32/45: Avoid error when there's only o
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon 20b41bfa95 32/45: Avoid error when there's only one window in a frame when closing window |
Date: |
Thu, 1 Feb 2024 10:01:00 -0500 (EST) |
branch: elpa/mastodon
commit 20b41bfa9512cc643c23b8e3d8062c8bebf0be79
Author: Björn Bidar <bjorn.bidar@thaodan.de>
Commit: marty hiatt <martianhiatus@riseup.net>
Avoid error when there's only one window in a frame when closing window
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 <bjorn.bidar@thaodan.de>
---
lisp/mastodon-discover.el | 4 +++-
lisp/mastodon-profile.el | 7 ++++---
lisp/mastodon-toot.el | 3 ++-
lisp/mastodon.el | 8 +++++++-
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el
index 5548b29650..715954f3f7 100644
--- a/lisp/mastodon-discover.el
+++ b/lisp/mastodon-discover.el
@@ -35,6 +35,8 @@
(declare-function discover-add-context-menu "discover")
+(autoload 'mastodon-kill-window "mastodon")
+
(defun mastodon-discover ()
"Plug Mastodon functionality into `discover'."
(interactive)
@@ -115,7 +117,7 @@
("C-c C-c" "Cycle profile views"
mastodon-profile--account-view-cycle))
("Quit"
("q" "Quit mastodon and bury buffer." kill-this-buffer)
- ("Q" "Quit mastodon buffer and kill window." kill-buffer-and-window)
+ ("Q" "Quit mastodon buffer and kill window." mastodon--kill-window)
("M-C-q" "Quit mastodon and kill all buffers."
mastodon-kill-all-buffers)))))))
(provide 'mastodon-discover)
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 0d93747577..22dd58601b 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)
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index c96ee5b533..c26db1e5aa 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 ()
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index acd1462d38..bac4d6759d 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -142,6 +142,12 @@ The default value \"%F %T\" prints ISO8601-style
YYYY-mm-dd HH:MM:SS.
Use. e.g. \"%c\" for your locale's date and time format."
:type 'string)
+
+(defun mastodon-kill-window ()
+ "Quit window and delete helper."
+ (interactive)
+ (quit-window 'kill))
+
(defvar mastodon-mode-map
(let ((map (make-sparse-keymap)))
;; navigation inside a timeline
@@ -169,7 +175,7 @@ Use. e.g. \"%c\" for your locale's date and time format."
(define-key map (kbd "/") #'mastodon-switch-to-buffer)
;; quitting mastodon
(define-key map (kbd "q") #'kill-current-buffer)
- (define-key map (kbd "Q") #'kill-buffer-and-window)
+ (define-key map (kbd "Q") #'mastodon-kill-window)
(define-key map (kbd "M-C-q") #'mastodon-kill-all-buffers)
;; toot actions
(define-key map (kbd "c") #'mastodon-tl--toggle-spoiler-text-in-toot)
- [nongnu] elpa/mastodon 1a4c9545ec 12/45: when active region on reply, insert quoted str in reply buffer, (continued)
- [nongnu] elpa/mastodon 1a4c9545ec 12/45: when active region on reply, insert quoted str in reply buffer, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 9451238519 18/45: start on emoji-capf for compose buffer, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 1385416479 30/45: add RET binding for tl--thread, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 136e4d387a 45/45: Merge branch 'develop', ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon fa73817c22 41/45: Add 'z' binding to bury the current buffer, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 3437dbbeea 31/45: add sensitive property to images, so we can blur them one day., ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 231b43a372 36/45: mastodon-tl--tag-timeline-tags defcustom, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon f5a19ad534 28/45: Merge pull request 'Use `equal' to access alist entries by `mastodon-instance-url'' (#516) from dme/mastodon.el:devel/dme into develop, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 638e5e09df 25/45: clean up emoji capf, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon f3cfd273f9 33/45: mastodon--kill-window in toot-tests.el, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 20b41bfa95 32/45: Avoid error when there's only one window in a frame when closing window,
ELPA Syncer <=
- [nongnu] elpa/mastodon 38f9437ad9 37/45: preserve media when editing scheduled toot, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon b8dd95b4c9 43/45: dir-locals: Set indent-tab-mode to nil, ELPA Syncer, 2024/02/01