From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?iso-8859-1?Q?Sebasti=E1n_Mon=EDa?= Newsgroups: gmane.emacs.devel 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 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17893"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 16 19:43:02 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sf0ya-0004QC-RK for ged-emacs-devel@m.gmane-mx.org; Fri, 16 Aug 2024 19:43:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf0y1-0000Xn-E6; Fri, 16 Aug 2024 13:42:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sf0l1-0005VA-M1 for emacs-devel@gnu.org; Fri, 16 Aug 2024 13:28:59 -0400 Original-Received: from fout4-smtp.messagingengine.com ([103.168.172.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sf0kz-0001Qb-CB for emacs-devel@gnu.org; Fri, 16 Aug 2024 13:28:59 -0400 Original-Received: from phl-compute-02.internal (phl-compute-02.nyi.internal [10.202.2.42]) by mailfout.nyi.internal (Postfix) with ESMTP id A732C138FBA9 for ; Fri, 16 Aug 2024 13:28:54 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 16 Aug 2024 13:28:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sebasmonia.com; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm3; t=1723829334; x=1723915734; bh=u/ NH7qzPpgP0FfKv+mXnttKcu2fSSR3Mm+ubLswUb2k=; b=pNotPMKIjRS/s5wR+O lm00ueeJq5AykslExsKoOYeg+L1pFPW93H0N5FiPm/9CbLUwr9Zh4e5jNG/U8dzh Figf4wdBM0z02SyMcA17aqaHliY+xBFF3ooccgGKeQq1CkI7vdtaYXGFaPYfUK/e ssv9nVngxQCpGLX4AgqNZBcQqf2+3blt10C7r2Bj2MP+Gd0V23DedW7bqThXQX8o eesrk5OGcJjpfmIzB04oFX+Lv6Rxq8oySmm5uBlpue8xiG6DYneOTgKrPJpxPAmT wJ/SmThIpHJYTnNsC9ICm34cVgtDlLmNpMpbNO4wEDPwKwlhJV3xuPfbHOR4hKdy l8Ig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1723829334; x=1723915734; bh=u/NH7qzPpgP0FfKv+mXnttKcu2fS SR3Mm+ubLswUb2k=; b=R5Y6NH8nllNy5C00iFGrgL6z3SZKmsRiNm/NMRcWT8DB 7qJL+7/AUXTyPcwjIeN8Zpq8nQ2kJrK0irjGWIfLtximBmEKwdEU1zkCsTX+1ZU7 uUiZuudozfHolDVr8t1FIBZst2E5InpUG96fP5cZx9zGhFbUkwBxM819LzSAJO9n 6URvqlXsh4vibjrVTrvfdNm0L7X5jSrXNVfVPXTRu++dVueoBiSb7+CgLYmdEon0 4mv0/EDnjtgjaCuhlj8MedGen75V1/vUN5SuYWtsKBJwp+bAFv+HaskP0oV2JWtI naGtq8qDn3umNYcaq6DeqGqzYQd76h+GgB9hd6ZlOQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddtkedgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvuf ffkfgfgggtgfesthhqredttderudenucfhrhhomhepufgvsggrshhtihojnhcuofhonhov rgcuoehsvggsrghsthhirghnsehsvggsrghsmhhonhhirgdrtghomheqnecuggftrfgrth htvghrnhepgeduueevtdelffdtgfdvueejfedvudejudehjedviedtieettdeggfeujedt leeinecuffhomhgrihhnpehsvggsrghsmhhonhhirgdrtghomhenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvggsrghsthhirghnsehsvggs rghsmhhonhhirgdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepvghmrggtshdquggvvhgvlhesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: iab2c46da:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 16 Aug 2024 13:28:54 -0400 (EDT) Received-SPF: pass client-ip=103.168.172.147; envelope-from=sebastian@sebasmonia.com; helo=fout4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 16 Aug 2024 13:42:23 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322811 Archived-At: --- 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' (whi= ch see)." (throw 'found result)))))) =20 (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)))))))) =20 +(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. =20 (defvar eww-form nil) @@ -2601,8 +2608,10 @@ see)." =20 ;;; eww buffers list =20 -(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 --=20 2.45.2.windows.1 --=20 Sebasti=E1n Mon=EDa https://site.sebasmonia.com/