Skip to content

Commit

Permalink
Add a new Gnus command to toggle whether to use fonts in shr
Browse files Browse the repository at this point in the history
* doc/misc/gnus.texi (Article Washing): Document it.

* lisp/gnus/gnus-art.el (gnus-article-toggle-fonts): New command
and key binding (bug#50383).
  • Loading branch information
abochannek authored and larsmagne committed Sep 7, 2021
1 parent f10a4aa commit 6b2d5ad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/misc/gnus.texi
Expand Up @@ -9374,6 +9374,12 @@ Use html2text---a simple @acronym{HTML} converter included with Gnus.

@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 article buffer.

@item W b
@kindex W b @r{(Summary)}
@findex gnus-article-add-buttons
Expand Down
8 changes: 8 additions & 0 deletions lisp/gnus/gnus-art.el
Expand Up @@ -2243,6 +2243,14 @@ This only works if the article in question is HTML."
(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
(when (eq mm-text-html-renderer 'shr)
(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)
Expand Down
2 changes: 2 additions & 0 deletions lisp/gnus/gnus-sum.el
Expand Up @@ -2252,6 +2252,7 @@ increase the score of each group you read."
"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
Expand Down Expand Up @@ -2561,6 +2562,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
["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]
Expand Down

0 comments on commit 6b2d5ad

Please sign in to comment.