From xemacs-m  Mon Mar 31 13:30:17 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id NAA01131
	for <xemacs-beta@xemacs.org>; Mon, 31 Mar 1997 13:30:14 -0600 (CST)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.5/8.8.5) id LAA23405;
	Mon, 31 Mar 1997 11:42:54 -0800
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: [20.1 Patch] preceding-char/following-char lossage
	in lisp/mule/kinsoku.el
X-Url: http://www.miranova.com/%7Esteve/
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
Mime-Version: 1.0 (generated by tm-edit 7.106)
Content-Type: text/plain; charset=US-ASCII
Date: 31 Mar 1997 11:42:51 -0800
Message-ID: <m29133voec.fsf@altair.xemacs.org>
Lines: 82
X-Mailer: Gnus v5.4.39/XEmacs 20.1(beta11)

From a problem reported by Michael Harnois.

xemacs -q -no-site-file
M-x w3-fetch http://www.excite.com/
Signaling: (wrong-type-argument characterp 0)
  char-in-category-p(0 ?j)

(Ouch?  How come the Japanese comments don't appear as Japanese?)

Index: lisp/mule/kinsoku.el
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/lisp/mule/kinsoku.el,v
retrieving revision 1.1
diff -u -r1.1 kinsoku.el
--- kinsoku.el	1997/03/16 03:10:54	1.1
+++ kinsoku.el	1997/03/31 19:25:53
@@ -195,12 +195,13 @@
 Uses category \'s\' to check.
 point$B$G2~9T$9$k$H9TF,6XB'$K?($l$k$+$I$&$+$r$+$($9!#(B
 $B9TF,6XB'J8;z$O(B\'s\'$B$N(Bcategory$B$G;XDj$9$k!#(B"
-  (let ((ch (following-char)))
-    (if (or
-	 (and kinsoku-ascii (char-in-category-p ch ?a))
-	 (and kinsoku-jis (char-in-category-p ch ?j))
-	 (and kinsoku-gb (char-in-category-p ch ?c))
-	 (and kinsoku-big5 (char-in-category-p ch ?t)))
+  (let ((ch (char-after)))
+    (if (and ch
+	     (or
+	      (and kinsoku-ascii (char-in-category-p ch ?a))
+	      (and kinsoku-jis (char-in-category-p ch ?j))
+	      (and kinsoku-gb (char-in-category-p ch ?c))
+	      (and kinsoku-big5 (char-in-category-p ch ?t))))
 	(char-in-category-p ch ?s)
       nil)))
 
@@ -209,12 +210,13 @@
 Uses category \'e\' to check.
 point$B$G2~9T$9$k$H9TKv6XB'$K?($l$k$+$I$&$+$r$+$($9!#(B
 $B9TKv6XB'J8;z$O(B\'s\'$B$N(Bcategory$B$G;XDj$9$k!#(B"
-  (let ((ch (preceding-char)))
-    (if (or
-	 (and kinsoku-ascii (char-in-category-p ch ?a))
-	 (and kinsoku-jis (char-in-category-p ch ?j))
-	 (and kinsoku-gb (char-in-category-p ch ?c))
-	 (and kinsoku-big5 (char-in-category-p ch ?t)))
+  (let ((ch (char-before)))
+    (if (and ch
+	     (or
+	      (and kinsoku-ascii (char-in-category-p ch ?a))
+	      (and kinsoku-jis (char-in-category-p ch ?j))
+	      (and kinsoku-gb (char-in-category-p ch ?c))
+	      (and kinsoku-big5 (char-in-category-p ch ?t))))
 	(char-in-category-p ch ?e)
       nil)))
 
@@ -248,8 +250,9 @@
 			   kinsoku-extend-limit
 			 10000)))  ;;; 10000 is deliberatly unreasonably large
 	ch1 ch2)
-    (while (and (<= (+ (current-column)
-		       (char-width (setq ch1 (following-char))))
+    (while (and (setq ch1 (char-after))
+		(<= (+ (current-column)
+		       (char-width ch1 ))
 		    max-column)
 		(not (bolp))
 		(not (eolp))
@@ -257,7 +260,8 @@
 		    (kinsoku-bol-p)
 	            ;;; don't break in the middle of an English word
 		    (and (char-in-category-p ch1 ?a)
-			 (char-in-category-p (setq ch2 (preceding-char)) ?a)
+			 (setq ch2 (char-before))
+			 (char-in-category-p ch2 ?a)
 			 (= ?w (char-syntax ch2))
 			 (= ?w (char-syntax ch1)))))
       (forward-char))

-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.

