VOICE Home Page: http://www.os2voice.org
[Newsletter Index]
[Previous Page] [Next Page]
[Features Index]

March 2001
editor@os2voice.org

Emacs 20.6.1 under OS/2 -
Part I

By: Oliver Heidelbach ©March 2001

What is Emacs?
http://www.gnu.org/software/emacs/emacs.html

Emacs 20.6.1 distribution files
@ Hobbes ftp://hobbes.nmsu.edu/pub/os2/apps/editors/emacs/
@ Leo ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu/emacs-20/

GNU/EMX runtime, if you don't have it already
@ Hobbes ftp://hobbes.nmsu.edu/pub/os2/dev/emx/
@ Leo ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/

Additional files for installation
UnZip http://hobbes.nmsu.edu/pub/os2/util/archiver/uzs541x2.exe
A working movemail program, local http://userpage.fu-berlin.de/~oheiabbd//emacs/metamail-old.zip
A working etags program, local http://userpage.fu-berlin.de/~oheiabbd/emacs/etags-old.zip

Optional files for installation
Gnuserv, recommended http://hobbes.nmsu.edu/pub/os2/apps/editors/emacs/os2_gnuserv_r3.zip
GNU bash shell ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu/shells/bash-os2-2.0-266.zip or alternately
korn shell ftp://ftp.leo.org/pub/comp/os/os2/leo/shells/pdksh-5.2.13-emx.zip


My commented site-start.el http://userpage.fu-berlin.de/~oheiabbd/emacs/emacs206-os2-site-start.html
(Editor's Note. Emacs is a self-documenting real-time display editor, extensible and customizable in a dialect of the Lisp programming language, that can be used to create HTML, Info and TeX and any other plain text documents. Further information can be found at <http://www.gnu.org/software/emacs/emacs.html>.)

Basic Installation and Setup


I have been using Emacs under OS/2 for quite a while now. The last stable version I have been using was the port of Eberhard Mattes, version 19.33. A year ago or so, I tried to install the new port by Jeremy Bowen, version 20.3. I couldn't bring it up as it should be, so I dropped the idea of upgrading my Emacs as the porting enthusiasm has somehow ceased a bit. In November, 2000 Jeremy Bowen released version 20.6 of his OS/2 port and, as I was forced to install my whole working environment anew after a bad disk crash, I decided to give it another try. I finally suceeded in getting everything going like it should, and was even able to install packages like e.g. mailcrypt which I had not been able to install under Emacs 19.33 for OS/2 for some reason.

In the long run it turned out that this new port behaves fairly stable on my computer as long as only internal features are being used. Interaction with other programs, e.g. sending mail, most often leads to exceptions (core dumps), if used repeatedly.
Thus I recommend to keep your old Emacs installation as a backup until you are really sure, this new port fits your needs. To interested new users in other words again: As long as you plan to use Emacs just for editing you are on the safe side. This port however is hardly usable as a mailer and such. If you would like to use Emacs heavily in interaction with other programs, you should consider to use Emacs 19.33.

The following will give you a general walkthrough for installing Emacs under OS/2. However this is not meant to replace the existing readme files which come with Emacs or additional packages.

Please note Whenever you will see this icon the text following shows the problem(s) I ran into when installing Emacs and some elisp packages and the workarounds and modifications I made to get around the problems.

Prerequisites

Before you can start installing Emacs 20.6 for OS/2 you will of course need to download it from Hobbes (WWW, FTP) or Leo (WWW, FTP). FTP download with a FTP client has the advantage over browser/WWW in that you can mark all files to download at once, then go away watch a video or whatever you would like to do. If you would like to do this, enter "anonymous" as user name and your e-mail address as password.

The distribution comes in four files e206base.zip, e206el1.zip, e206elc.zip and e206rest.zip all of which amount to approximately 14 megabytes. It is necessary to download at least the first three of the files, but I recommend downloading all four as the fourth one contains all the documentation and manuals

I highly recommend that one download the gnuserv distribution (@Hobbes) for OS/2 as this port of Emacs comes without an emacsclient.

You will also need approximately 50 megabytes free space on an HPFS drive for the installation and UnZip to unpack the files.

If you have never worked with the GNU/EMX environment under OS/2, you will also need to download the EMX runtime files. The most recent version as of this writing is EMX 0.9d, fix level 3. As Emacs itself can be retrieved from Hobbes (WWW, FTP) or Leo (WWW, FTP), make sure your GNU/EMX environment is properly installed and up-to-date before you start to install Emacs.

Additionally, you may want to install a Un*x compatible command line shell such as the bash shell (@Leo) or the korn shell (@Leo) if you are planning to use Emacs in the full GNU/EMX environment. As far as I know Emacs is able to work internally with the OS/2 shell cmd.exe, but I have never tested this extensively. If you don't plan to use OS commands from within Emacs anyhow, you don't need to care for now. You can install any shell later as well.

Installation

1)

