From xemacs-m  Sun Jan 12 19:20:30 1997
Received: from mikan.jaist.ac.jp (mikan.jaist.ac.jp [150.65.8.6])
          by xemacs.org (8.8.4/8.8.4) with ESMTP
	  id TAA02586 for <xemacs-beta@xemacs.org>; Sun, 12 Jan 1997 19:20:03 -0600 (CST)
Received: from is18e0s01.jaist.ac.jp (MORIOKA Tomohiko <morioka@jaist.ac.jp>) by mikan.jaist.ac.jp (8.7.5); id KAA01554; Mon, 13 Jan 1997 10:12:13 +0900 (JST)
Message-Id: <199701130112.KAA01554@mikan.jaist.ac.jp>
X-MUA: mh-e 5.0.2 + tm-mh-e 7.73, tm-view 7.79
X-Face: %yc?f+O/cVKlH*K(H2X/6-d''suf|"1{S:Y0}_9$t@0G3:5M2:-Ck^[8+4^iSLeGc[Ey[WP
 PF]2M#Q9C'u~[=7TJP72J`PZdWvP=s-'-/LhFneC->=ILc~H#$lf2%hLL5U8?psIp`<[>d&@$Pm%~(
 A'"CJ.zuX@TXh\Ra4,b7M&`f"hexU-a4,#X\]Bfp'JI+MGUDRA%_$&UnWAem4}1R"4%uivgn;xFZ%"
 NS>)eCuFYNHc/:W^:{7H>bGQS],x5z[Cy~C;7j#:8y9q|"~9~UWjE<Vm_;)o<Q4S5NweLc(cl7-suY
 NF|_O*xodbmQavM
X-Emacs: Mule 2.4 =?ISO-2022-JP?B?KBskQjlITVUybBsoQik=?=
From: =?ISO-2022-JP?B?GyRCPGkyLBsoQiAbJEJDTkknGyhC?= / MORIOKA Tomohiko <morioka@jaist.ac.jp>
To: Steven L Baur <steve@miranova.com>
cc: xemacs-beta@xemacs.org
Subject: Re: 20.0-b90: more docstring warnings 
In-reply-to: Your message of "11 Jan 1997 17:57:50 PST."
             <m2zpyfwt7l.fsf@altair.xemacs.org> 
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: multipart/signed; protocol="application/pgp-signature";
 boundary="pgp-sign-Multipart_Mon_Jan_13_10:11:48_1997-1"; micalg=pgp-md5
Content-Transfer-Encoding: 7bit
Date: Mon, 13 Jan 1997 10:12:04 JST
Sender: morioka@jaist.ac.jp

--pgp-sign-Multipart_Mon_Jan_13_10:11:48_1997-1
Content-Type: multipart/mixed;
 boundary="Multipart_Mon_Jan_13_10:11:48_1997-1"
Content-Transfer-Encoding: 7bit

--Multipart_Mon_Jan_13_10:11:48_1997-1
Content-Type: text/plain; charset=US-ASCII

>>>>> In <m2zpyfwt7l.fsf@altair.xemacs.org> 
>>>>>	"sb" = Steven L Baur <steve@miranova.com> wrote:

sb> Kyle Jones writes:

sb> > [...]
sb> > Finding pointers to doc strings...
sb> > Note: Strange doc (duplicate) for bytecode find-non-ascii-charset-string @ 1229095
sb> > Note: Strange doc (duplicate) for bytecode find-non-ascii-charset-region @ 1229275
sb> > Note: Strange doc (no doc slot) for bytecode char-length @ 1229992
sb> > Note: Strange doc (duplicate) for bytecode char-columns @ 1230054
sb> > Note: Strange doc (duplicate) for bytecode string-columns @ 1230243
sb> > Note: Strange doc (duplicate) for bytecode truncate-string @ 1230447
sb> > Finding pointers to doc strings...done

sb> These are all overloaded functions duplicated in mule/mule-misc.el
sb> and tl/emu-x20.el.  As soon as we remove one of them, the messages
sb> will go away.  I don't know why emu-x20.el is being put through
sb> this process because it isn't supposed to be dumped with XEmacs
sb> any more.

  Maybe Martin copied these functions from emu-x20.el.  So I remove
them from emu-x20.el.

  By the way, could you apply following patch?

  Major point of following patch is:

	1. `-columns' -> `-width' and define `-columns' alias
	2. Import definition of `truncate-string-to-width' from
	   Emacs/mule-delta.


--Multipart_Mon_Jan_13_10:11:48_1997-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="mule-misc.el.diff"
Content-Transfer-Encoding: 7bit

--- mule-misc.el-orig	Thu Dec 19 07:43:29 1996
+++ mule-misc.el	Mon Jan 13 10:01:07 1997
@@ -53,16 +53,7 @@
 (defun string-to-char-list (str)
   (mapcar 'identity str))
 
-;;; Slower, albeit more elegant, implementation??
-;; (defun string-columns (string)
-;;  "Return number of columns STRING occupies when displayed.
-;; Uses the charset-columns attribute of the characters in STRING,
-;; which may not accurately represent the actual display width in a
-;; window system."
-;;  (loop for c across string
-;;     sum (charset-columns (char-charset c))))
-
-(defun string-columns (string)
+(defun string-width (string)
   "Return number of columns STRING occupies when displayed.
 Uses the charset-columns attribute of the characters in STRING,
 which may not accurately represent the actual display width when
@@ -75,7 +66,8 @@
       (setq i (1+ i)))
     col))
 
-(defalias 'string-width 'string-columns)
+(defalias 'string-columns 'string-width)
+(make-obsolete 'string-columns 'string-width)
 
 (defun delete-text-in-column (from to)
   "Delete the text between column FROM and TO (exclusive) of the current line.
@@ -154,22 +146,76 @@
 	   (null (car buffer-undo-list)) )
       (setq buffer-undo-list (cdr buffer-undo-list)) ))
 
+
 ;;; Common API emulation functions for GNU Emacs-merged Mule.
 ;;; As suggested by MORIOKA Tomohiko
-(defun truncate-string (str width &optional start-column)
-  "Truncate STR to fit in WIDTH columns.
-Optional non-nil arg START-COLUMN specifies the starting column."
-  (substring str (or start-column 0) width))
+
+;; Following definition were imported from Emacs/mule-delta.
+
+(defun truncate-string-to-width (str width &optional start-column padding)
+  "Truncate string STR to fit in WIDTH columns.
+Optional 1st arg START-COLUMN if non-nil specifies the starting column.
+Optional 2nd arg PADDING if non-nil, space characters are padded at
+the head and tail of the resulting string to fit in WIDTH if necessary.
+If PADDING is nil, the resulting string may be narrower than WIDTH."
+  (or start-column
+      (setq start-column 0))
+  (let ((len (length str))
+	(idx 0)
+	(column 0)
+	(head-padding "") (tail-padding "")
+	ch last-column last-idx from-idx)
+    (condition-case nil
+	(while (< column start-column)
+	  (setq ch (sref str idx)
+		column (+ column (char-width ch))
+		idx (+ idx (char-bytes ch))))
+      (args-out-of-range (setq idx len)))
+    (if (< column start-column)
+	(if padding (make-string width ?\ ) "")
+      (if (and padding (> column start-column))
+	  (setq head-padding (make-string (- column start-column) ?\ )))
+      (setq from-idx idx)
+      (condition-case nil
+	  (while (< column width)
+	    (setq last-column column
+		  last-idx idx
+		  ch (sref str idx)
+		  column (+ column (char-width ch))
+		  idx (+ idx (char-bytes ch))))
+	(args-out-of-range (setq idx len)))
+      (if (> column width)
+	  (setq column last-column idx last-idx))
+      (if (and padding (< column width))
+	  (setq tail-padding (make-string (- width column) ?\ )))
+      (setq str (substring str from-idx idx))
+      (if padding
+	  (concat head-padding str tail-padding)
+	str))))
+
+;;; For backward compatiblity ...
+;;;###autoload
+(defalias 'truncate-string 'truncate-string-to-width)
+(make-obsolete 'truncate-string 'truncate-string-to-width)
 
+;; end of imported definition
+
+
 (defalias 'sref 'aref)
 (defalias 'map-char-concat 'mapcar)
-(defun char-bytes (chr) 1)
-(defun char-length (chr) 1)
+(defun char-bytes (character)
+  "Return number of length a CHARACTER occupies in a string or buffer.
+It returns only 1 in XEmacs.  It is for compatibility with MULE 2.3."
+  1)
+(defalias 'char-length 'char-bytes)
 
-(defun char-columns (character)
+(defun char-width (character)
   "Return number of columns a CHARACTER occupies when displayed."
   (charset-columns (char-charset character)))
 
+(defalias 'char-columns 'char-width)
+(make-obsolete 'char-columns 'char-width)
+
 (defalias 'charset-description 'charset-doc-string)
 
 (defalias 'find-charset-string 'charsets-in-string)
@@ -177,43 +223,15 @@
 
 (defun find-non-ascii-charset-string (string)
   "Return a list of charsets in the STRING except ascii.
-For compatibility with Mule"
+It might be available for compatibility with Mule 2.3,
+because its `find-charset-string' ignores ASCII charset."
   (delq 'ascii (charsets-in-string string)))
 
 (defun find-non-ascii-charset-region (start end)
-  "Return a list of charsets except ascii
-in the region between START and END.
-For compatibility with Mule"
+  "Return a list of charsets except ascii in the region between START and END.
+It might be available for compatibility with Mule 2.3,
+because its `find-charset-string' ignores ASCII charset."
   (delq 'ascii (charsets-in-region start end)))
-
-;(defun truncate-string-to-column (str width &optional start-column)
-;  "Truncate STR to fit in WIDTH columns.
-;Optional non-nil arg START-COLUMN specifies the starting column."
-;  (or start-column
-;      (setq start-column 0))
-;  (let ((max-width (string-width str))
-;	(len (length str))
-;	(from 0)
-;	(column 0)
-;	to-prev to ch)
-;    (if (>= width max-width)
-;	(setq width max-width))
-;    (if (>= start-column width)
-;	""
-;      (while (< column start-column)
-;	(setq ch (aref str from)
-;	      column (+ column (char-width ch))
-;	      from (+ from (char-octets ch))))
-;      (if (< width max-width)
-;	  (progn
-;	    (setq to from)
-;	    (while (<= column width)
-;	      (setq ch (aref str to)
-;		    column (+ column (char-width ch))
-;		    to-prev to
-;		    to (+ to (char-octets ch))))
-;	    (setq to to-prev)))
-;      (substring str from to))))
 
 
 ;;; Language environments

--Multipart_Mon_Jan_13_10:11:48_1997-1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable


  Best Regards,
-- 
----------------------------------------------------------------------
MORIOKA Tomohiko <morioka@jaist.ac.jp>
        Japan advanced Institute of Science and Technology, Hokuriku
                Asahi-dai, Tatsu-no-kuchi ch=F4, Nomi, Ishikawa, Japan
------------------------------------------ Frisch, Frei, Fr=F6hlich! ---

--Multipart_Mon_Jan_13_10:11:48_1997-1--

--pgp-sign-Multipart_Mon_Jan_13_10:11:48_1997-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP MESSAGE-----
Version: 2.6.3ia
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface

iQCVAwUBMtmL3hnuUGV7wuH5AQH3lwP+Mz+RuAM+6URKoJ79AU1qufAOeuS9n5fu
m0rJ713faq7StAtKXxIyXJW8tebHV2Rg8bKrQrgMO3biq1odaDFNk6jnYVw54WT5
2hkgDLDiQRcrZEI1XwHV6Fzq3gtZI7CYvADoxHTOM31eMttbccK2D/RvKcUrgJRF
Ldol1VNpGwA=
=DUoa
-----END PGP MESSAGE-----

--pgp-sign-Multipart_Mon_Jan_13_10:11:48_1997-1--

