From: "Sebastián Monía" <sebastian@sebasmonia.com>
To: emacs-devel@gnu.org
Subject: [PATCH] EWW - use revert--buffer-function to reload, and allow reload in eww-list-buffer
Date: Fri, 16 Aug 2024 13:28:54 -0400 [thread overview]
Message-ID: <thqnr0aoz8a1.fsf@sebasmonia.com> (raw)
---
Small quality of life change in EWW. I was interested in reverting the
buffer list, then I found the "FIXME" note about reverting in
eww-mode, and figured, why not :)
I didn't want to alter eww-reload (since it is part of the public API)
hence the new function for reverting that just calls it.
Thank you,
Seb
lisp/net/eww.el | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index b2e1c5a72e5..c0ab8761997 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1193,7 +1193,6 @@ This consults the entries in `eww-readable-urls' (which see)."
(throw 'found result))))))
(defvar-keymap eww-mode-map
- "g" #'eww-reload ;FIXME: revert-buffer-function instead!
"G" #'eww
"M-RET" #'eww-open-in-new-buffer
"TAB" #'shr-next-link
@@ -1331,6 +1330,7 @@ within text input fields."
(add-hook 'context-menu-functions 'eww-context-menu 5 t)
(setq-local eww-history nil)
(setq-local eww-history-position 0)
+ (setq-local revert-buffer-function #'eww--revert-function)
(when (boundp 'tool-bar-map)
(setq-local tool-bar-map eww-tool-bar-map))
;; desktop support
@@ -1529,6 +1529,13 @@ just re-display the HTML already fetched."
(eww-retrieve url #'eww-render
(list url (point) (current-buffer) encode))))))))
+(defun eww--revert-function (local _noconfirm)
+ "Revert function for EWW buffers.
+LOCAL works like in `eww-reload': when non-nil, reload the page from the
+network instead of the HTML already retrieved. It is the prefix arg."
+ (eww-reload local)
+ (message "Page reloaded."))
+
;; Form support.
(defvar eww-form nil)
@@ -2601,8 +2608,10 @@ see)."
;;; eww buffers list
-(defun eww-list-buffers ()
- "Enlist eww buffers."
+(defun eww-list-buffers (&optional _ignore-auto _noconfirm)
+ "Pop a buffer with a list of eww buffers.
+Optional arguments make this function compatible with the
+`revert-buffer-function' interface."
(interactive)
(let (buffers-info
(current (current-buffer)))
@@ -2621,6 +2630,7 @@ see)."
(domain-length 0)
(title-length 0)
url title format start)
+ (setq-local revert-buffer-function #'eww-list-buffers)
(erase-buffer)
(dolist (buffer-info buffers-info)
(setq title-length (max title-length
--
2.45.2.windows.1
--
Sebastián Monía
https://site.sebasmonia.com/
next reply other threads:[~2024-08-16 17:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 17:28 Sebastián Monía [this message]
2024-08-16 17:48 ` [PATCH] EWW - use revert--buffer-function to reload, and allow reload in eww-list-buffer Eli Zaretskii
2024-08-16 18:55 ` Sebastián Monía
2024-08-17 12:35 ` Sebastián Monía
2024-08-24 8:42 ` Eli Zaretskii
2024-08-24 17:27 ` Jim Porter
2024-08-30 20:01 ` Sebastián Monía
2024-09-14 7:32 ` Eli Zaretskii
[not found] ` <thqnjzf7s74l.fsf@sebasmonia.com>
2024-09-20 6:18 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=thqnr0aoz8a1.fsf@sebasmonia.com \
--to=sebastian@sebasmonia.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.