Saturday, December 18, 2010

Finding Emacs - W3m and Installation Routines

I keep reading how people use the W3m pager to view the web from within Emacs and I just had to give it a go.  Believe me when I say that it isn't as easy as you might think to set up Emacs for web browsing, certainly not in Windows.  W3m doesn't exist for Windows as a separate easily downloadable binary for a start.

But wait ....... there is Cygwin.

I talked a bit about Cygwin in my last post and it turns out that for installing extensions to Emacs in Windows, that Cygwin is turning out to be the most sensible course of action.  There are exceptions of course, but in my experience there always are.

So, for that "text" web experience, start here ..

Start by downloading and installing cygwin.  It comes as a single file called "setup.exe" which will then ask which internet repository you wish to use, then download the available installation menu for you.  If you are really keen, you can install X and have some graphical Unix tools on your desktop, however we just want to download the " w3m " browser which you can easily find by using the search function included.

Next, Put the path to the " C:\cygwin\bin " directory in your .. er .. PATH environment variable.  The beauty of this is that it will allow you to use other utilities without adding more and more to the PATH, and save you some fiddling to boot.

OK, we have the easy bit done.  Now we have to download and install the emacs-w3m extension.  The extension itself is available from here and at the time of writing the most recent release was 1.4.4 from 2005.
Unpack the archive and place the resulting folder in your " .emacs.d " directory.

Installation.  This needs a bit of thought and is not entirely obvious.  On Windows, we cannot use the " make " utility so there is an alternative provided.

First, change into the emacs-w3m directory that you just unpacked, from in Emacs by using the menu FILE>Open Directory command.

Next, issue the installation command for non-Unix systems given in the web page by using the TOOLS>Shell Command menu selection.

emacs -batch -q -no-site-file -l w3mhack.el NONE -f w3mhack-nonunix-install

We are almost there.  All we need is to make changes to our " init.el " file and it is finished.  Without a thoughtful hack mentioned here, this version of w3m won't work in Emacs 23.

;; w3m
(setq load-path (cons "~/.emacs.d/emacs-w3m-1.4.4" load-path))
(setq load-path (cons "~/.emacs.d/emacs-w3m-1.4.4/attic" load-path))
(require 'w3m-e21)
(provide 'w3m-e23)
(require 'w3m-load)
 Now, restart to re-initialise your PATH variable, hold your breath and start Emacs then:

M-x w3m

and ..... ?

 

later ..............


It worked for me ... your mileage may vary ......

No comments:

Post a Comment