Get and install XEmacs

Get/install XEmacs onto Linux

Skip the below and use apt-get to load XEmacs. If you get the dreaded "Can't get fontset resource for Input Method" error, uninstall xemacs21-mule and xemacs21-mulesupport and install xemacs21-nomule.

See http://www.xemacs.org.

Get and install XPM

XPM is needed by XEmacs. See http://www.inria.fr/koala/lehors/xpm.html.

Web to the Koala FTP website and download xpm-3.4k-linux.tgz.

cd /usr/src
gunzip xpm-3.4k.tar.gz
tar xf xpm-3.4k.tar
rm xpm-3.4k.tar
cd xpm-3.4k
At this point, the instructions say to run xmkmf. Do so and continue if you have it. Otherwise, skip to the next block...
cd /usr/src/xpm-3.4k
xmkmf -a
make
make install
make install.man
make clean
Here's what to do if you're on a Linux system and you don't have xmkmf...
cd /usr/src/xpm-3.4k-linux
install -m 0555 bin/cxpm bin/sxpm /usr/local/bin
mkdir /usr/local/man/man1
install -m 0644 man/man1/cxpm.1x man/man1/sxpm.1x /usr/local/man/man1
install include/X11/xpm.h /usr/X11R6/include/X11
install lib/libXpm.so.4.11 /usr/local/lib
cd /usr/local/lib
ln -s libXpm.so.4.11 libXpm.so
ln -s libXpm.so.4.11 libXpm.so.4
Here's what to do if you're on a Solaris system and you don't have xmkmf...
cd /usr/src/xpm-3.4k-solaris
install -c /usr/local/bin -m 0555 bin/cxpm
install -c /usr/local/bin -m 0555 bin/sxpm
install -c /usr/local/man/man1 -m 0644 man/man1/cxpm.1x
install -c /usr/local/man/man1 -m 0644 man/man1/sxpm.1x
install -c /usr/local/lib lib/libXpm.a
install -c /usr/local/lib lib/libXpm.so.4.11
install -c /usr/openwin/share/include/X11 include/X11/xpm.h
cd /usr/local/lib
ln -s libXpm.so.4.11 libXpm.so

Get and install PNG

PNG is needed by XEmacs. It's already installed in Red Hat Fedora Core 1. If it weren't, I'd have used apt-get instead of the old way that follows. See http://www.libpng.org/pub/png/.

cd /usr/src
ftp gate.ucar.edu
anonymous@ftp.uu.net
siemsen@ucar.edu
cd graphics/png/src
get libpng-1.0.12.tar.gz
get zlib-1.1.3.tar.gz
quit
gunzip libpng-1.0.12.tar.gz
tar xf libpng-1.0.12.tar
rm libpng-1.0.12.tar
gunzip zlib-1.1.3.tar.gz
tar xf zlib-1.1.3.tar
rm zlib-1.1.3.tar
ln -s libpng-1.0.12 libpng
ln -s zlib-1.1.3 zlib
cd zlib
./configure
make test
make install
make clean
cd ../libpng
(under Linux)
cp scripts/makefile.linux ./makefile
make test
make install
make clean
(under Solaris)
mv scripts/makefile.solaris ./makefile
make test
make install
make clean

Get XEmacs

cd /usr/src
ftp gate.ucar.edu
anonymous@ftp.xemacs.org
siemsen@ucar.edu
cd pub/xemacs/xemacs-21.5
binary
get xemacs-21.5.21.tar.gz
quit
gunzip xemacs-21.5.21.tar.gz
tar xf xemacs-21.5.21.tar
rm xemacs-21.5.21.tar

Build XEmacs

First, get and build XPM and PNG, as described above.
cd /usr/src/xemacs-21.5.21
./configure \
--with-xpm (only if the system has it) \
--with-png (only if the system has it) \
--with-sound=native,nonas (on laptop only) \
--with-postgresql (on laptop only) \
--without-ldap (on Solaris only) \
--site-libraries=/usr/local/lib (on Solaris only) \
--site-includes=/usr/openwin/include/X11:/usr/local/include (on Solaris only)
make
make install
make clean

Get XEmacs packages

Ok, now we have a runnable, minimal XEmacs. To make it useful, we need to install the XEmacs packages. Read the file README.packages in the main source directory, and...
cd /usr/local/lib/xemacs
ftp gate.ucar.edu
anonymous@ftp.xemacs.org
siemsen@ucar.edu
cd xemacs/packages
get xemacs-sumo.tar.gz
quit
gunzip xemacs-sumo.tar.gz
tar xf xemacs-sumo.tar
rm xemacs-sumo.tar

Get XEmacs documentation

cd /usr/src
mkdir xemacs-docs-21.4.8
cd xemacs-docs-21.4.8
ftp gate.ucar.edu
anonymous@ftp.xemacs.org
siemsen@ucar.edu
cd pub/xemacs/docs/letter
get emacs-lisp-intro-letter.pdf.gz
get internals-letter.pdf.gz
get lispref-letter.pdf.gz
get new-users-guide-letter.ps.gz
get xemacs-letter.pdf.gz
quit
gunzip emacs-lisp-intro-letter.pdf.gz
gunzip internals-letter.pdf.gz
gunzip lispref-letter.pdf.gz
gunzip new-users-guide-letter.ps.gz
gunzip xemacs-letter.pdf.gz

Update packages

