161 lines
7.0 KiB
HTML
161 lines
7.0 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html><head>
|
|
<title>Books On The Screen</title>
|
|
</head>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000" >
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4>
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center><font color="maroon"><h1>Books On The Screen</h1>
|
|
</font></center>
|
|
<center><font color="maroon"><h3>Reading Electronic Texts With XEmacs</h3>
|
|
</font></center>
|
|
<center>
|
|
<h4>by <a href="mailto: layers@marktwain.net">Larry Ayers</a></h4>
|
|
</center>
|
|
<hr>
|
|
|
|
<center><font color="maroon"><h3>Introduction</font></h3></center>
|
|
|
|
<p>During a snowy and windy period this past winter I badly needed something new
|
|
to read. None of the plentiful books in the house looked appealing and the
|
|
prospect of driving to town for a visit to the library seemed like an awful
|
|
lot of trouble, given the poor road conditions caused by drifting snow.
|
|
|
|
<p>I was vaguely familiar with Project Gutenberg, a cooperative project
|
|
intending to make public-domain literary texts freely available in digital
|
|
form, but had never obtained any of these electronic books. A quick search
|
|
on the net led me to one of the
|
|
<a href="http://www.gutenberg.net">Gutenberg web-sites</a>, where I
|
|
was surprised to see the extensive listings of novels and other literary
|
|
works, all either manually retyped or scanned from print editions by numerous
|
|
volunteers. As the wind whistled around the house I tried reading one of
|
|
these book-files, interested in determining whether eyestrain would be a
|
|
problem.
|
|
|
|
<center><font color="maroon"><h3>First Impressions</h3></font></center>
|
|
|
|
<p>The files are available compressed with a zip archiver; when unarchived on
|
|
a Linux system those DOS filesystem ^M carriage return symbols terminate each
|
|
line. The Info Zip <i>unzip</i> utility will automatically strip them from
|
|
the file if the <b>-a</b> switch is given to the command, as in this example:
|
|
<b>unzip -a [filename]</b>. This isn't too useful if Emacs' native
|
|
jka-compress archive file handler is used (which calls zip and unzip
|
|
internally), allowing the file to be automatically uncompressed and
|
|
decompressed when it is respectively opened and closed. In this case the
|
|
easiest way I've seen for converting DOS-format line-endings to unix-format is
|
|
a handy pair of Lisp function which Earl Stutes wrote about in LG #10; I'll
|
|
repeat them here:<br>
|
|
|
|
<pre><kbd>
|
|
(defun dos-unix ()
|
|
(interactive)
|
|
(goto-char (point-min))
|
|
(while (search-forward "\r" nil t) (replace-match "")))
|
|
|
|
(defun unix-dos ()
|
|
(interactive)
|
|
(goto-char (point-min))
|
|
(while (search-forward "\n" nil t) (replace-match "\r\n")))
|
|
|
|
</kbd>
|
|
</pre>
|
|
|
|
<p>With these two functions inserted in your <b>.emacs</b> file, converting a
|
|
file is simply a matter of typing <kbd>M-x dos-unix</kbd>. It could be bound
|
|
to a keystroke if you find that you use it often.
|
|
|
|
<p>Well, now the file is more readable but there are other issues which make
|
|
reading an entire book awkward. It's a pain to find your place in the file
|
|
between reading sessions; it would also be convenient to be able to load the
|
|
file without needing to type in the complete path. Two XEmacs modes can be a
|
|
great help.
|
|
|
|
<center><font color="maroon"><h3>Helpful Modes</h3></font></center>
|
|
|
|
<p>The obvious method of saving your place is an analog to a bookmark in a
|
|
hard-copy book, the Emacs bookmark facility. Bookmarking doesn't
|
|
automatically update, a deficiency which Karl Hegbloom's Where-Was-I database
|
|
corrects. This mode is toggled on for individual files, since with many files
|
|
your "place" isn't important. The mode is toggled by typing <kbd>
|
|
M-x tog[TAB] wh[TAB]</kbd>. The tab key is used to automatically complete the
|
|
expression; it's quicker to type than the full form, <kbd>M-x toggle
|
|
where-was-i.</kbd> Once the mode is activated closing or killing a file saves
|
|
the point position in a binary database in your root directory. Open the file
|
|
later and there is the cursor, just where you left off reading. This is
|
|
especially handy with book-length files, many of which are over a megabyte in
|
|
size. Hegbloom's package is included in recent versions of XEmacs; in the
|
|
current betas which use the new package system it is part of the edit-utils
|
|
package.
|
|
|
|
<p>The other XEmacs mode which I recommend for general use as well as for
|
|
reading books is Juergen Nickelsen's recent-files.el, also included with
|
|
XEmacs and in the edit-utils package. This ingenious mode is activated by
|
|
inserting these lines in your .emacs file:<br>
|
|
|
|
<pre><kbd>
|
|
(load "recent-files")
|
|
(recent-files-initialize)
|
|
</kbd></pre>
|
|
|
|
<p>This mode maintains a new menu in the menu-bar with two submenus. The
|
|
first submenu is a list of the past several files you have loaded into XEmacs; these
|
|
entries gradually get superseded by newer ones. The other one can contain
|
|
entries which are permanent. The permanent files are those which you often
|
|
edit, perhaps certain configuration files or a journal. There are also
|
|
options on the menu to make a temporary listing permanent or vice-versa.
|
|
|
|
<p>With both of these excellent modes in action XEmacs' transition to a
|
|
comfortable displayer of books is nearly complete. One last possibility is to
|
|
use a TrueType proportional font along with a server such as xfstt; I find
|
|
these fonts to be easier on the eyes for passive reading.
|
|
|
|
<p>Another helpful mode is one of the several available dictionary modes which I
|
|
discussed in LG #34. I've noticed that I'm more likely to look up an
|
|
unfamiliar word in an on-line than in a paper dictionary. One keystroke to
|
|
look up a word is certainly convenient.
|
|
|
|
|
|
<center><font color="maroon"><h3>Conclusion</h3></font></center>
|
|
|
|
<p>Until the quality of computer displays improves significantly, reading text
|
|
on paper will still be preferable for protracted reading sessions. Still,
|
|
I've enjoyed reading several of the Gutenberg texts, many of which it had
|
|
never occurred to me to seek out in a library. The ability to cut and paste
|
|
from a book can be useful --plus you can correct typos!
|
|
|
|
<hr>
|
|
|
|
<!-- hhmts start -->
|
|
Last modified: Sun Mar 28 18:18:26 CST 1999
|
|
<!-- hhmts end -->
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1999, Larry Ayers <BR>
|
|
Published in Issue 39 of <i>Linux Gazette</i>, April 1999</H5></center>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
|
|
ALT="[ TABLE OF CONTENTS ]"></A>
|
|
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
|
|
ALT="[ FRONT PAGE ]"></A>
|
|
<A HREF="./richardson.html"><IMG SRC="../gx/back2.gif"
|
|
ALT=" Back "></A>
|
|
<A HREF="./ayers2.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
|
|
<P> <hr> <P>
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|