Copy or move the four distribution files to the root directory of the drive where you want to install Emacs. Emacs will be unzip'd into x:\emacs\20.6\ and I highly recommend not to change the default paths.

Be sure to read the file readme.os2 in x:\emacs\20.6\.

2)

Put the following into your config.sys:
(Replace x: with the drive which matches your machine.) SET

PATH=[...];x:\emacs\20.6\bin;[...];
REM *** Emacs 20.6 ***
SET SHELL=x:/emx/bin/sh.exe
SET SYSTEMNAME=ohei
SET TMP=x:\tmp
SET TMPDIR=x:/tcpip/tmp

Also put the following lines into your config.sys if those are not already in there from your GNU/EMX installation: SET TERM=ansi

SET TERMCAP=x:/emx/etc/termcap.dat
SET INFOPATH=x:/emx/info
SET HOME=x:/home
SET NAME=Oliver Heidelbach
SET USER=ohei

3)Please note

Basically you are done now. All of the above is standard procedure so far. However I had to perform the following additional steps to keep everything happy (I guess it has to do with some paths being left hard-coded in the port.):

4)

You should be done by now. Reboot your machine and change to the x:\emacs\20.6\bin directory to dump Emacs with the batch file dump.cmd.

You may want to have a look at the instemacs.cmd file - call it without any arguments to see what it can do for you.

5) - recommended

Create a directory x:\emacs\lisp. Put all additional elisp packages and files into this directory. Thus you will always have the current Emacs distribution separated from additional files you install. This will save you much time when you are going to install the next version of Emacs.

6) - recommended

Create a temporary directory or use one you already have for such purposes. Copy the gnuserv distribution file os2_gnuserv_r3.zip to that directory and unzip it. Copy or move the three *.exe files to the x:\emacs\20.6\bin directory. Copy or move the file gnuserv.el to the x:\emacs\lisp directory.
If you are planning to integrate the GNU Un*x style man pages into your environment, copy or move the file gnuserv.1 to x:\emx\man\man1.

7) - optional

It is also a good idea to copy all the info documentation files into one standard directory. That is probably x:\emx\info depending on where you have installed GNU/EMX. Copy or move all the info files from x:\emacs\20.6\info to x:\emx\info\. Don't copy/move the dir file as you would overwrite your current one. I recommend to copy and paste the contents of the dir file which comes with Emacs to the one residing in the GNU/EMX directory if the Emacs related entries are missing from it.

Emacs directory structure
Above: The directory structure of Emacs

Basic Setup? What does this mean?

Emacs is a very powerful editor. After you have suceeded installing Emacs there is a pletheora of things you may or may not want to change in order to get the most of your editor. Some of those things are of common interest while others may depend purely on personal taste.

Two files are of interest when it comes to setting up Emacs. One of those comes with the default installation and is called site-start.el, to be found in the x:\emacs\20.6\lisp directory. The other file is .emacs that you will have to create in your home directory - the directory which you have entered into the HOME environment variable in your config.sys.

Background information: Emacs originated in the Un*x platform which is a multi-user environment. Thus there are two setup files, one for the whole site (site-start.el, you have guessed it) and one for each single user, the .emacs file in the user's home directory. These differences do not exist under OS/2. I personally tend to use only site-start.el under OS/2, having no .emacs file at all. However both files work as a Emacs setup and both are valid with Emacs under OS/2.

Please note that there is no general setup other than the plain Emacs after the installation. Everything else will probably differ more or less from user to user. This also means that everything you add or change in the Emacs setup files also changes the behaviour of Emacs. Please be aware of this fact when you have setup questions and you already have changed the Emacs setup files.

Please note: Version 20.x of Emacs comes with a customization menu - see HELP in the menu bar - with which you will be able to setup all Emacs packages/editing modes etc. which support customization. The following steps will be a basic walkthrough: setting up Emacs 20.6 under OS/2, addressing the problems I had setting all up, and giving you some useful hints. However changing the setup via the customization menu will not be addressed in the following.

Adding additional directories to the loadpath

If you have followed my previous recommendation to create an extra directory for any additional elisp files or packages, the first thing you should do is to make that directory known to Emacs.

Add the following to your site-start.el:

(setq load-path (append '("x:/emacs/lisp/")

       load-path))



Setting up Emacs context-sensitive help

Emacs has built-in context-sensitive help. Whenever the cursor is on an elisp variable or function name one can type [C-h v] or [C-h f] to get a description of the variable or function respectively. Emacs does so by relying on the TAGS files in the directories in which the elisp files (*.el) are residing.

Emacs 20.6 comes without TAGS files which means you will have to build those files yourself. This is done with the program etags which resides in the x:\emacs\20.6\bin directory.

