CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

7. Productivity

Emacs provides many applications that can help you get your work done. From coding to writing a dissertation to scheduling appointments, you can do just about anything from within Emacs.

7.1. Coding in Emacs

Emacs has "major modes" (essentially editors) for Lisp, Scheme, Awk, C, C++, FORTRAN, Icon, Java, Objective-C, Pascal, Perl, and Tcl. You can invoke a major mode by creating and/or opening a file with the appropriate extension. For example, to invoke the c++ major mode, create a file with a .cpp extension and then open that file. You can also download additional major modes, such as SGML.

Because of the breadth of coding options, it is beyond the scope of this document to cover them all. However, there is an extensive section in the Gnu Emacs Manual on coding available at http://www.delorie.com/gnu/docs/emacs/emacs_238.html.

7.2. Customizing Emacspeak

Emacspeak contains many options for customization. The most commonly requested options are covered here, but if there's something else that should be included, please do not hesitate to suggest it.

7.2.2. Auditory Icons for Emacspeak

Ann Parsons wrote a great explanation of the Emacspeak desktop and auditory icons that you can read at http://www.cs.vassar.edu/~priestdo/emacspeak/msg00256.html. In a nutshell, auditory icons provide you with feedback when you perform different tasks in Emacs. You can get audible feedback when you change buffers, quit a program, enter the buffers list, edit C code, etc.

If you want to use auditory icons and ViaVoice is your speech synthesizer, check to see whether or not you have a multi-channel sound card (try playing a CD and a .au file at the same time - if it works, you have a multi-channel card). If your card is not multi-channel, you must install the application stdiom as follows:

  1. Download the application stdiosynth from http://www.leb.net/pub/blinux/emacspeak/blinux/stdiom.tar.gz.

  2. Log in to your machine as root, then change to the directory where you placed the downloaded file stdiom.tar.gz.

  3. Unzip the file using the command gunzip stdiom.tar.gz.

  4. Untar the resulting file using the command tar -xvf stdiom.tar.

  5. Change directories to the resulting stdio_musician1.0 directory and type make. You should get a message that says, "stdiosynth is up to date."

Currently there are two auditory icon themes that you can download from the Emacspeak website, called Chimes and Cartoons. Chimes is made up of different chimes and short notes from various instruments. The icons are high-quality 44K-mono, and can be downloaded from http://emacspeak.sourceforge.net/chimes-mono.tar.gz. The Cartoons theme was contributed by Bryan Smart and is made up of 22K-mono sounds. You can download it from http://emacspeak.sourceforge.net/cartoons-mono.tar.gz.

To install either of these themes, download and unpack the archives into the emacspeak/sounds directory in your emacspeak installation. You can then select themes you have already installed by using the Emacspeak command M-x emacspeak-sounds-select-theme. Alternatively, you can add the following lines to your .emacspeak file:

(setq emacspeak-toggle-auditory-icons t) (when (emacspeak-sounds-theme-p "chimes-mono") (emacspeak-sounds-select-theme "chimes-mono/" ))

Some people use sound cards that can play multiple channels to produce their auditory icons. For this option, setemacspeak-aumix-multichannel-capable-p to t in your .emacs file:

(setq emacspeak-aumix-multichannel-capable-p t) 

7.3. Reading Adobe Acrobat files

There are two ways to view an Adobe Acrobat PDF file with Emacspeak. The first option is to generate a text version of the PDF using Xpdf, then read the text version. The second option is the use Adobe's PDF to HTML converter, then read the HTML file.

7.3.1. Using Xpdf

To generate a text version of the PDF, you'll need to download the Xpdf package. The main website is at http://www.foolabs.com/xpdf/, and you can download a precompiled binary (unless, of course, you're interested in playing with the source code, in which case you'd download the source) from ftp://ftp.foolabs.com/pub/xpdf/xpdf-0.92-linux2.0.tgz.

Assuming that you downloaded the binary file xpdf-0.92-linux2.0.tgz, to install and runXpdf:

  1. Open an Emacs command shell using M-x shell.

  2. Change to the appropriate directory where the xpdf-0.92-linux2.0.tgz file is located, then unzip the file using gunzip xpdf-0.92-linux2.0.tgz.

  3. Decompress the resulting xpdf-0.92-linux2.0.tar file using the command tar -xvf xpdf-0.92-linux2.0.tar.

The resulting directory will be called xpdf-0.92-linux2.0. Within this directory are a number of applications, including pdfimages, pdfinfo, pdftopbm, pdftops, pdftotext, and xpdf. You can find out what each of these applications does from the README file also included in the director the Emacs command shell as follows:

  1. Open an Emacs shell window using the command M-x shell.

  2. At the prompt, type pdftotext filename.pdf.

    Result: The file is converted to text. You can read the resulting text file with Emacs.

7.3.2. Using Adobe's converter

As an alternative to Xpdf, you can use Adobe's PDF to HTML converter if the PDF file you want to read has a URL. To convert a file:

  1. Use W3 to go to http://access.adobe.com/simple_form.html.

  2. Type in the URL of the PDF file to convert.

    Result: The file is converted it HTML. You can use W3 to read and navigate within the file.

Tests show that this conversion works very well on some PDFdocuments, but not so well on others. If the HTML file you end up with isn't readable, try using Xpdf to convert to a plain text file.

7.4. Scheduling appointments and calendar events

Emacs has a built-in desk calendar that includes a diary for planned events. The calendar and diary support both US and European date formats, but default to the US format. The diary keeps track of appointments and reminders using a diary file, a text file that contains a list of events and their dates. You can have Emacs send you an email every day with your schedule, or you can look at the calendar to view the day's events.

