1 ;;; poem-ltn1.el --- poem implementation for Emacs 19 and XEmacs without MULE
3 ;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <tomo@m17n.org>
6 ;; Keywords: emulation, compatibility, Mule
8 ;; This file is part of APEL (A Portable Emacs Library).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;;; @ buffer representation
33 (defun-maybe set-buffer-multibyte (flag)
34 "Set the multibyte flag of the current buffer to FLAG.
35 If FLAG is t, this makes the buffer a multibyte buffer.
36 If FLAG is nil, this makes the buffer a single-byte buffer.
37 The buffer contents remain unchanged as a sequence of bytes
38 but the contents viewed as characters do change.
39 \[Emacs 20.3 emulating macro]"
46 (put 'ascii 'charset-description "Character set of ASCII")
47 (put 'ascii 'charset-registry "ASCII")
49 (put 'latin-iso8859-1 'charset-description "Character set of ISO-8859-1")
50 (put 'latin-iso8859-1 'charset-registry "ISO8859-1")
52 (defun charset-description (charset)
53 "Return description of CHARSET."
54 (get charset 'charset-description))
56 (defun charset-registry (charset)
57 "Return registry name of CHARSET."
58 (get charset 'charset-registry))
60 (defun charset-width (charset)
61 "Return number of columns a CHARSET occupies when displayed."
64 (defun charset-direction (charset)
65 "Return the direction of a character of CHARSET by
66 0 (left-to-right) or 1 (right-to-left)."
69 (defun find-charset-string (str)
70 "Return a list of charsets in the string."
71 (if (string-match "[\200-\377]" str)
75 (defalias 'find-non-ascii-charset-string 'find-charset-string)
77 (defun find-charset-region (start end)
78 "Return a list of charsets in the region between START and END."
81 (re-search-forward "[\200-\377]" end t))
85 (defalias 'find-non-ascii-charset-region 'find-charset-region)
91 (defun char-charset (char)
92 "Return the character set of char CHAR."
97 (defun char-bytes (char)
98 "Return number of bytes a character in CHAR occupies in a buffer."
101 (defun char-width (char)
102 "Return number of columns a CHAR occupies when displayed."
105 (defun split-char (character)
106 "Return list of charset and one or two position-codes of CHARACTER."
107 (cons (char-charset character) character))
109 (defalias 'char-length 'char-bytes)
111 (defmacro char-next-index (char index)
112 "Return index of character succeeding CHAR whose index is INDEX."
119 (defalias 'string-width 'length)
121 (defun string-to-char-list (str)
122 (mapcar (function identity) str))
124 (defalias 'string-to-int-list 'string-to-char-list)
126 (defalias 'sref 'aref)
128 (defun truncate-string (str width &optional start-column)
129 "Truncate STR to fit in WIDTH columns.
130 Optional non-nil arg START-COLUMN specifies the starting column.
131 \[emu-latin1.el; MULE 2.3 emulating function]"
133 (setq start-column 0))
134 (if (> (length str) width)
135 (substring str start-column width)
138 (defalias 'looking-at-as-unibyte 'looking-at)
140 ;;; @@ obsoleted aliases
142 ;;; You should not use them.
144 (defalias 'string-columns 'length)
145 (make-obsolete 'string-columns 'string-width)
152 (product-provide (provide 'poem-ltn1) (require 'apel-ver))
154 ;;; poem-ltn1.el ends here