From 0a79c01397e478e819b2020c3c491fe7d8b17ac1 Mon Sep 17 00:00:00 2001
From: David Byers <david.byers@liu.se>
Date: Wed, 13 Oct 1999 12:12:41 +0000
Subject: [PATCH] =?UTF-8?q?Synkning=20inf=C3=B6r=20release=20av=200.45.2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 doc/Makefile            |  69 +----------------
 src/ChangeLog           |   9 +++
 src/Makefile            |  13 +++-
 src/ansaphone.el        |   2 +-
 src/async.el            |   2 +-
 src/buffers.el          |  12 +--
 src/cache.el            |   2 +-
 src/clienttypes.el      |   2 +-
 src/command.el          |   2 +-
 src/commands1.el        |   2 +-
 src/commands2.el        |   2 +-
 src/compatibility.el    |  15 +++-
 src/completing-read.el  |  34 ++++++---
 src/deferred-insert.el  |   2 +-
 src/defvar.el           |  16 ++--
 src/distribution-README |   9 +--
 src/edit-text.el        |   2 +-
 src/elib-string.el      |   3 +-
 src/english-strings.el  |   2 +-
 src/filter-edit.el      |   2 +-
 src/filter.el           |   2 +-
 src/flags.el            |   2 +-
 src/internal.el         |   4 +-
 src/komtypes.el         |   2 +-
 src/language.el         |   2 +-
 src/lpath.el            |   2 +-
 src/lyskom-buttons.el   |   2 +-
 src/lyskom-rest.el      | 162 +++++++++++++++++++++-------------------
 src/macros.el           |   2 +-
 src/menus.el            |   2 +-
 src/messages.el         |   2 +-
 src/option-edit.el      |   2 +-
 src/parse.el            |   2 +-
 src/prefetch.el         |   2 +-
 src/prioritize.el       |   2 +-
 src/reading.el          |   2 +-
 src/remote-control.el   |   2 +-
 src/review.el           |   2 +-
 src/services.el         |   2 +-
 src/slow.el             |   2 +-
 src/startup.el          |   6 +-
 src/swedish-strings.el  |   2 +-
 src/utilities.el        |   4 +-
 src/vars.el.in          |   6 +-
 src/view-mode.el        |   2 +-
 src/view-text.el        |   2 +-
 46 files changed, 203 insertions(+), 223 deletions(-)

diff --git a/doc/Makefile b/doc/Makefile
index 37a17018..7ff56ffa 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 3098e288..5f6631e1 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 e23a43ae..4b5d10c3 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 cdf83732..362165e8 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 9bdeb38c..46e7b305 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 82a9ffaf..7a3ddc48 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 fb6e962b..59f5567b 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 dbf7edfe..bc75ffa4 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 8f8b97d2..2bca901b 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 6c7a42ce..321bea96 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 932b3579..432b613d 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 4b315593..18403315 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 b8404afe..35c2aadc 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 e073eb11..abf8af79 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 0df7acd2..355ffa71 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 179ccaee..f8f4d545 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 f33fa73d..36564d5d 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 a520164d..0f1082e9 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 c545c9c1..b994d242 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 c899aeed..56c3458b 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 0de8069f..4359bc88 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 02950291..ecb6c6cc 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 0d9c4cc6..b839c63d 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 0c425fb7..6be79bcc 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 5dbb2d7f..d47e3a7e 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 7541f611..050b4ced 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 43de0b77..5053013a 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 baa79c86..c9535b74 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 a4025a4f..ceb54a66 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 c8a59b34..414c4e89 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 40939f11..55585aa4 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 1a76b944..3631b71c 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 d27749b4..489aa98d 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 51d1a186..3052a259 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 846d29aa..41c2a414 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 74711a5a..143f4c57 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 6e1a1462..1fa7306b 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 2b698b16..17f40f97 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 95fc2142..6f1c74be 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 7a4eb21e..d024a07d 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 0ba4493e..b078c691 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 4d24c51e..2d8b4c7b 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 17144c44..498f5623 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 30c6c7db..5c05185f 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 c826a17f..ef6d7abc 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 13dffb1a..2d90eb64 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.
-- 
GitLab