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 already comes with the default installation and is called site-start.el
, to be found in the x:\emacs\20.6\lisp
directory. The other being .emacs
which 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 be aware that there is no general setup other than the plain Emacs after the installation. Every other thing 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 as well as giving you some useful hints. However changing the setup via the customization menu will not be addressed in the following.
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/" "x:/emacs/20.6/lib-src") load-path))
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 stored.
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.
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.
You now have context-sensitive help available.
Download a working etags program. Put the files into the x:\emacs\20.6\bin
directory. For your convenience I have included a batch file makeetags.cmd
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.
As already said previously Emacs 20.6 comes without an emacsclient.
If you have installed Gnuserv, add the following to your site-start.el
:
(require 'gnuserv) (gnuserv-start) (setq gnuserv-frame (selected-frame))
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.
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 ) )
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.
This article has been translated to the Serbo-Croatian language by Jovana Milutinovich.