The above itstallation installed all the packages. You can now use the package maintenance features of XEmacs to upgrade packets to their latest versions, add new packages, or delete unused packages. To do this, you need to temporarily put the machine outside the firewall.

To clean out several megabytes, delete the packages that we don't need. As root, start XEmacs, and do Tools->Packages->List & Install, then use "D" on these:

  1. Sun
  2. ada
  3. cookie
  4. crisp
  5. dictionary
  6. edict
  7. edt
  8. egg-its
  9. eicq
  10. eieio
  11. forms
  12. games
  13. jde
  14. leim
  15. locale
  16. lookup
  17. mine
  18. misc-games
  19. mule-base
  20. rmail
  21. scheme
  22. semantic
  23. skk
  24. sounds-wav
  25. speedbar
  26. tooltalk
  27. tpu
  28. vc
  29. vc-cc
  30. vhdl
  31. vm
  32. w3

then hit "x".

Install XEmacs onto Windows 2000

With Windows (any flavor) booted, web to ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe.

Notes, tricks, etc.

To execute a Perl script on the current buffer, use C-u M-|

When XEmacs can't seem to recognize the tags in an HTML file, it's probably because there isn't a DTD at the top of the file.

To get Mozilla to display a just-changed XEmacs buffer, use HTML->View in Netscape. This runs sgml-html-netscape-file, which is defined in psgml. It runs highlight-headers-follow-url-netscape, which is defined in /usr/local/lib/xemacs/xemacs-packages/lisp/mail-lib/highlight-headers.el as an alias for browse-url-netscape. browse-url-netscape is defined in /usr/local/lib/xemacs/xemacs-packages/lisp/mail-lib/browse-url.el.

Update XEmacs packages

XEmacs can go out on the net and update any packages that need updating. When XEmacs does this, it uses non-passive FTP, so you have to be outside the NCAR security perimeter for this to work. To do it, see Outside the Security Perimeter Then start XEmacs. (what next?)

mail modes

When I compose an email message, Exmh tells causes the running XEmacs to open a new frame running mh-letter mode. This is described in my mail programs page.

Electric Perl mode

My init.el cperl-hairy, which turns on all sorts of cool electric modes, including

Get SQL mode

See the SQL mode home page.

Editing encrypted files

To edit encrypted files, you need crypt.el. In 1993, crypt.el was renamed crypt++.el. Get crypt++.el and save it in /usr/local/lib/xemacs/xemacs-packages/lisp/os-utils. Then, to keep old references to crypt.el from breaking...
rm -f /usr/share/emacs/site-lisp/crypt++.el rm /usr/share/xemacs21/site-lisp/crypt++.elc cd /usr/local/lib/xemacs/xemacs-packages/lisp/os-utils
xemacs -batch -f batch-byte-compile crypt++.el
ln -s crypt++.el crypt.el
ln -s crypt++.elc crypt.elc

Then add (require 'crypt) to ~/.xemacs/init.el.

Francois Thibaud's Emacs class slides

http://www.cgd.ucar.edu/gds/thibaud/Emacs/slides.html

GNUs

Docs are at gnus.org and my.gnus.org.

News is read from the machine specified by the environment variable NNTPSERVER. GNUs keep state in ~/News and ~/.newsrc* files, but not in a ~/.newsrc. The ~/.newsrc is an old way to do things, and is used by, like, Netscape.

To start GNUs, do M-x gnus. This'll display your "Group" buffer, which lists the groups you're subscribed to.

To read a newsgroup, you have to first subscribe. To subscribe to a newsgroup, do U <name>, where name is the name of the newsgroup. Tab-completion helps. This adds the newsgroup to the group list that's displayed whenever GNUs starts. To check for new news, put the cursor on a newsgroup and hit "g".

To read news in a subscribed newsgroup, go to the group buffer, put the cursor on the newsgroup name and type SPACE, or use the middle mouse button. This'll open a Summary window for the group, showing messages by subject, sorted hierarchically. Hit a RETURN aver a message to read it.

To post a new message to a group you have open, type "a". Fill in the message and type C-c C-s to send it. To post a follow-up to a thread, use "f".

Fixing DOS-encoded files

To toggle the cr/lf's in a file (go from DOS to Unix format and back) try toggle-buffer-file-coding-system. So if you've been given a file with DOS formatting, open it in XEmacs, do toggle-buffer-file-coding-system and then save the file. That has removed DOS-ness for me in the past.

Searching for regular expressions

The XEmacs regular expression engine doesn't recognize things like \d, so to change, say, all strings of the form

width="123"
to xxx, where the 123 can be any sequence of digits, do
M-x replace-regexp
width="[0-9]+"
xxx
For more information, see pages 193-198 of the O'Reilly book titled "Mastering Regular Expressions".

Sorting

If you want sort-lines to ignore upper/lowercase, do this before running sort-lines:
in *scratch*
(defvar sort-fold-case t)
put the cursor after the ')' and do C-x C-e

Selective display

To look at say, a Juniper config file and make everything indented 8 or more spaces invisible, do "M-8 C-x $". To make everything visible aagin, do "C-x $".
Address comments or questions about this Web page to the Network Engineering & Technology Section at nets-www@ncar.ucar.edu. The NETS is part of the Scientific Computing Division of the National Center for Atmospheric Research, which is part of the University Corporation for Atmospheric Research.
Last modified: Mon Aug 29 10:48:14 MDT 2005