diff options
author | jao <jao@gnu.org> | 2021-04-22 05:23:02 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-04-22 05:23:02 +0100 |
commit | 2a7e8c00d8a9fb3c4eb29c19a35ab98943c1f142 (patch) | |
tree | d7ffefd17aa60f06c456ad7fd8e4f080680930b8 | |
parent | 183b6a6573ba2368df1352b88ef5bb33858007f5 (diff) | |
download | elibs-2a7e8c00d8a9fb3c4eb29c19a35ab98943c1f142.tar.gz elibs-2a7e8c00d8a9fb3c4eb29c19a35ab98943c1f142.tar.bz2 |
eww: choosing a better next buffer when closing current page
-rw-r--r-- | eww.org | 6 | ||||
-rw-r--r-- | lib/net/jao-eww-session.el | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -88,9 +88,9 @@ (interactive nil eww-mode) (when-let (current (eww-current-url)) (add-to-list 'jao-eww--closed-urls current)) - (kill-current-buffer) - (when-let (b (car (jao-eww-session--list-buffers))) - (switch-to-buffer b))) + (let ((nxt (car (jao-eww-session-invisible-buffers)))) + (kill-current-buffer) + (when nxt (switch-to-buffer nxt nil t)))) (defun jao-eww-reopen (arg) (interactive "P") diff --git a/lib/net/jao-eww-session.el b/lib/net/jao-eww-session.el index b0dfc46..c9e8a35 100644 --- a/lib/net/jao-eww-session.el +++ b/lib/net/jao-eww-session.el @@ -92,6 +92,10 @@ the session is already displayed in a eww tab, jao-eww-session can: (with-current-buffer b (derived-mode-p 'eww-mode)))) (buffer-list))) +(defun jao-eww-session-invisible-buffers () + (seq-filter (lambda (b) (null (get-buffer-window b))) + (jao-eww-session--list-buffers (current-buffer)))) + (defun jao-eww--current-url () (when-let (url (eww-current-url)) (url-encode-url url))) |