Emacs: w3m package

This article will describe using w3m package which provides w3m buffer on emacs. The w3m is CUI browser.

1 Install w3m

Install w3m with apt, yum or Homebrew.

$ sudo apt-get install -y w3m

2 Install w3m package

Install w3m-el package in Ubuntu. Install emacs-w3m package in MacOS .

Installing w3m package from source code is as below. w3m package will be installed to ${HOME}/share/emacs/site-lisp/w3m.

$ cvs -d :pserver:anonymous@cvs.namazu.org:/storage/cvsroot co emacs-w3m
$ cd emacs-w3m
$ autoconf
$ ./configure --prefix=${HOME}
$ make all install

3 ${HOME}/.emacs

Add w3m directory to load-path.

(add-to-list 'load-path (expand-file-name "~/share/emacs/site-lisp/w3m"))

Set encoding UTF-8.

(setq w3m-coding-system 'utf-8
      w3m-file-coding-system 'utf-8
      w3m-file-name-coding-system 'utf-8
      w3m-input-coding-system 'utf-8
      w3m-output-coding-system 'utf-8
      w3m-terminal-coding-system 'utf-8)

Set browse-url-at-point to global key. This will open URL at the cursor.

(setq browse-url-browser-function 'w3m-browse-url)
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
(global-set-key "\C-xm" 'browse-url-at-point)

4 Key bindings

Key bindings is as below.

q Quit w3m
S Open google search
R Reload page
B Go to previous page
N Go to next page
a Add page to bookmark
v Show bookmark
[ Go to next edit box
] Go to prev edit box
c Show URL
E Edit URL
G Open URL with new session