[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Let’s go netsurfing!

You can, by the keys, let emacs-w3m do all the web browsing operations. Emacs-w3m uses the ‘Lynx-like’ keymap (see section There are two types of the key bindings) by default. Of course, you can use the mouse buttons, too.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.1 There are two types of the key bindings

Since emacs-w3m is a late-coming web browser in the history of Emacs web browsers, we offer two types of the key bindings in order that users can get used to the new web browser easily. One is called the ‘Lynx-like’ keymap, the other is the ‘Info-like’ keymap. You can see what they mean from those names, can’t you? The former is similar to that of ‘Lynx’ which is the text-based web browser, and the later is similar to that of ‘Info’ which is GNU’s official document browser. By default, the ‘Lynx-like’ keymap is used. If you would like to use the ‘Info-like’ keymap, type

 
M-x customize-option <RET> w3m-key-binding <RET>

choose the ‘Info-like’ keymap, and save the changed state. Otherwise, add the following snippet to your ‘~/.emacs’ file, not ‘~/.emacs-w3m.el’ file:

 
(setq w3m-key-binding 'info)

To change the key binding one by one, modify the w3m-mode-map variable in your ‘~/.emacs-w3m.el’ file like the following:

 
(define-key w3m-mode-map [up] 'previous-line)
(define-key w3m-mode-map [down] 'next-line)
(define-key w3m-mode-map [left] 'backward-char)
(define-key w3m-mode-map [right] 'forward-char)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.2 Go ahead, just try it

You can invoke emacs-w3m using three different commands, listed below. Try one of these commands: a web page is displayed in an Emacs buffer named “*w3m*”, meaning that it is an emacs-w3m buffer. As you will probably notice, the major mode for an emacs-w3m buffer is w3m-mode, there are also minor modes (see section That’s a favorite with me!).

This section explains the most fundamental usage of these commands, see Details of some emacs-w3m functions for more information on them. See also Customizable variables for variables you can use to customize emacs-w3m’s behavior.

w3m

Start emacs-w3m, displaying the homepage specified in the w3m-home-page variable. The default value for w3m-home-page is “about:”. Set the w3m-quick-start variable to nil if you want to input a target URL every time you start emacs-w3m.

You can also use this as an argument when starting emacs. Examples:

 
% emacs -f w3m

To specify a URL, you could also use:

 
% emacs -f w3m http://emacs-w3m.namazu.org/
w3m-find-file

Prompt for a local file name in the minibuffer, and display it in emacs-w3m.

w3m-browse-url

Prompt for a URL in the minibuffer, and display it in emacs-w3m. This command is provided, if anything, in order to start emacs-w3m from other application programs.

Moving in an emacs-w3m buffer won’t be painful if you’re an Emacs user already, since many of the standard keys work as intended. For instance, C-n, C-v and C-s (which are commonly used to move down one line, one page, or search downwards for a word) are valid keys in an emacs-w3m buffer.

To follow a link, use the <RET> key. You have to move the point to a link to do this; links are easily recognizable in a buffer because they are not displayed like ordinary text: they can be underlined, or have a different color. The face w3m-anchor controls how they are to be displayed (see section Customizable variables).

<RET>
<right> (Lynx-like keymap only)

Display the page pointed by the link under point (w3m-view-this-url).

The exact behavior of this command depends on the properties of the link under point, and on whether you give it a prefix argument or not. See Details of some emacs-w3m functions for details.

As mentioned above, you can be prompted for a URL when you use the command M-x w3m, by setting the w3m-quick-start variable to nil. In an emacs-w3m buffer, there are also two popular ways to go to new pages by entering their URLs, see below.

<RET>

In an emacs-w3m buffer, you can be prompted for a URL in the minibuffer and make emacs-w3m display the corresponding page by hitting <RET> after moving the point to the URL displayed in the ‘header-line’. This feature will feel familiar to you if you are used to GUI-based web browsers like Mozilla. Detailed explanations about this can be found in Details of some emacs-w3m functions (w3m-view-this-url).

g

Prompt for a URL in the minibuffer and make emacs-w3m display the corresponding page (independently of the position of the point) in an emacs-w3m buffer. This binding will be familiar to you if you already use Gnus or Mew (w3m-goto-url).

G

Prompt for a URL in the minibuffer, and display it in a new session. This function works just like g (M-x w3m-goto-url)), except that it opens a new session. Unless you are using emacs-w3m on the character terminal, opening a new session means displaying the page in a new tab. For more information about tabs, please refer to Everybody likes tabs (w3m-goto-url-new-session).

c (Lynx-like keymap)
y (Info-like keymap)

Display the URL of the page being displayed in the echo area and put it in the kill-ring (w3m-print-current-url).

u (Lynx-like keymap)
Y (Info-like keymap)

Display the target URL of the link under point in the echo area and put it in the kill-ring (w3m-print-this-url).

If the page you’re reading is today’s news or someone’s diary, it may have been updated since you loaded it. You can refresh the page using the following command. (This command can also be useful to force a full redisplay of the page if it looks broken.)

R
C-S-l (Info-like keymap only)

Reload the page (w3m-reload-this-page).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.3 Moving from place to place in a page

Being able to use familiar Emacs movement bindings while browsing a web page probably fascinates you already. Believe it or not, there is more! Since we value your time, we have added keys to move the point, scroll the page or find links in a very fast way. When you master them, you will understand how handy they are.

The keys are assigned so that scroll commands can be called using shorter keystrokes than standard Emacs key bindings. And since places where you can input text are pretty specific in web pages (see section Filling in HTML forms), most keys have special meanings and aren’t assigned to self-insert-command anymore.

<SPC>

Scroll downwards. You may be used to this binding if you use the ‘more’ or ‘less’ commands, or Emacs’s view-mode (w3m-scroll-up-or-next-url).

<DEL>
b
<backspace>
S-<SPC>
C-?

Scroll upwards. You may be used to this binding if you use the ‘less’ command or Emacs’s view-mode (w3m-scroll-down-or-previous-url).

>

Scroll to the left. The scroll step is given by the w3m-horizontal-scroll-columns variable, default 10 (w3m-scroll-left).

<

Scroll to the right. The scroll step is given by the w3m-horizontal-scroll-columns variable, default 10 (w3m-scroll-right).

. (Lynx-like keymap)
S-<left> (Info-like keymap)

Shift to the left (a fine level horizontal scrolling). The shift step is given by the w3m-horizontal-shift-columns variable, default 2 (w3m-shift-left).

, (Lynx-like keymap)
S-<right> (Info-like keymap)

Shift to the right (a fine level horizontal scrolling). The shift step is given by the w3m-horizontal-shift-columns variable, default 2 (w3m-shift-right).

M-l

Scroll horizontally so that the current position is centered (w3m-horizontal-recenter).

The w3m-mode major mode defines commands to move to various kinds of things; namely links, forms, and images (whether they are displayed or not).

Let’s consider this simple example: suppose we want to search for a word on the widely-known Google search engine. Step one: open http://www.google.com in emacs-w3m. Step two: once the page is loaded, hit ]. Tadaa! The point has moved to the first form input in the page, you can now hit <RET> to enter something in it, and then C-c C-c to submit. Without this command, you would have had to move into the page using C-n, C-f and so forth, it would have been a real pain.

<TAB>
<down> (Lynx-like keymap only)

Move the point to the next link (an “anchor” in emacs-w3m lingo). More strictly speaking, move the point forwards to the nearest anchor.

M-<TAB>
S-<TAB>
<backtab>
<up> (Lynx-like keymap only)

Move the point to the previous anchor. More strictly speaking, move the point backwards to the nearest anchor (w3m-previous-anchor).

]

Move the point to the next form. More strictly speaking, move the point forwards to the nearest form (w3m-next-form).

[

Move the point to the previous form. More strictly speaking, move the point backwards to the nearest form (w3m-previous-form).

}

Move the point to the next image. More strictly speaking, move the point forwards to the nearest image (w3m-next-image).

{

Move the point to the previous image. More strictly speaking, move the point backwards to the nearest image (w3m-previous-image).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.4 Moving from page to page

This section explains how to move from page to page, but not by following links or inputing URLs (these ways of moving are explained in Go ahead, just try it).

This includes commands to move backwards and forwards in history (the familiar “Back” and “Forward” from other browsers), and the obligatory “Go to the home page” feature. You will probably understand this better after reading the Going back through time and space section.

B (Lynx-like keymap)
<left> (Lynx-like keymap)
l (Info-like keymap)
p (Info-like keymap)

Move back one page in history (w3m-view-previous-page). With a numeric argument ARG, move back ARG pages. This is the preferred way to go back in time.

N (Lynx-like keymap)
n (Info-like keymap)

Move forward one page in history (w3m-view-next-page). Of course, this will work only if you’ve used B (l for the ‘Info-like’ keymap) to move back in history. If called with a numeric argument ARG, move forward ARG pages. This command actually allows you to go back to the future!

H

Move to the home page (w3m-gohome). You can specify the URL of the home page by customizing the w3m-home-page variable (“about:” by default).

These commands are exclusive features of emacs-w3m, we were able to obtain patents on them, so you won’t find them anywhere else. That’s why you must learn to use them today! (Just kidding.)

^
u (Info-like keymap only)

Attempt to move to the parent directory of the page currently displayed. For instance, it will attempt to move to “http://foo/bar/” when “http://foo/bar/baz” is displayed. This function has been implemented because of the following observation: users of web browsers often have to move up one level of directories because the information they’re looking for isn’t displayed on the current page (either because it has been deleted, or because a search engine took them to the wrong page).

When you use another web browser, you usually need to remove the last component from the URL by using the <DEL> key, etc. several times manually. In emacs-w3m, this operation can be performed in only one keystroke, by typing ^!

Also, you type this command with prefix as “2 ^”, you visit the upper directory according to input number. you type “0 ^”, you visit the top of this site.

<SPC>

When the current point is located at the end of the buffer and you cannot scroll down further, hit the <SPC> key to go on to the “next page” (w3m-scroll-up-or-next-url). Here, “next page” means the page referred to in the special “next” header of the current page (read on). This feature has nothing to do with the history.

You probably noticed that some websites split their contents over several small pages, partly because it’s not comfortable for users to wait for huge contents to transfer in one go. For example, search results of search engines often appear like that. On such sites, users often need to follow links manually from one page to the next in order the access all the information.

Hopefully emacs-w3m attempts to enable you to browse a series of contents over pages as if you were viewing them as a single page, by combining two operations: explicitly following links and scrolling.

That’s how it works: these kinds of websites often have fields such as “next”, “prev” or “previous” in the headers of their web pages. These fields contain information about links between divided pages. Emacs-w3m uses these fields to know what to follow.

Let’s take an example with Google again to explain how the two operations (following links and scrolling) are combined. Open http://www.google.com and search for a word. If you search for a very common word (e.g. “hamburger”), you will get tons of search results. Google returns the first page of search results, after having sorted them using its own algorithm and divided them into several pages. Use <SPC> to scroll through this first page. Keep scrolling until you see the end of the web page in the window. Here, a surprise is waiting for you. If you use a web browser other than emacs-w3m and want to see the rest of the search results, you would have to click on any of the numbers listed under

 
Gooooooogle
 
1 2 3 4 5 6 7 8...

to follow the link. But with emacs-w3m, you can follow the link by just typing <SPC>, just as if you were scrolling!

<DEL>
b
<backspace>
S-<SPC>
C-?

When the point is located at the beginning of the buffer and you cannot scroll upward, hit the <DEL> to go to the “previous” page (w3m-scroll-down-or-previous-url). Here, the “previous” page means the page which is assigned to the “prev” or “previous” fields in the header of the current page. This function has nothing to do with the history, and works like <SPC> (w3m-scroll-up-or-next-url).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.5 Surfing using the mouse

The emacs-w3m developers went to some trouble to ensure that normal people who aren’t Emacs otaku can also use emacs-w3m. You can perform most web browsing operations using only the mouse except for entering text, e.g. URL, forms, etc. Note that sometimes you might still need to use modifier keys since the emacs-w3m developers are all Emacs otaku…

Use mouse-2 to “follow links” (the first basic of web browsing). Under Emacs 22.1 and newer, you can also follow links using mouse-1, depending of the value of mouse-1-click-follows-link.

mouse-2

Follow the link under the mouse pointer (w3m-mouse-view-this-url).

S-<mouse-2>

Follow the link under the mouse pointer in a new session (w3m-mouse-view-this-url-new-session).

Scrollbar, menubar and toolbar are helpful in emacs-w3m when you use a mouse (your Emacs must support them, and you must have enabled them). You can scroll an emacs-w3m window using the scrollbar. You can invoke many emacs-w3m commands described in this manual from the “w3m” menu which appears at the top of the Emacs frame. Note: it’s not necessary to use the menubar for most emacs-w3m commands, you can use the toolbar icons instead.

To switch between buffers in an emacs-w3m window using “Tabs” (see section Everybody likes tabs), click on the topmost line in an emacs-w3m window directory using mouse-2 or choose one from the “Tab” menu which appears next but one to the “w3m” menu.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.6 Return to an Ordinary Life

Think back. You probably didn’t start Emacs to browse the web, but to, say, replace some editor’s built-in interpreter with scheme, write Info documentation or put into print your opinion on software patents… who knows? While you were using Emacs, you ran into the need to browse the web for your work. But you happened to be able to see the web page without leaving Emacs at all. Wow.

Now the time has come to return to work. Keep it up or the world won’t change! Type q if you think you might need to browse the web again. Type Q if you don’t have any intention to go back to emacs-w3m for a while.

q

Close an emacs-w3m window and select the other buffer (w3m-close-window).

Q

Save the “arrived URLs” list to disk (see section Going back through time and space), save cookies (see section Variables related to cookies) and really quit emacs-w3m (w3m-quit).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by TSUCHIYA Masatoshi on January 30, 2019 using texi2html 1.82.