EWW survival guide
EWW is the web browser that comes with Emacs.
You don't have to install any additional packages, you can use EWW right out the box.
EWW can display PDF files and images.
This is how the EWW manual describes it:
EWW, the Emacs Web Wowser, is a web browser for GNU Emacs that provides a simple, no-frills experience that focuses on readability. It loads, parses, and displays web pages using shr.el. It can display images inline, if Emacs was built with image support, but there is no support for CSS or JavaScript.
Depending on you point of view, the lack of support for JavaScript can be a good thing or a bad thing.
Survival guide
Below follows an overview of the most important features and commands, to survive --and even enjoy-- browsing the web with EWW.
Start browsing
Start EWW and open an URL:
M-x eww
Readable modus
EWW has a command "eww-readable". When this command is issued, EWW tries to find the "readable" part of the web page, and omits every thing else.
The command for this is "R" (upper case r).
When I open a web page in EWW (like from a RSS-feed), hitting 'R' is the first thing I do.
Unfortunately, this doesn't work on every web page (looking at you, www.theregister.com!). But when it works, most of the time you go immediately to "the meat" of the web page.
Great readability
EWW can be set up like a text mode browser. This increases the readability of many web pages. It is also fast, almost like lynx.
"Set up like a text mode browser" means no display of images, and just use the default Emacs fonts and colors.
The text width can also be set to a maximum value, this improves readability a lot. The default maximum line width is 120 characters, but I prefer something around 62 characters. Experiment with this, to discover your personal optimum.
Paging through the web page
Just use the normal commands for an Emacs buffer in view mode.
- SPACE to scroll down
- BACKSPACE to scroll up
- TAB to go to the next hyperlink
- Shift-TAB to go to the previous hyperlink
- RET (Enter) to follow a hyperlink
- M-RET (Alt-Enter) to follow a hyperlink in a new buffer
Of course, you can also use the normal scroll commands, like C-v and M-v and the up- and down commands like C-n and C-p.
Reload or close
Two other important keys:
- g to reload the current web page
- q to close the buffer
Listing the EWW buffers
After a while you will have several EWW buffers open in Emacs.
Use 's' or 'S' to list the EWW buffers and select a buffer to go to.
- The lower case command opens the list in the mini-buffer,
- The upper case command opens a new buffer and shows the titles together with their URL.
Copy the current URL
The command 'w' copies the current URL. This works in two ways:
- When point is on a link, the URL of the link will be copied.
- When point is not a link, the URL of the current document will be copied.
The URL is copied into the kill ring. When you use a graphic version of Emacs (not the terminal variant) it is also copied into the clipboard, which can be very useful.
Download the current URL
The command 'd' downloads the current URL. Just like 'w', this works in two ways:
- When point is on a link, the URL of the link will be downloaded.
- When point is not on a link, the current page will be downloaded.
Switching to your graphical browser
Sometimes you open a web page in EWW and come to the conclusion that you really want to see it in a graphical browser like Firefox.
For this, use '&' (Shift-7 on my keyboard) to issue the command eww-browse-with-external-browser. This will open the current web page in your graphical browser.
Bookmarks
EWW uses its own bookmark system.
- b : set bookmark
- B : open list of bookmarks
Default browser
In Emacs, I have set EWW to be my default web browser. (See the configuration below.)
I read my RSS feeds with Gnus. When I follow a link, it will be opened in EWW. Because of this, web pages are opened fast and are easy to read.
Engine mode
The Emacs package engine-mode is a nice addition to EWW. It lets you query Duck-Duck-Go, Wikipedia, and others, with just a few keys.
Set up an hot key, like 'd' for Duck-Duck-Go, 'w' for Wikipedia, and so on.
Highlight an region, and hit C-x /
- C-x / d : query Duck-Duck-Go with the text from the region
- C-x / w : query Wikipedia with the text from the region
- and so on.
See below for the configuration of this.
Integration with Elpher
Elpher is a Gopher and Gemini client for Emacs. Elpher has to be installed. It is in ELPA, so this easy to do.
With this integration in place, you can open Gopher and Gemini links right from EWW.
Configuration
Here are some lines from my ~/.emacs:
(setq
browse-url-browser-function 'eww-browse-url ; set eww default browser
browse-url-secondary-browser-function 'browse-url-firefox
; set firefox secondary browser
shr-inhibit-images "off" ; disable images
shr-use-fonts nil ; no special fonts
shr-use-colors nil ; no colors
shr-indentation 2 ; left-side margin
shr-width 64 ; Fold text to 62 columns
url-cookie-file "/tmp/cookies") ; put cookies in /tmp
;; prevent show-trailing-whitespace in eww buffer
(add-hook 'eww-mode-hook (lambda () (setq show-trailing-whitespace nil)))
This is for installing Elpher and using it with EWW:
(use-package elpher
:ensure t)
(advice-add 'eww-browse-url :around 'elpher:eww-browse-url)
(defun elpher:eww-browse-url (original url &optional new-window)
"Handle gemini links."
(cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url)
(require 'elpher)
(elpher-go url))
(t (funcall original url new-window))))
This is for engine-mode:
(use-package engine-mode
:ensure t
:config
(engine-mode t)
(setq engine/browser-function 'eww-browse-url)
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
:keybinding "d")
(defengine stack-overflow
"https://stackoverflow.com/search?q=%s"
:keybinding "s")
(defengine wikipedia
"http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=%s"
:keybinding "w"))
Add more search engines which are of interest to you.
Toggle colors and font and more
Above we discussed a part of the options of EWW, enough to get you going.
There are e.g., key bindings to toggle between showing or disabling images, to toggle between Emacs-colors and the colors of the web page, the Emacs fonts and fonts of the web page, and so on.
As always, see the friendly manual.
In Emacs, issue Ctr-h, followed by 'i', this will open the brilliant info-system. Search for EWW.
Happy browsing!
Made with ♥ by a human - Proud member of the 250kb.club.
Most recent pages
All tags
Sitemap
RSS
RSS of Gophersite