X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=emu-nemacs.el;h=d3911ffc98c6c70a3c95834957396227ecea9fdd;hb=63320164a0e83f23070a216ac47126425ecf458d;hp=e8d284753c6b5e0f695b9d243ac4dc9f161b05af;hpb=cc4dea4a6757a42ba33a9c968b4655cec18e906f;p=elisp%2Fapel.git diff --git a/emu-nemacs.el b/emu-nemacs.el index e8d2847..d3911ff 100644 --- a/emu-nemacs.el +++ b/emu-nemacs.el @@ -7,7 +7,7 @@ ;;; Author: MORIOKA Tomohiko ;;; modified by KOBAYASHI Shuhei ;;; Version: -;;; $Id: emu-nemacs.el,v 7.7 1996/02/27 17:50:41 morioka Exp $ +;;; $Id: emu-nemacs.el,v 7.8 1996/03/14 16:25:39 morioka Exp $ ;;; Keywords: emulation, compatibility, NEmacs, Mule ;;; ;;; This file is part of tl (Tiny Library). @@ -158,6 +158,37 @@ else returns nil. [emu-nemacs.el; Mule emulating function]" ) str))) +;;; Imported from Mule-2.3 +(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. +\[emu-mule.el; Mule 2.3 emulating function]" + (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-bytes 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-bytes ch)))) + (setq to to-prev))) + (substring str from to)))) + ;;; @ text property emulation ;;;