Please note

When I tried to do just that, I always got an error message and nothing happened. When I used the etags program from the Emacs 19.33 distribution I was able to build all the TAGS files instantly.

However I still could not use context-sensitive help from within Emacs as everytime I typed [C-h v] or [C-h f] I got another error message related to the file fns-20.6.1.el in the x:\emacs\20.6\bin. It turned out that this files contains garbage at the very end. To solve the problem load it into Emacs and delete all the garbage.

The file should end with

... dont-compile eval-when-compile eval-and-compile)
)))

You now have context-sensitive help available.

Context-sensitive help
Above: Context-sensitive help in Emacs

Download a working etags program. Put the files into the X:\emacs\20.6\bin directory. For your convenience the program includes a batch file makeetags.cmcl which will loop through all standard elisp directories to build the TAGS files. You must call this batch file from within the x:\emacs\20.6\bin for it to work properly.

Setting up Gnuserv

As I said previously, Emacs 20.6 comes without an emacsclient. Emacsclient is a helper application feeding files to edit into a running Emacs. Without an emacsclient, you would start Emacs anew every time you load a file for editing.

If you have installed Gnuserv, add the following to your site-start.el:

(require 'gnuserv)

(gnuserv-start)

(setq gnuserv-frame (selected-frame))



Setting up PM frame parameters and meta-keys

Many Emacs commands are initiated with a keystroke combination involving the so called meta-key. By default Emacs does neither recognize the <ALT> nor the<ALTGR> key as meta-key. Instead you would have to use <ESC> <x> to initiate such a command sequence.

Also by default Emacs does know about your screen resolution. You may want to blow up the size of the Emacs window to fit a 1024*768 screen resolution.

You also may want to set another menu font for Emacs.

Try the following:

(if (eq window-system 'pm)

  (setq default-frame-alist

    (append '((altgr-modifier . meta) ;; AltGr (and AltCar) generate M-

              (alt-modifier . meta)   ;; Alt generates M-

              (alt-modifier . alt)

              (shortcuts . (alt-f4))  ;; Disable all shortcuts but Alt+F4

              (width . 81) (height . 43) ;; for 1024*768 screens

              (top . -2) (left . 280)

;;              (font . "10.System VIO")

;;              (menu-font . "2.System VIO") ;; Use small font for menus

              (menu-font . "8.WarpSans Bold"))

              default-frame-alist)))

Try to experiment with the window size and fonts until you are satisfied. As you may have already guessed, a semicolon does comment out the following code.

Setting up mail/rmail

If you want to set up Emacs as a mailreader, you will need to configure a few things. The following assumes, you will be using rmail for that purpose.

Add the following to your site-start.el and change it according to your environment:

(let ((etc (getenv "ETC"))

      mbox)

  (setq etc (if etc (replace-char-in-string etc ?\\ ?/)

              "x:/mptn/etc/"))

  (setq etc (expand-file-name etc))

  (if (not (string-match "/$" etc))

      (setq etc (concat etc "/")))

  (setq mbox (concat etc "mail/inbox.ndx")   ;; Lamailer format

;;  (setq mbox (concat etc "mail/ohei")      ;; Unix format

        rmail-spool-directory (concat etc "mail/")

        rmail-primary-inbox-list (list mbox)

        display-time-mail-file mbox

  )

)

Please note The readme.os2 files says rmail would work now. It did not for me and it gave me a hard time setting it up.

If your local pop3 mailbox is in Un*x format everything seems to be fine, but if you are using the lamailer format, retrieving mail from the local mailbox seems not to work. I always got the error message "Cannot convert to babyl format" when I tried to load the new mail with rmail. The problem is the movemail program which is distributed with Emacs and can be found in the x:\emacs\20.6\bin directory. After trying nearly every available pop3 mail retrieving program available for OS/2, I installed the old movemail program which is distributed with Emacs version 19.33 and the problem dissappeared immediately.
Install the executable files in x:\emacs\20.6\bin.

Also be sure to add to following (change to fit your environment):

(setq user-mail-address "you@domain.com"

      user-full-name "Forename Lastname"  ;; for sendmail or feedmail

)

(setq sendmail-coding-system 'iso-latin-1)

Please see my site-start.el for a more complete setup of the mail/rmail environment.

You should now have managed all the odds and ends of the basic installation of version 20.6.1 of Emacs for OS/2.

Part II of this walkthrough will deal with setting up some additional elisp packages like mailcrypt and bbdb. It will also deal with setting up a Mule independent ISO-8859-1 environment for mail and editing.


Oliver Heidelbach is an OS/2 user since 1993 and an Emacs user since 1994. He currently works for the Internet Movie Database (IMDb) as content editor.

Features
editor@os2voice.org
[Previous Page ] [ Index] [Next Page
]
VOICE Home Page: http://www.os2voice.org