diff --git a/doc/Makefile b/doc/Makefile
index 37a17018df7ae015ae7cbf168d133f06ea159189..7ff56ffab8fb1e70e3f0748863b5d3b9be7a308c 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -22,76 +22,9 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se.
 #
-# $Log$
-# Revision 44.5  1997/10/11 18:19:43  byers
-# OK, det blev ytterligare några ändringar.
-# Snart dags för 0.45.1
-#
-# Revision 44.4  1997/09/27 11:43:02  byers
-# N�stan alla variabler �r dokumenterade.
-# Uppdaterade NEWS-filen f�r 0.45.1
-#
-# Revision 44.3  1997/09/16 15:07:36  byers
-# Sm�fixar
-#
-# Revision 44.2  1997/08/11 19:54:02  davidk
-# �ndrade versionsnumret till 0.45
-# Ladda ../src/widget.el manuellt n�r man bygger lyskom-variables.data
-#
-# Revision 44.1  1996/09/03 16:05:34  byers
-# Remainders for 0.44.1
-#
-# Revision 44.0  1996/08/30 14:41:32  davidk
-# �ndrade revisionsnumret till 44.0
-#
-# Revision 43.5  1996/08/30 12:32:08  davidk
-# *** empty log message ***
-#
-# Revision 43.4  1996/08/15 19:30:47  davidk
-# Version 0.43.2 sl�ppt.
-#
-# Revision 43.3  1996/08/14 13:49:16  byers
-# Nya filer f�r dokumentationsdatabasen, lite upptadering i dokumentationen
-#
-# Revision 43.2  1996/08/14 04:15:14  davidk
-# Bytte versionsnummer till 0.43.
-#
-# Revision 43.1  1996/08/07 20:00:46  davidk
-# Ny ansvarsf�rdelning mellan Makefilerna.
-#
-# Revision 43.0  1996/08/07 16:36:24  davidk
-# Nytt revisionsnummer.
-#
-# Revision 41.1  1996/08/07 16:22:53  davidk
-# Uppdaterade copyright.
-# Separerade install och release.
-#
-# Revision 41.0  1996/05/02 19:20:35  davidk
-# Nytt revisionsnummer: 41.0
-#
-# Revision 40.0  1996/03/26 08:28:01  byers
-# New version number for release of 0.40
-# Added NEWS file for 0.40
-#
-# Revision 39.0  1996/03/14 18:14:56  davidk
-# �kade revisionsnumret till 39.0.
-#
-# Revision 38.0  1994/01/06 01:47:03  linus
-# New version
-#
-# Revision 35.12  1994/01/06  00:54:49  linus
-# Fixed bugs in install.
-#
-# Revision 35.11  1994/01/06  00:40:23  linus
-# Install directive moved here.
-#
-# Revision 35.10  1994/01/06  00:04:42  linus
-# Fixed so info-nuke works even if infod using makeinfo.
-#
-#
 # If you edit this, make sure it works afterwards also. /Linus
 
-CLIENTVERSION = 0.45.1
+CLIENTVERSION = 0.45.2
 
 SHELL = /bin/sh
 RM = rm -vf
diff --git a/src/ChangeLog b/src/ChangeLog
index 3098e2886609b5717c76572e401b0aed652c551c..5f6631e1cdbd204f1572d1f477548d1899d20f6e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+Wed Oct 13 14:08:37 1999  David Byers  <davby@sen2.ida.liu.se>
+
+	* Release av 0.45.2
+
+1999-10-13  David Byers  <davby@ida.liu.se>
+
+	* Gjorde klienten mer multibytekompatibel och kompatibel med Gnu
+	Emacs 20.4 och XEmacs modell nyare.
+
 Sat Oct 11 20:32:09 1997  David Byers  <davby@sen2.ida.liu.se>
 
 	* Release av 0.45.1
diff --git a/src/Makefile b/src/Makefile
index e23a43ae20ccb889557f9a0e2f81aba8f5fd0515..4b5d10c3cbb2416e8d55c88466a0782a59e7adc0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -36,8 +36,8 @@
 # makefile too!
 #
 
-CLIENTVERSION = 0.45.1-P1
-DOCFILES=NEWS-0.45.1 MIGRATION-0.44-0.45
+CLIENTVERSION = 0.45.2
+DOCFILES=NEWS-0.45.2 NEWS-0.45.1 NEWS-0.45 MIGRATION-0.44-0.45
 
 FTPDIR=/home/davby/www-pub
 #FTPDIR = /usr/ftp/pub/lyskom/elisp-client