To start the calendar application, use the command M-x calendar. Calendar navigation commands are, for the most part, identical to text navigation commands, and you can also use the arrow keys to navigate.

If you'd like to use the diary, you need to create a diary file that contains your events. The diary file is a simple text file, and, by default, Emacs uses ~/diary as the diary file. Although you'll need to create the file manually, there are commands that allow you to add, view, and change diary entries. Most of these commands are Emacspeak-enabled.

Diary entries come in a number of formats and entries can be set to repeat. Below are some examples:

12/22/2001Mom arrives for visitAppears once on 12/22/2001
October 17Joe's birthdayRepeats yearly on October 17th
FridayTime cards dueRepeats every Friday

Of course, there are many more options than those shown here. You can find a complete listing of diary features in the GNU Emacs manual, located at http://www.delorie.com/gnu/docs/emacs/emacs_376.html.

You can view the diary entries for the current date using the command M-x diary. Alternatively, you can have the day's appointments automatically displayed when you enter Emacs by adding the following line to your .emacs file:

(diary)

You can also have your events emailed to you on a daily basis by running the command M-x diary-mail-entries. You'll probably get an error message the first time you do this that says, "No buffer named *Fancy Diary Entries*." This error message was reported as a bug to the bug-gnu-emacs mailing list by Tim Hesterberg. However, the command does in fact work, so you can just ignore the error message. By default, you'll be e-mailed the calendar entries for the next seven days. Also, when you enter Emacs it will automatically show you the calendar entries for the next seven days. According to the GNU Emacs Manual, there is a way to change the number of days the email covers, but according to Tim that feature also has bugs and doesn't seem to work. At the time of writing, these problems have not been addressed.

For complete instructions on using the calendar and diary, refer to the section on the calendar and diary in the GNU Emacs Manual, located at http://www.delorie.com/gnu/docs/emacs/emacs_376.html.

7.5. Writing text in Emacs

Emacs provides for many modes of text editing, and the tools you should use are task-dependent.

7.5.1. Writing for print, PDF, or postscript

If you want to output your writing in print, postscript, or PDF, LaTeX is the way to go. LaTeX is essentially a markup language that produces high-quality print, PDF, or postscript output. LaTeX was designed for the production of technical and scientific documentation, and in addition to allowing for detailed formatting, it also provides support for mathematical functions, automatic generation of bibliographies and indexes, graphics support, and much more. You can find out more about LaTeX from http://www.latex-project.org. In the documentation section at the LaTeX site, you will find an introduction to LaTeX, as well as a complete reference manual.

AUC Tex is the Emacs editing mode for LaTeX. The AUC Tex home page is located at http://mirrors.sunsite.dk/auctex/www/auctex/. You can download AUC Tex from ftp://sunsite.dk/packages/auctex/auctex.tar.gz. Once you've downloaded the file, you'll need to install it as follows:

  1. Open an Emacs command shell as root, using the command M-x emacspeak-root.

  2. Change directories to where the downloaded file auctex.tar.gz is located.

  3. Unzip the file using the command gunzip auctex.tar.gz.

  4. Unpack the resulting tarball using the command tar -xvf auctex.tar.

  5. Change directories into the new auctex-10.0g directory, then type the command make.

    The next several steps are covered in greater detail in the INSTALLATION file included in the auctex-10.0g directory.

  6. When the Makefile is finished building, type the command make lispdir=/usr/local/share/emacs/site-lisp install. If the Emacs path defined as "lispdir" in this command is not correct for your machine, supply the correct path to your Emacs installation.

  7. Check to make sure the tex-*.el files were placed in the directory specified in the lispdir command above. If not, copy them there.

  8. Add the following line to your .emacs file:

    (require 'tex-site)

    When you are finished, save and close your .emacs file.

  9. To invoke the AUC Tex editing mode, create a new file with a .tex extension.

You'll probably also want to install the online documentation. This is located in the doc directory within the auctex-10.0g directory. To install the documentation:

  1. Change directories to the doc directory.

  2. At the command prompt, type make. When the makefile is finished, type make install.

    Result: The documentation is installed in the /usr/local/info/ directory.

You can also get this information in the online manual at http://mirrors.sunsite.dk/auctex/www/auctex/doc/.

Since AUC TeX is a part of LaTeX, you'll need to know LaTeX to use it. There's a good LaTeX manual by David R. Wilkins called "Getting Started with LaTeX" located at http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/.

7.5.2. Writing for online viewing

If you're writing a document that will be read online, you have several choices: HTML, SGML, and XML, to name a few. Emacs comes with a built-in HTML editor, called html-mode. This editor provides you with additional commands for adding appropriate HTML tags to your document. To start html-mode, type M-x html-mode.

If you do a lot of HTML coding, you may wish to use html-helper-mode. This mode has a slightly different interface and many more features than html-mode. The home page for html-helper-mode is located at http://www.santafe.edu/~nelson/tools/. You can either download just the html-helper-mode.el file from http://www.santafe.edu/~nelson/tools/html-helper-mode.el, or you can download the entire distribution, including documentation, from ftp://ftp.reed.edu/pub/src/html-helper-mode.tar.gz. Installation instructions for both of these options are located at the html-helper-mode website at http://www.gest.unipd.it/~saint/hth.html.

If you're authoring larger documents or want to author in SGML, the PSGML mode for Emacs is recommended. The home page for PSGML is located at http://www.lysator.liu.se/projects/about_psgml.html.

There's also an XML editor for Emacs, called sxml-mode. The home page is located at http://koala.ilog.fr/plh/sxml.html. You must have a Java Virtual Machine, as well as PSGML 1.0.1 or better to run sxml-mode. Complete instructions for downloading and installing are available on the web site.