diff options
author | Björn Bidar <bjorn.bidar@thaodan.de> | 2023-10-05 21:24:08 +0300 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2023-12-31 10:59:18 +0100 |
commit | 20b41bfa9512cc643c23b8e3d8062c8bebf0be79 (patch) | |
tree | 1586b2dab05f3c61983c7c3c703f611fdcd8bea2 /lisp/mastodon.el | |
parent | 3437dbbeeaa340e85ad1f2e9108469761c3e1aa6 (diff) |
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>
Diffstat (limited to 'lisp/mastodon.el')
-rw-r--r-- | lisp/mastodon.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el index acd1462..bac4d67 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) |