From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Sep 2021 20:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 50383@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163078889913729 (code B ref -1); Sat, 04 Sep 2021 20:55:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Sep 2021 20:54:59 +0000 Received: from localhost ([127.0.0.1]:48774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMcgl-0003ZN-2E for submit@debbugs.gnu.org; Sat, 04 Sep 2021 16:54:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:46880) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMcgj-0003ZF-9Q for submit@debbugs.gnu.org; Sat, 04 Sep 2021 16:54:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMcgi-0007dv-2W for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 16:54:57 -0400 Received: from ns.lapseofthought.com ([50.0.39.240]:16239 helo=mail.lapseofthought.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMcgf-0006iG-SJ for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 16:54:55 -0400 Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:f111:3eba:d111:b279]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4H26N86gRrz3pk93 for ; Sat, 4 Sep 2021 13:54:16 -0700 (PDT) From: Alex Bochannek Date: Sat, 04 Sep 2021 13:54:16 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Authentication-Results: ORIGINATING; auth=pass smtp.auth=alex smtp.mailfrom=alex@bochannek.com Received-SPF: pass client-ip=50.0.39.240; envelope-from=alex@bochannek.com; helo=mail.lapseofthought.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Hello! A while back I turned off `shr-use-fonts' for my HTML email but found that occasionally proportional fonts are useful when reading my messages. I am proposing the below `gnus-article-toggle-fonts' function with a keybinding of `W D F'. New Gnus article washing option to toggle HTML fonts * lisp/gnus/gnus-sum.el (gnus-summary-wash-display-map): (gnus-summary-make-menu-bar): Add mode mapping and menu item for article HTML font toggle. * lisp/gnus/gnus-art.el (gnus-article-toggle-fonts): Toggle shr-use-fonts and redisplay message. * doc/misc/gnus.texi (Article Washing): Document new HTML font toggle function. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 5f3fba00df..c8aec4eea1 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -9374,6 +9374,12 @@ Article Washing @end table +@item W D F +@kindex W D F @r{(Summary)} +@findex gnus-article-toggle-fonts +Toggle proportional fonts for @acronym{HTML} articles. This temporarily +changes the @code{shr-use-fonts} variable in the current buffer. + @item W b @kindex W b @r{(Summary)} @findex gnus-article-add-buttons diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 3c1403e155..7f48191085 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2243,6 +2243,19 @@ gnus-article-show-images (funcall function (get-text-property start 'image-url) start end))))))) +(defun gnus-article-toggle-fonts () + "Toggle the use of proportional fonts for HTML articles." + (interactive nil gnus-article-mode gnus-summary-mode) + (gnus-with-article-buffer + (if (eq mm-text-html-renderer 'shr) + (progn + (if (not (local-variable-p 'gnus-article-shr-use-fonts)) + (setq-local gnus-article-shr-use-fonts shr-use-fonts)) + (setq-local gnus-article-shr-use-fonts + (not gnus-article-shr-use-fonts)) + (let ((shr-use-fonts gnus-article-shr-use-fonts)) + (gnus-summary-show-article)))))) + (defun gnus-article-treat-fold-newsgroups () "Fold the Newsgroups and Followup-To message headers." (interactive nil gnus-article-mode gnus-summary-mode) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 856e95c0ba..c28e38e315 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -2252,6 +2252,7 @@ gnus-summary-mode-map "s" gnus-treat-smiley "D" gnus-article-remove-images "W" gnus-article-show-images + "F" gnus-article-toggle-fonts "f" gnus-treat-from-picon "m" gnus-treat-mail-picon "n" gnus-treat-newsgroups-picon @@ -2561,6 +2562,7 @@ gnus-summary-make-menu-bar ["Unfold headers" gnus-article-treat-unfold-headers t] ["Fold newsgroups" gnus-article-treat-fold-newsgroups t] ["Html" gnus-article-wash-html t] + ["Toggle HTML fonts" gnus-article-toggle-fonts t] ["Unsplit URLs" gnus-article-unsplit-urls t] ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t] ["Decode HZ" gnus-article-decode-HZ t] --=-=-= Content-Type: text/plain -- Alex. --=-=-=-- From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Sep 2021 01:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 50383@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16308047444957 (code B ref -1); Sun, 05 Sep 2021 01:20:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Sep 2021 01:19:04 +0000 Received: from localhost ([127.0.0.1]:48887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMgoK-0001Ht-51 for submit@debbugs.gnu.org; Sat, 04 Sep 2021 21:19:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:38468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMgoI-0001Hl-D8 for submit@debbugs.gnu.org; Sat, 04 Sep 2021 21:19:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMgoI-0006Q4-8D for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 21:19:02 -0400 Received: from ns.lapseofthought.com ([50.0.39.240]:4673 helo=mail.lapseofthought.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMgoF-00018G-2d for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 21:19:01 -0400 Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:813d:dc4a:f81:84eb]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4H2DDx4y7Gz3pf6N for ; Sat, 4 Sep 2021 18:18:25 -0700 (PDT) From: Alex Bochannek References: Date: Sat, 04 Sep 2021 18:18:25 -0700 In-Reply-To: (Alex Bochannek's message of "Sat, 04 Sep 2021 13:54:16 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Authentication-Results: ORIGINATING; auth=pass smtp.auth=alex smtp.mailfrom=alex@bochannek.com Received-SPF: pass client-ip=50.0.39.240; envelope-from=alex@bochannek.com; helo=mail.lapseofthought.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Alex Bochannek writes: > Hello! > > A while back I turned off `shr-use-fonts' for my HTML email but found > that occasionally proportional fonts are useful when reading my > messages. > > I am proposing the below `gnus-article-toggle-fonts' function with a > keybinding of `W D F'. The patch did not keep the fonts toggled when selecting the next message or reloading the current one. I am proposing the below change. I am not sure how you feel about buffer-local Gnus variables in `mm-decode.el', so please let me know if an alternative approach would be better. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 82d1de25f3..5c5896446e 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1843,6 +1843,9 @@ mm-shr (buffer-string)))))) (shr-inhibit-images mm-html-inhibit-images) (shr-blocked-images mm-html-blocked-images) + (shr-use-fonts (if (local-variable-p 'gnus-article-shr-use-fonts) + gnus-article-shr-use-fonts + shr-use-fonts)) charset coding char document) (mm-with-part (or handle (setq handle (mm-dissect-buffer t))) (setq case-fold-search t) --=-=-= Content-Type: text/plain -- Alex. --=-=-=-- From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Sep 2021 10:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alex Bochannek Cc: 50383@debbugs.gnu.org Received: via spool by 50383-submit@debbugs.gnu.org id=B50383.163083639124826 (code B ref 50383); Sun, 05 Sep 2021 10:07:02 +0000 Received: (at 50383) by debbugs.gnu.org; 5 Sep 2021 10:06:31 +0000 Received: from localhost ([127.0.0.1]:49299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMp2k-0006SM-Tk for submit@debbugs.gnu.org; Sun, 05 Sep 2021 06:06:31 -0400 Received: from quimby.gnus.org ([95.216.78.240]:50264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMp2j-0006S0-FM for 50383@debbugs.gnu.org; Sun, 05 Sep 2021 06:06:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=lCF7F8J7fcV2tc039YzTUtQyJ2aDVMw52QOgGXhXhZ8=; b=BGeAwWsLYnu1XzgkT35GYLXY5D 5+5xpkqvaPIl/TzTD5Mn6twXrkovSqTUxc9EcYGthp2xQpUOlKBqkOxCnaxrxlJRwwK/QcsDa4422 y5ikNf5+V+R9vZ2YIOl3trdKO74yLwYZih25hFEYdbXkylN9oaWIQEmSVKPqnqVlb6Gg=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMp2a-0004BO-B6; Sun, 05 Sep 2021 12:06:22 +0200 From: Lars Ingebrigtsen References: Date: Sun, 05 Sep 2021 12:06:19 +0200 In-Reply-To: (Alex Bochannek's message of "Sat, 04 Sep 2021 13:54:16 -0700") Message-ID: <87lf4bmj50.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alex Bochannek writes: > I am proposing the below `gnus-article-toggle-fonts' function with a > keybinding of `W D F'. Sounds good to me. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Alex Bochannek writes: > I am proposing the below `gnus-article-toggle-fonts' function with a > keybinding of `W D F'. Sounds good to me. [...] > + (setq-local gnus-article-shr-use-fonts > + (not gnus-article-shr-use-fonts)) [...] > The patch did not keep the fonts toggled when selecting the next message > or reloading the current one. I am proposing the below change. I am not > sure how you feel about buffer-local Gnus variables in `mm-decode.el', > so please let me know if an alternative approach would be better. Yeah, it would be best to avoid doing that. How about changing the patch to have a buffer-local `shr-use-fonts' in the Gnus article buffer and use that instead? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Sep 2021 05:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: 50383@debbugs.gnu.org Received: via spool by 50383-submit@debbugs.gnu.org id=B50383.163090576222869 (code B ref 50383); Mon, 06 Sep 2021 05:23:01 +0000 Received: (at 50383) by debbugs.gnu.org; 6 Sep 2021 05:22:42 +0000 Received: from localhost ([127.0.0.1]:51378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mN75e-0005wm-0h for submit@debbugs.gnu.org; Mon, 06 Sep 2021 01:22:42 -0400 Received: from ns.lapseofthought.com ([50.0.39.240]:7251 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mN75b-0005we-Vi for 50383@debbugs.gnu.org; Mon, 06 Sep 2021 01:22:40 -0400 Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:382f:21b3:eb32:b8c6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4H2xcD62yGz3pf6L; Sun, 5 Sep 2021 22:22:36 -0700 (PDT) From: Alex Bochannek References: <87lf4bmj50.fsf@gnus.org> Date: Sun, 05 Sep 2021 22:22:35 -0700 In-Reply-To: <87lf4bmj50.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 05 Sep 2021 12:06:19 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Authentication-Results: ORIGINATING; auth=pass smtp.auth=alex smtp.mailfrom=alex@bochannek.com X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> I am proposing the below `gnus-article-toggle-fonts' function with a >> keybinding of `W D F'. > > Sounds good to me. > > > [...] > >> + (setq-local gnus-article-shr-use-fonts >> + (not gnus-article-shr-use-fonts)) > > [...] > >> The patch did not keep the fonts toggled when selecting the next message >> or reloading the current one. I am proposing the below change. I am not >> sure how you feel about buffer-local Gnus variables in `mm-decode.el', >> so please let me know if an alternative approach would be better. > > Yeah, it would be best to avoid doing that. How about changing the > patch to have a buffer-local `shr-use-fonts' in the Gnus article buffer > and use that instead? Just like this then? --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 3c1403e155..05d0be8ca2 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2243,6 +2243,15 @@ gnus-article-show-images (funcall function (get-text-property start 'image-url) start end))))))) +(defun gnus-article-toggle-fonts () + "Toggle the use of proportional fonts for HTML articles." + (interactive nil gnus-article-mode gnus-summary-mode) + (gnus-with-article-buffer + (if (eq mm-text-html-renderer 'shr) + (progn + (setq-local shr-use-fonts (not shr-use-fonts)) + (gnus-summary-show-article))))) + (defun gnus-article-treat-fold-newsgroups () "Fold the Newsgroups and Followup-To message headers." (interactive nil gnus-article-mode gnus-summary-mode) @@ -4494,6 +4503,8 @@ gnus-article-mode (setq-local nobreak-char-display nil) ;; Enable `gnus-article-remove-images' to delete images shr.el renders. (setq-local shr-put-image-function #'gnus-shr-put-image) + ;; Shadow global shr-use-fonts to support font toggling. + (setq-local shr-use-fonts shr-use-fonts) (unless gnus-article-show-cursor (setq cursor-in-non-selected-windows nil)) (gnus-set-default-directory) --=-=-= Content-Type: text/plain -- Alex. --=-=-=-- From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Sep 2021 08:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alex Bochannek Cc: 50383@debbugs.gnu.org Received: via spool by 50383-submit@debbugs.gnu.org id=B50383.163091731811288 (code B ref 50383); Mon, 06 Sep 2021 08:36:02 +0000 Received: (at 50383) by debbugs.gnu.org; 6 Sep 2021 08:35:18 +0000 Received: from localhost ([127.0.0.1]:51712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNA61-0002vz-Ns for submit@debbugs.gnu.org; Mon, 06 Sep 2021 04:35:17 -0400 Received: from quimby.gnus.org ([95.216.78.240]:33092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNA5z-0002vi-PR for 50383@debbugs.gnu.org; Mon, 06 Sep 2021 04:35:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GzJ6VWnQPRbDH9YSZmqmTZ5+aUKOK+/XAdffWaj6dzk=; b=LdwWC21vFkYO0sk4sq0ppTsi/V H5JZavCvR2fzi3+D8R9gq0mztDCLzd83eX0sCO+J3/IzY9/slOWkE3dVbtDSlmmLfpl2uGGMFNRsE 9gh95QRv/KKrT2bfQyxGq/x+KHZjElKVDqpTKWNCqWX2+tvc9i8y3CzNRonnMBWdU4QE=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNA5q-0007vO-8R; Mon, 06 Sep 2021 10:35:08 +0200 From: Lars Ingebrigtsen References: <87lf4bmj50.fsf@gnus.org> Date: Mon, 06 Sep 2021 10:35:05 +0200 In-Reply-To: (Alex Bochannek's message of "Sun, 05 Sep 2021 22:22:35 -0700") Message-ID: <87wnnuje4m.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alex Bochannek writes: > Just like this then? Yup, if that does indeed work. :-) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Alex Bochannek writes: > Just like this then? Yup, if that does indeed work. :-) > + ;; Shadow global shr-use-fonts to support font toggling. > + (setq-local shr-use-fonts shr-use-fonts) But perhaps this should be set only if the user uses this command. Can you respin the entire patch and we'll get it applied... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Sep 2021 22:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: 50383@debbugs.gnu.org Received: via spool by 50383-submit@debbugs.gnu.org id=B50383.16309680924062 (code B ref 50383); Mon, 06 Sep 2021 22:42:02 +0000 Received: (at 50383) by debbugs.gnu.org; 6 Sep 2021 22:41:32 +0000 Received: from localhost ([127.0.0.1]:54692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNNIx-00013S-V3 for submit@debbugs.gnu.org; Mon, 06 Sep 2021 18:41:32 -0400 Received: from ns.lapseofthought.com ([50.0.39.240]:57085 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNNIv-00013J-Gs for 50383@debbugs.gnu.org; Mon, 06 Sep 2021 18:41:30 -0400 Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:255a:f50d:433e:2f16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4H3Nft2RK6z3pk8B; Mon, 6 Sep 2021 15:41:26 -0700 (PDT) From: Alex Bochannek References: <87lf4bmj50.fsf@gnus.org> <87wnnuje4m.fsf@gnus.org> Date: Mon, 06 Sep 2021 15:41:25 -0700 In-Reply-To: <87wnnuje4m.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 06 Sep 2021 10:35:05 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Authentication-Results: ORIGINATING; auth=pass smtp.auth=alex smtp.mailfrom=alex@bochannek.com X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> Just like this then? > > Yup, if that does indeed work. :-) > >> + ;; Shadow global shr-use-fonts to support font toggling. >> + (setq-local shr-use-fonts shr-use-fonts) > > But perhaps this should be set only if the user uses this command. Can > you respin the entire patch and we'll get it applied... I thought about it some more and I don't think it's necessary at all to initialize the local variable, because it will happen automatically the first time the command is used. The below should be enough. I tested it a bit and it works for me. New Gnus article washing function to toggle HTML fonts * lisp/gnus/gnus-sum.el (gnus-summary-wash-display-map), (gnus-summary-make-menu-bar): Add mode mapping and menu item for article HTML font toggle. * lisp/gnus/gnus-art.el (gnus-article-toggle-fonts): Toggle shr-use-fonts and redisplay message. * doc/misc/gnus.texi (Article Washing): Document new HTML font toggle function. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 5f3fba00df..c8aec4eea1 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -9374,6 +9374,12 @@ Article Washing @end table +@item W D F +@kindex W D F @r{(Summary)} +@findex gnus-article-toggle-fonts +Toggle proportional fonts for @acronym{HTML} articles. This temporarily +changes the @code{shr-use-fonts} variable in the current buffer. + @item W b @kindex W b @r{(Summary)} @findex gnus-article-add-buttons diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 3c1403e155..a962b06372 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2243,6 +2243,15 @@ gnus-article-show-images (funcall function (get-text-property start 'image-url) start end))))))) +(defun gnus-article-toggle-fonts () + "Toggle the use of proportional fonts for HTML articles." + (interactive nil gnus-article-mode gnus-summary-mode) + (gnus-with-article-buffer + (if (eq mm-text-html-renderer 'shr) + (progn + (setq-local shr-use-fonts (not shr-use-fonts)) + (gnus-summary-show-article))))) + (defun gnus-article-treat-fold-newsgroups () "Fold the Newsgroups and Followup-To message headers." (interactive nil gnus-article-mode gnus-summary-mode) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 856e95c0ba..c28e38e315 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -2252,6 +2252,7 @@ gnus-summary-mode-map "s" gnus-treat-smiley "D" gnus-article-remove-images "W" gnus-article-show-images + "F" gnus-article-toggle-fonts "f" gnus-treat-from-picon "m" gnus-treat-mail-picon "n" gnus-treat-newsgroups-picon @@ -2561,6 +2562,7 @@ gnus-summary-make-menu-bar ["Unfold headers" gnus-article-treat-unfold-headers t] ["Fold newsgroups" gnus-article-treat-fold-newsgroups t] ["Html" gnus-article-wash-html t] + ["Toggle HTML fonts" gnus-article-toggle-fonts t] ["Unsplit URLs" gnus-article-unsplit-urls t] ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t] ["Decode HZ" gnus-article-decode-HZ t] --=-=-= Content-Type: text/plain -- Alex. --=-=-=-- From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Sep 2021 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alex Bochannek Cc: 50383@debbugs.gnu.org Received: via spool by 50383-submit@debbugs.gnu.org id=B50383.163102762625143 (code B ref 50383); Tue, 07 Sep 2021 15:14:02 +0000 Received: (at 50383) by debbugs.gnu.org; 7 Sep 2021 15:13:46 +0000 Received: from localhost ([127.0.0.1]:57332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNcnC-0006XT-IY for submit@debbugs.gnu.org; Tue, 07 Sep 2021 11:13:46 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNcnA-0006X8-Rm for 50383@debbugs.gnu.org; Tue, 07 Sep 2021 11:13:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4gNbk3hK1KaS+EMFgoU2tmVuKaHb8L1K9s5JkNIRqMo=; b=kFCZ0ZOojN10BsTpINUAgLmyI8 TyT6fU2Wy4GBclv67CNoHRHQtAotcethWGi0uU239mnoEkvJG66eCVU+YHDnhkprLsyzblvBce6ti n75gcRAg0I5Sf0cBgmmwkmouZJqkUXiCYTYDkUWjru74AElc5RFFnVMxhclZqVBf+y7Q=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNcn2-00078p-2Z; Tue, 07 Sep 2021 17:13:38 +0200 From: Lars Ingebrigtsen References: <87lf4bmj50.fsf@gnus.org> <87wnnuje4m.fsf@gnus.org> Date: Tue, 07 Sep 2021 17:13:35 +0200 In-Reply-To: (Alex Bochannek's message of "Mon, 06 Sep 2021 15:41:25 -0700") Message-ID: <87r1e0ctb4.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alex Bochannek writes: > I thought about it some more and I don't think it's necessary at all to > initialize the local variable, because it will happen automatically the > first time the command is used. The below should b [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Alex Bochannek writes: > I thought about it some more and I don't think it's necessary at all to > initialize the local variable, because it will happen automatically the > first time the command is used. The below should be enough. I tested it > a bit and it works for me. Thanks, looks good to me, so I've pushed it to Emacs 28 (with a trivial change -- I morphed the `(if .. (progn' into a `when'). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 07 11:13:54 2021 Received: (at control) by debbugs.gnu.org; 7 Sep 2021 15:13:55 +0000 Received: from localhost ([127.0.0.1]:57335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNcnK-0006Xr-QA for submit@debbugs.gnu.org; Tue, 07 Sep 2021 11:13:54 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNcnI-0006Xb-So for control@debbugs.gnu.org; Tue, 07 Sep 2021 11:13:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MmSuVn6+AhPHunnbAJYkkYr9JkvKohhqzI6k4wPqH9Y=; b=BqDZu6BNgC+QmzLoaQsRa+qK8k nDfujajK6V+MuxxkcPI2JCXZt/2Ln4hYxYo6bIxJmBirYPY01br54MH9a6tprkHln7eQwr26phao2 RAyIymgrtgC7P5ZCzu8yghq/QkTm/uxQNn+yShLq1YUr1clSbYfhskJAYE7hufKEIHyQ=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNcnA-000793-CR for control@debbugs.gnu.org; Tue, 07 Sep 2021 17:13:46 +0200 Date: Tue, 07 Sep 2021 17:13:43 +0200 Message-Id: <87pmtkctaw.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #50383 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 50383 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 50383 28.1 quit From unknown Sat Jun 14 19:36:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#50383: 28.0.50; [PATCH] Feature suggestion, gnus-article-toggle-fonts to toggle fonts for HTML articles Resent-From: Alex Bochannek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Sep 2021 17:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: 50383@debbugs.gnu.org Received: via spool by 50383-submit@debbugs.gnu.org id=B50383.16310349646580 (code B ref 50383); Tue, 07 Sep 2021 17:17:01 +0000 Received: (at 50383) by debbugs.gnu.org; 7 Sep 2021 17:16:04 +0000 Received: from localhost ([127.0.0.1]:57535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNehY-0001i4-65 for submit@debbugs.gnu.org; Tue, 07 Sep 2021 13:16:04 -0400 Received: from ns.lapseofthought.com ([50.0.39.240]:54594 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNehV-0001hQ-CS for 50383@debbugs.gnu.org; Tue, 07 Sep 2021 13:16:02 -0400 Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:c15f:52eb:2de9:9978]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4H3sNs6Zg0z3pf7X; Tue, 7 Sep 2021 10:15:57 -0700 (PDT) From: Alex Bochannek References: <87lf4bmj50.fsf@gnus.org> <87wnnuje4m.fsf@gnus.org> <87r1e0ctb4.fsf@gnus.org> Date: Tue, 07 Sep 2021 10:15:57 -0700 In-Reply-To: <87r1e0ctb4.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 07 Sep 2021 17:13:35 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain Authentication-Results: ORIGINATING; auth=pass smtp.auth=alex smtp.mailfrom=alex@bochannek.com X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> I thought about it some more and I don't think it's necessary at all to >> initialize the local variable, because it will happen automatically the >> first time the command is used. The below should be enough. I tested it >> a bit and it works for me. > > Thanks, looks good to me, so I've pushed it to Emacs 28 (with a trivial > change -- I morphed the `(if .. (progn' into a `when'). Thanks! I keep forgetting that the `when' macro has an implicit `progn', which also reads nicer. -- Alex.