@@ -119,6 +119,15 @@ lyskom.el: $(HEADER) $(SOURCES)
 lyskom.elc: lyskom.el
 	$(EMACS-BATCH) -l ./lpath.el -f batch-byte-compile lyskom.el
 
+header.el: $(HEADER)
+	cat $(HEADER) > header.el
+
+%.elc: %.el header.el
+	$(EMACS-BATCH) -l ./lpath.el -l ./header.el -f batch-byte-compile $<
+
+fast: $(HEADER-ELC) $(SOURCES-ELC)
+	cat $(HEADER-ELC) $(SOURCES-ELC) > lyskom.elc
+
 check: lyskom.el
 	$(EMACS-BATCH) -l ./lpath.el -l ./lyskom.el  -l ./check-strings.el \
 			-f lyskom-check-strings
diff --git a/src/ansaphone.el b/src/ansaphone.el
index cdf83732269d600d3bedf743d3706162c6bcee91..362165e82509057b4232959857f9f2658692e8bc 100644
--- a/src/ansaphone.el
+++ b/src/ansaphone.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/async.el b/src/async.el
index 9bdeb38cb46f353a62506e958605fc521594e998..46e7b305696ef32ecf6f6e3147765f45632889b2 100644
--- a/src/async.el
+++ b/src/async.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/buffers.el b/src/buffers.el
index 82a9ffaf6e0a00310a28ab742ca37e1421b03f2a..7a3ddc4817c24e7fa2c2a33ac4fcf6cf827b6660 100644
--- a/src/buffers.el
+++ b/src/buffers.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
@@ -262,10 +262,7 @@ categories")
   (let ((buf (generate-new-buffer name)))
     (save-excursion
       (set-buffer buf)
-      (if (fboundp 'toggle-enable-multibyte-characters)
-	  (toggle-enable-multibyte-characters -1)))
-      ;;(make-local-variable 'enable-multibyte-characters)
-      ;;(setq enable-multibyte-characters nil))
+      (set-buffer-multibyte nil))
     buf))
 
 (defun lyskom-get-buffer-create (category name &optional unique)
@@ -296,10 +293,7 @@ The created buffer is made a child of the current buffer."
     (lyskom-update-inherited-variables buffer)
     (save-excursion (set-buffer buffer)
                     (setq lyskom-buffer-category category)
-		    (if (fboundp 'toggle-enable-multibyte-characters)
-			(toggle-enable-multibyte-characters -1)))
-                    ;;(make-local-variable 'enable-multibyte-characters)
-                    ;;(setq enable-multibyte-characters nil))
+                    (set-buffer-multibyte nil))
     buffer))
 
 
diff --git a/src/cache.el b/src/cache.el
index fb6e962bf3a60fe90d09d124563614861d28a86f..59f5567b901f26e4fdea01b1736c2407fbe0b2db 100644
--- a/src/cache.el
+++ b/src/cache.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/clienttypes.el b/src/clienttypes.el
index dbf7edfe497cbe50e39e9177de39faff45c05cef..bc75ffa45aafe283c01f00105677fd5d258a857b 100644
--- a/src/clienttypes.el
+++ b/src/clienttypes.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/command.el b/src/command.el
index 8f8b97d25987006134f66a9a9e5f52d22f1c4c3c..2bca901b3989c032f4c91f504925e2f5d9b8558e 100644
--- a/src/command.el
+++ b/src/command.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/commands1.el b/src/commands1.el
index 6c7a42cefcb6f1f9d33719a9bcdbec91ac556548..321bea96413b1d6a9bbb00b19bba82af34bd85e8 100644
--- a/src/commands1.el
+++ b/src/commands1.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/commands2.el b/src/commands2.el
index 932b35793a96334979c671a225361d74187a4e79..432b613df4463874363c2239071dbdc11214c608 100644
--- a/src/commands2.el
+++ b/src/commands2.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/compatibility.el b/src/compatibility.el
index 4b315593b4340833b88e416f4868b3b8e953be43..18403315593d675fe13a85c1f97856c2e2f284da 100644
--- a/src/compatibility.el
+++ b/src/compatibility.el
@@ -1,5 +1,5 @@
-;;;;; -*-unibyte: t;-*-
-;;;;; -*- emacs-lisp -*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
+;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1996  Lysator Academic Computer Association.
 ;;;;;
@@ -261,10 +261,19 @@ string to search in."
 
 
 ;;; ============================================================
-;;; Character stuff
+;;; Basic stuff
 
 (lyskom-provide-function char-to-int (c) c)
 
+(defvar enable-multibyte-characters nil)
+(lyskom-provide-function set-buffer-multibyte (arg)
+  (put 'enable-multibyte-characters 'permanent-local t)
+  (make-local-variable 'enable-multibyte-characters)
+  (setq enable-multibyte-characters arg))
+
+(lyskom-provide-function set-process-coding-system (proc &optional encoding decoding))
+
+
 ;;; ======================================================================
 ;;; Event stuff
 
diff --git a/src/completing-read.el b/src/completing-read.el
index b8404afea32e464d8183cce01e1d6ac15f53f27b..35c2aadc17856d5e8a5eb04f94318317a4b2a3b5 100644
--- a/src/completing-read.el
+++ b/src/completing-read.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
@@ -483,13 +483,25 @@ function work as a name-to-conf-stat translator."
 
 
 (defun lyskom-completing-member (string list)
-  "Check case-insensitively if STRING is a member of LIST"
-  (let (result)
-  (while (and list (not result))
-    (if (string= (lyskom-unicase string) (lyskom-unicase (car list)))
-        (setq result list)
-      (setq list (cdr list))))
-  result))
+  (let ((string (lyskom-unicase (lyskom-completing-strip-name string)))
+        (result nil))
+    (while (and list (not result))
+      (if (string= string (lyskom-unicase 
+                           (lyskom-completing-strip-name (car list))))
+          (setq result list)
+        (setq list (cdr list))))
+    result))
+
+
+(defun lyskom-completing-strip-name (string)
+  "Strip parens and crap from a name"
+  (while (string-match "([^()]*)" string)
+    (setq string (replace-match " " t t string)))
+  (while (string-match "\\s-\\s-+" string)
+    (setq string (replace-match " " t t string)))
+  (if (string-match "^\\s-*\\(.*\\S-\\)\\s-*$" string)
+      (match-string 1 string)
+    string))
 
 
 (defun lyskom-read-conf-internal-verify-type (conf-no
@@ -733,7 +745,7 @@ the LysKOM rules of string matching."
 (defun lyskom-complete-string-advance (data-list)
   (lyskom-traverse 
    el data-list
-   (string-match "\\(\\s-+\\|\\S-\\|$\\)"
+   (string-match "\\([ \t]+\\|[^ \t]\\|$\\)"
                  (aref el 2)
                  (aref el 0))
    (aset el 0 (match-end 0))))
@@ -741,7 +753,7 @@ the LysKOM rules of string matching."
 (defun lyskom-complete-string-skip-whitespace (data-list)
   (lyskom-traverse
    el data-list
-   (string-match "\\s-*" (aref el 2) (aref el 0))
+   (string-match "[ \t]*" (aref el 2) (aref el 0))
    (aset el 0 (match-end 0))))
 
 ;;;
@@ -751,7 +763,7 @@ the LysKOM rules of string matching."
 (defun lyskom-complete-string-advance-to-end-of-word (data-list)
   (lyskom-traverse
    el data-list
-   (aset el 0 (string-match "\\(\\s-\\|$\\)" 
+   (aset el 0 (string-match "\\([ \t]\\|$\\)" 
                             (aref el 2)
                             (aref el 0)))))
 
diff --git a/src/deferred-insert.el b/src/deferred-insert.el
index e073eb1151ec048416891dee805a9b939056c025..abf8af793c6cd995d79e101f71df10b273495208 100644
--- a/src/deferred-insert.el
+++ b/src/deferred-insert.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1996  Lysator Academic Computer Association.
diff --git a/src/defvar.el b/src/defvar.el
index 0df7acd27cff370d3da3795243e2c44da71ebd6e..355ffa71d5ce34bee04e918bc1aba0ef67e5bfb4 100644
--- a/src/defvar.el
+++ b/src/defvar.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
@@ -33,6 +33,7 @@
 ;;;;
 
 
+
 (defconst lyskom-clientversion-long 
   "$Id$\n"
   "Version for every file in the client.")
@@ -41,7 +42,6 @@
 (provide 'lyskom)
 
 ;; Just to get rid of a compiler warning
-(defvar enable-multibyte-characters)
 (defvar kom-dont-read-saved-variables)
 
 (defvar lyskom-local-variables nil
@@ -121,16 +121,10 @@ is saved before executing FORMS and restored when FORMS have finished."
       (set (car syms) (car vals))
       (setq syms (cdr syms)
             vals (cdr vals)))
-    (if (fboundp 'toggle-enable-multibyte-characters)
-	(toggle-enable-multibyte-characters -1))))
-    ;;(make-local-variable 'enable-multibyte-characters)
-    ;;(setq enable-multibyte-characters nil)))
+    (set-buffer-multibyte nil)))
 
          
 
-
-
-(if (not (fboundp 'def-kom-var))
 (defmacro def-kom-var (name value &rest args)
     "Define a variable with name NAME and initial value VALUE.
 Remaining args, ARGS may be
@@ -222,6 +216,8 @@ local-hook      A hook variable that is made local in LysKOM buffers."
         (setq arglist (cdr arglist)))
 
       (` (progn (dont-compile (if (and (boundp (quote (, name)))
+                                       (or (not (boundp lyskom-is-loaded))
+                                           (not lyskom-is-loaded))
                                        (listp kom-dont-read-saved-variables))
                                   (add-to-list 'kom-dont-read-saved-variables
                                                (quote (, name)))))
@@ -234,7 +230,7 @@ local-hook      A hook variable that is made local in LysKOM buffers."
                                  minibuffer
                                  widget-spec
                                  )))))))
-)
+
 
 (put 'def-kom-var 'edebug-form-spec
      '(&define name form &rest sexp))
diff --git a/src/distribution-README b/src/distribution-README
index 179ccaeea181a266897a9d18bdc124c769a1bb3d..f8f4d545699fc30a6aa937d05b4a1e3f37662706 100644
--- a/src/distribution-README
+++ b/src/distribution-README
@@ -43,17 +43,16 @@
     You need an Emacs. The client appears to work with the following
     versions of Emacs:
 
-    * XEmacs version 20.2
+    * XEmacs version 20.3
+    * XEmacs version 21.2
     * Gnu Emacs version 19.34 [1]
-    * Gnu Emacs version 20.1  [2]
+    * Gnu Emacs version 20.3 and 20.4  [2]
 
     [1] You'll have to replace the included custom package, and if you 
         use Gnus, you may have to update that as well.
 
     [2] Multibyte characters are not, and will not be, supported.
-        If you notice a case where something doesn't work, or Emacs
-        complains about "Not on a character boundary", please let us
-        know about it.
+	You may have to start your Emacs with the --unibyte flag.
 
     You need to have a recent version of the custom package installed.
     The custom.el file that is bundled with Gnu Emacs 19.34 and older
diff --git a/src/edit-text.el b/src/edit-text.el
index f33fa73d9bfa3b9939d6c28bdc54284d8865d881..36564d5d9a55944509594852db8c2b328c2f9426 100644
--- a/src/edit-text.el
+++ b/src/edit-text.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/elib-string.el b/src/elib-string.el
index a520164debda0cbc7e4426354642a34546c8821d..0f1082e9df03728d3c49901769df118a7d75e1e9 100644
--- a/src/elib-string.el
+++ b/src/elib-string.el
@@ -1,4 +1,5 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
+
 ;;;; $Id$
 ;;;; This file contains some miscellaneous string functions
 
diff --git a/src/english-strings.el b/src/english-strings.el
index c545c9c10fcba304234c8c7951a6846df18c2dcc..b994d2429d6f5872ef8b9e6e8adf173594770c85 100644
--- a/src/english-strings.el
+++ b/src/english-strings.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/filter-edit.el b/src/filter-edit.el
index c899aeedb8eda21751f0cd20db557de5009fb930..56c3458b4699869d279f6079d7ea1724908023d9 100644
--- a/src/filter-edit.el
+++ b/src/filter-edit.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1994, 1996  Lysator Academic Computer Association.
diff --git a/src/filter.el b/src/filter.el
index 0de8069f84139c27906afbee5f01f9b9d4e72731..4359bc88ab09c4c2f33195096a608ac459b2c475 100644
--- a/src/filter.el
+++ b/src/filter.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/flags.el b/src/flags.el
index 0295029114d1517e17e41e32bda02ef0408271ee..ecb6c6cca4a3f9a8a2187d337875a299178edd0b 100644
--- a/src/flags.el
+++ b/src/flags.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/internal.el b/src/internal.el
index 0d9c4cc688b22a99519b5aae95bd26f9808e641b..b839c63d0e4be456987156b5e066f5f7c61c5d67 100644
--- a/src/internal.el
+++ b/src/internal.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
@@ -369,7 +369,7 @@ most lyskom-max-pending-calls are sent to the server at the same time."
 	  (++ lyskom-number-of-pending-calls)
 	  (lyskom-process-send-string
 	   lyskom-proc
-	   (concat (car entry) (cdr entry) "\n")))))))
+	   (concat (number-to-string (car entry)) (cdr entry) "\n")))))))
 
 (defun lyskom-decrease-pending-calls ()
   "A reply has come.
diff --git a/src/komtypes.el b/src/komtypes.el
index 0c425fb7872217772dfd24bddd46f81eb4563c4f..6be79bcc78dec7ca5d919055d5d462c97f2b31df 100644
--- a/src/komtypes.el
+++ b/src/komtypes.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/language.el b/src/language.el
index 5dbb2d7f3e971c11416adaa4134e700c8291cb60..d47e3a7e785521db1bbc2dfdb7bd2024c6ff85fe 100644
--- a/src/language.el
+++ b/src/language.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/lpath.el b/src/lpath.el
index 7541f6116a90623f7aa1c0c0ea91610f86caa960..050b4cede4aa84fbfc3757e7d149782c9297afe7 100644
--- a/src/lpath.el
+++ b/src/lpath.el
@@ -1,2 +1,2 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t; -*-
 (setq load-path (cons "." load-path))
diff --git a/src/lyskom-buttons.el b/src/lyskom-buttons.el
index 43de0b77e19f3d2e3dd6e61e44d2ddcad3968d25..5053013a808a1c7fe6b7cd11c20da5fa25419448 100644
--- a/src/lyskom-buttons.el
+++ b/src/lyskom-buttons.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/lyskom-rest.el b/src/lyskom-rest.el
index baa79c8604317304a39a034b4023cb1159375942..c9535b74c0389a44cd6d7decdc560d400148a7e7 100644
--- a/src/lyskom-rest.el
+++ b/src/lyskom-rest.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
@@ -1392,14 +1392,25 @@ in lyskom-messages."
 
 
 (defun lyskom-w3-region (start end)
-  (w3-region start end)
-  (add-text-properties start (min (point-max) end) '(end-closed nil)))
+  (unwind-protect
+    (condition-case nil
+      (progn
+        (narrow-to-region start end)
+        (save-excursion
+          (let ((case-fold-search t))
+            (goto-char start)
+            (while (re-search-forward "<body[^>]*>" end t)
+              (replace-match "<body>"))))
+        (w3-region start end)
+        (w3-finish-drawing)
+        (add-text-properties (point-min) (point-max) '(end-closed nil)))
+      (error nil))))
 
 (defun lyskom-format-html (text)
-  (condition-case e (require 'w3) (error nil))
-  (add-text-properties 0 (length text) '(special-insert lyskom-w3-region) text)
-  (lyskom-signal-reformatted-text 'reformat-html)
-  (substring text 5))
+  (when (condition-case e (progn (require 'w3) t) (error nil))
+    (add-text-properties 0 (length text) '(special-insert lyskom-w3-region) text)
+    (lyskom-signal-reformatted-text 'reformat-html)
+    (substring text 5)))
 
 ;;;(defun lyskom-format-html (text)
 ;;;  (condition-case e (require 'w3) (error nil))
@@ -2830,9 +2841,7 @@ One parameter - the prompt string."
   (let ((input-string "")
 	(input-char)
 	(cursor-in-echo-area t))
-	;;(enable-multibyte-characters nil))
-    (if (fboundp 'toggle-enable-multibyte-characters)
-	(toggle-enable-multibyte-characters -1))
+    (set-buffer-multibyte nil)
     (while (not (or (eq (setq input-char 
 			      (condition-case err
 				  (read-char)
@@ -2875,21 +2884,23 @@ One parameter - the prompt string."
 
 
 ;;
-(lyskom-set-language lyskom-language)
+(if lyskom-is-loaded
+    nil
+  (lyskom-set-language lyskom-language)
 
-;; Build the menus
-;; (lyskom-build-menus)
+  ;; Build the menus
+  ;; (lyskom-build-menus)
 
 
-(or (memq 'lyskom-unread-mode-line global-mode-string)
-    (setq global-mode-string
-	  (append '("" lyskom-unread-mode-line) global-mode-string)))
-(setq lyskom-unread-mode-line
-      (list (list 'lyskom-sessions-with-unread 
-		  (lyskom-get-string 'mode-line-unread))
-	    (list 'lyskom-sessions-with-unread-letters
-		  (lyskom-get-string 'mode-line-letters))
-	    " "))
+  (or (memq 'lyskom-unread-mode-line global-mode-string)
+      (setq global-mode-string
+            (append '("" lyskom-unread-mode-line) global-mode-string)))
+  (setq lyskom-unread-mode-line
+        (list (list 'lyskom-sessions-with-unread 
+                    (lyskom-get-string 'mode-line-unread))
+              (list 'lyskom-sessions-with-unread-letters
+                    (lyskom-get-string 'mode-line-letters))
+              " "))
 
 ;;;
 ;;; Set up lyskom-line-start-chars. The reason we do it here is that
@@ -2899,69 +2910,70 @@ One parameter - the prompt string."
 
 ;;; Should work for emacs-20.3. Doesn't seem to.
 ;;; string-to-vector is a 20-ism. /mr
-;;(setq lyskom-line-start-chars
-;;      (string-to-vector lyskom-line-start-chars-string))
-
-(if (fboundp 'multibyte-char-to-unibyte)
+  ;;(setq lyskom-line-start-chars
+  ;;      (string-to-vector lyskom-line-start-chars-string))
+
+  (if (fboundp 'multibyte-char-to-unibyte)
+      (setq lyskom-line-start-chars
+            (let ((tmp (make-vector 256 nil)))
+              (mapcar 
+               (function
+                (lambda (x)
+                  (aset tmp (multibyte-char-to-unibyte x) t)))
+               lyskom-line-start-chars-string)
+              tmp))
     (setq lyskom-line-start-chars
-	  (let ((tmp (make-vector 256 nil)))
-	    (mapcar 
-	     (function
-	      (lambda (x)
-		(aset tmp (multibyte-char-to-unibyte x) t)))
-	     lyskom-line-start-chars-string)
-	    tmp))
-  (setq lyskom-line-start-chars
-	(let ((tmp (make-vector 256 nil)))
-	  (mapcar 
-	   (function
-	    (lambda (x)
-	      (aset tmp (char-to-int x) t)))
-	   lyskom-line-start-chars-string)
-	  tmp)))
+          (let ((tmp (make-vector 256 nil)))
+            (mapcar 
+             (function
+              (lambda (x)
+                (aset tmp (char-to-int x) t)))
+             lyskom-line-start-chars-string)
+            tmp)))
 		 
 
 
 ;;; Formely lyskom-swascii-commands
-;;(lyskom-define-language 'lyskom-command 'swascii
-;;  (mapcar 
-;;   (function (lambda (pair)
-;;		 (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
-;;   (lyskom-get-strings lyskom-commands 'lyskom-command)))
-
-;;(setq lyskom-swascii-header-separator 
-;;	(iso-8859-1-to-swascii lyskom-header-separator))
-;;(setq lyskom-swascii-header-subject
-;;	(iso-8859-1-to-swascii lyskom-header-subject))
-
-;;(setq lyskom-swascii-filter-actions
-;;	(mapcar 
-;;	 (function (lambda (pair)
-;;		     (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
-;;	 lyskom-filter-actions))
-;;(setq lyskom-swascii-filter-what
-;;	(mapcar 
-;;	 (function (lambda (pair)
-;;		     (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
-;;	 lyskom-filter-what))
-
-
-;; Setup the queue priorities
-(lyskom-set-queue-priority 'blocking 9)
-(lyskom-set-queue-priority 'main 9)
-(lyskom-set-queue-priority 'sending 9)
-(lyskom-set-queue-priority 'follow 9)
-(lyskom-set-queue-priority 'deferred 6)
-(lyskom-set-queue-priority 'background 6)
-(lyskom-set-queue-priority 'modeline 6)
-(lyskom-set-queue-priority 'async 3)
-(lyskom-set-queue-priority 'prefetch 0)
+  ;;(lyskom-define-language 'lyskom-command 'swascii
+  ;;  (mapcar 
+  ;;   (function (lambda (pair)
+  ;;		 (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
+  ;;   (lyskom-get-strings lyskom-commands 'lyskom-command)))
+
+  ;;(setq lyskom-swascii-header-separator 
+  ;;	(iso-8859-1-to-swascii lyskom-header-separator))
+  ;;(setq lyskom-swascii-header-subject
+  ;;	(iso-8859-1-to-swascii lyskom-header-subject))
+
+  ;;(setq lyskom-swascii-filter-actions
+  ;;	(mapcar 
+  ;;	 (function (lambda (pair)
+  ;;		     (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
+  ;;	 lyskom-filter-actions))
+  ;;(setq lyskom-swascii-filter-what
+  ;;	(mapcar 
+  ;;	 (function (lambda (pair)
+  ;;		     (cons (car pair) (iso-8859-1-to-swascii (cdr pair)))))
+  ;;	 lyskom-filter-what))
+
+
+  ;; Setup the queue priorities
+  (lyskom-set-queue-priority 'blocking 9)
+  (lyskom-set-queue-priority 'main 9)
+  (lyskom-set-queue-priority 'sending 9)
+  (lyskom-set-queue-priority 'follow 9)
+  (lyskom-set-queue-priority 'deferred 6)
+  (lyskom-set-queue-priority 'background 6)
+  (lyskom-set-queue-priority 'modeline 6)
+  (lyskom-set-queue-priority 'async 3)
+  (lyskom-set-queue-priority 'prefetch 0)
 
 
 ;;; This should be the very last lines of lyskom.el Everything should
 ;;; be loaded now, so it's time to run the lyskom-after-load-hook.
 
-(run-hooks 'lyskom-after-load-hook)
+  (run-hooks 'lyskom-after-load-hook)
+  (setq lyskom-is-loaded t))
 
 (lyskom-end-of-compilation)
 
diff --git a/src/macros.el b/src/macros.el
index a4025a4fe1a674db83e6fb22b5fef2f15f1a3a0f..ceb54a6649b65d872f84237e0516a240f9d26f69 100644
--- a/src/macros.el
+++ b/src/macros.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/menus.el b/src/menus.el
index c8a59b341787500aae9506c96afece94d039f237..414c4e8929015ef200aa3c61d3604fcaa20a3eaf 100644
--- a/src/menus.el
+++ b/src/menus.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/messages.el b/src/messages.el
index 40939f11c94c9e3c4b3e2f93539f49b8481c8f29..55585aa412017683a64e195563ec58e65c346dc0 100644
--- a/src/messages.el
+++ b/src/messages.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/option-edit.el b/src/option-edit.el
index 1a76b9441dd0adb38677dd944f99e5b2eb59cccd..3631b71c1ccea321166f292ab720fe54894e89e8 100644
--- a/src/option-edit.el
+++ b/src/option-edit.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/parse.el b/src/parse.el
index d27749b455bf51fe1e8bb532a5e812c21f0c329e..489aa98d62a0682e3cd8314f654203907904b554 100644
--- a/src/parse.el
+++ b/src/parse.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/prefetch.el b/src/prefetch.el
index 51d1a1869dd6601e5596bfef3352ca88b9fa1e63..3052a259f94189d7355661adaff683ac4f737784 100644
--- a/src/prefetch.el
+++ b/src/prefetch.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/prioritize.el b/src/prioritize.el
index 846d29aa1fd59b7a321034c1b865798c9d11d725..41c2a414566e71692901defd38acb6ac66f6a2b4 100644
--- a/src/prioritize.el
+++ b/src/prioritize.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/reading.el b/src/reading.el
index 74711a5a9987c124d9093d7f47305747fbe2d4cf..143f4c575bef705d84d60258ab29e79db4cad975 100644
--- a/src/reading.el
+++ b/src/reading.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/remote-control.el b/src/remote-control.el
index 6e1a1462fa9235bca4110e68d708637e02315949..1fa7306b83307525f6de058f19a3bb99ea1045a3 100644
--- a/src/remote-control.el
+++ b/src/remote-control.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/review.el b/src/review.el
index 2b698b1674b0c9398ad2af47709ffc4aa400e270..17f40f97550c89574640c53b9edc31d7768347be 100644
--- a/src/review.el
+++ b/src/review.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/services.el b/src/services.el
index 95fc214208a46031c3718985acb397c6033151fc..6f1c74be498c021b15ecd0b04d0a3ae975fb9f43 100644
--- a/src/services.el
+++ b/src/services.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/slow.el b/src/slow.el
index 7a4eb21e17640c142e94e89d4c36610cfeca72d9..d024a07deb22338f94b89a7536d7e3b56d7d8696 100644
--- a/src/slow.el
+++ b/src/slow.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1996  Lysator Academic Computer Association.
diff --git a/src/startup.el b/src/startup.el
index 0ba4493ec5a8feb13e046c5ae8d21657d4579696..b078c691777c50c0db5a23e28480e5fb451c5936 100644
--- a/src/startup.el
+++ b/src/startup.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
@@ -137,6 +137,7 @@ See lyskom-mode for details."
                        (setq proc (open-network-stream name buffer
                                                        proxy-host
                                                        proxy-port))
+                       (set-process-coding-system proc 'no-conversion 'iso-8859-1)
                        (lyskom-process-send-string 
                         proc
                         (format "\
@@ -144,7 +145,8 @@ connect %s:%d HTTP/1.0\r\n\
 \r\n"
                                 host port)))
                       (t (setq proc (open-network-stream name buffer
-                                                         host port)))))
+                                                         host port))
+                         (set-process-coding-system proc 'no-conversion 'iso-8859-1))))
 	      (switch-to-buffer buffer)
 	      (lyskom-mode)		;Clearing lyskom-default...
 	      (if session-priority
diff --git a/src/swedish-strings.el b/src/swedish-strings.el
index 4d24c51e9bac04a72ba8cd8360359bfd0c838efb..2d8b4c7bb718c2621a0d95894a2559c7db19f104 100644
--- a/src/swedish-strings.el
+++ b/src/swedish-strings.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/utilities.el b/src/utilities.el
index 17144c44a4d75e6ade4a4fbdc4c2f047d03ad9ae..498f5623b1441462eff14c51d90bba651094b9bc 100644
--- a/src/utilities.el
+++ b/src/utilities.el
@@ -1,5 +1,5 @@
-;;;;; -*-unibyte: t;-*-
-;;;;; -*- emacs-lisp -*-
+;;;;; -*-coding: raw-text; unibyte: t;-*-
+;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1996  Lysator Academic Computer Association.
 ;;;;;
diff --git a/src/vars.el.in b/src/vars.el.in
index 30c6c7dbdb3154204704d455afaf900a1968ff89..5c05185f7aecba52d877c21b903a11126e0a8aeb 100644
--- a/src/vars.el.in
+++ b/src/vars.el.in
@@ -1,4 +1,5 @@
-;;;;; -*- emacs-lisp -*-
+;;;;; -*-coding: raw-text; unibyte: t; mode: emacs-lisp; -*-
+;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
 ;;;;;
@@ -78,6 +79,9 @@ Dont change these. These are defined by the protocol.")
   (mapcar 'make-local-variable lyskom-local-variables)
   (mapcar 'make-local-hook lyskom-local-hooks))
 
+(defvar lyskom-is-loaded nil
+  "Non-nil when lyskom has been loaded.")
+
 (def-kom-var kom-dont-read-saved-variables '(kom-dont-read-saved-variables
                                              lyskom-login-hook)
   "*Non nil means don't read some variables from the server.
diff --git a/src/view-mode.el b/src/view-mode.el
index c826a17f8fad90154da49994ad071d9a29f1de53..ef6d7abc81e95effd5587c23276e7c1203430639 100644
--- a/src/view-mode.el
+++ b/src/view-mode.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t; -*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.
diff --git a/src/view-text.el b/src/view-text.el
index 13dffb1a8dad2c3cf7743bdea17b5b3913560980..2d90eb64c27485e9c8f3dd6a60a246f04e4501cc 100644
--- a/src/view-text.el
+++ b/src/view-text.el
@@ -1,4 +1,4 @@
-;;;;; -*-unibyte: t;-*-
+;;;;; -*-coding: raw-text; unibyte: t; -*-
 ;;;;;
 ;;;;; $Id$
 ;;;;; Copyright (C) 1991, 1996  Lysator Academic Computer Association.