Commit 9dc28e1f authored by Ralph Schleicher's avatar Ralph Schleicher Committed by Lars Ingebrigtsen
Browse files

Add command in eww to toggle images

* lisp/net/eww.el (eww-toggle-images): New function.
(eww-mode-map): Add key binding and menu entry.
* lisp/net/shr.el (shr-inhibit-images): Make it customizable.
* doc/misc/eww.texi (Basics): Document eww-toggle-images.
Fix index entries for shr-use-fonts and shr-use-colors.
(Advanced): Document shr-inhibit-images
(bug#47705).
parent 636e9fd6
......@@ -124,17 +124,25 @@ which part of the document contains the ``readable'' text, and will
only display this part. This usually gets rid of menus and the like.
@findex eww-toggle-fonts
@findex shr-use-fonts
@vindex shr-use-fonts
@kindex F
The @kbd{F} command (@code{eww-toggle-fonts}) toggles whether to use
variable-pitch fonts or not. This sets the @code{shr-use-fonts} variable.
@findex eww-toggle-colors
@findex shr-use-colors
@kindex F
@vindex shr-use-colors
@kindex M-C
The @kbd{M-C} command (@code{eww-toggle-colors}) toggles whether to use
HTML-specified colors or not. This sets the @code{shr-use-colors} variable.
@findex eww-toggle-images
@vindex shr-inhibit-images
@kindex M-I
@cindex Image Display
The @kbd{M-I} command (@code{eww-toggle-images}, capital letter i)
toggles whether to display images or not. This also sets the
@code{shr-inhibit-images} variable.
@findex eww-download
@vindex eww-download-directory
@kindex d
......@@ -305,6 +313,11 @@ of the width and height. If Emacs supports image scaling (ImageMagick
support required) then larger images are scaled down. You can block
specific images completely by customizing @code{shr-blocked-images}.
@vindex shr-inhibit-images
You can control image display by customizing
@code{shr-inhibit-images}. If this variable is @code{nil}, display
the ``ALT'' text of images instead.
@vindex shr-color-visible-distance-min
@vindex shr-color-visible-luminance-min
@cindex Contrast
......
......@@ -987,6 +987,7 @@ the like."
(define-key map "F" 'eww-toggle-fonts)
(define-key map "D" 'eww-toggle-paragraph-direction)
(define-key map [(meta C)] 'eww-toggle-colors)
(define-key map [(meta I)] 'eww-toggle-images)
(define-key map "b" 'eww-add-bookmark)
(define-key map "B" 'eww-list-bookmarks)
......@@ -1015,6 +1016,7 @@ the like."
["List cookies" url-cookie-list t]
["Toggle fonts" eww-toggle-fonts t]
["Toggle colors" eww-toggle-colors t]
["Toggle images" eww-toggle-images t]
["Character Encoding" eww-set-character-encoding]
["Toggle Paragraph Direction" eww-toggle-paragraph-direction]))
map))
......@@ -1893,6 +1895,14 @@ If CHARSET is nil then use UTF-8."
"off"))
(eww-reload))
(defun eww-toggle-images ()
"Toggle whether or not to display images."
(interactive nil eww-mode)
(setq shr-inhibit-images (not shr-inhibit-images))
(eww-reload)
(message "Images are now %s"
(if shr-inhibit-images "off" "on")))
;;; Bookmarks code
(defvar eww-bookmarks nil)
......
......@@ -183,8 +183,10 @@ temporarily blinks with this face."
"Face for <abbr> elements."
:version "27.1")
(defvar shr-inhibit-images nil
"If non-nil, inhibit loading images.")
(defcustom shr-inhibit-images nil
"If non-nil, inhibit loading images."
:version "28.1"
:type 'boolean)
(defvar shr-external-rendering-functions nil
"Alist of tag/function pairs used to alter how shr renders certain tags.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment