2 ;;; emu-nemacs.el --- Mule 2 emulation module for NEmacs
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: emu-nemacs.el,v 7.1 1995/10/11 11:49:55 morioka Exp $
10 ;;; Keywords: emulation, compatibility, NEmacs, Mule
12 ;;; This file is part of tl and tm (Tools for MIME).
21 (defconst emacs-major-version (string-to-int emacs-version))
30 (defun char-leading-char (chr)
31 "Return leading character of CHAR.
32 \[emu-nemacs.el; Mule emulating function]"
37 (defalias 'get-lc 'char-leading-char)
44 (defconst *internal* 3)
45 (defconst *euc-japan* 3)
47 (defun code-convert-string (str ic oc)
48 "Convert code in STRING from SOURCE code to TARGET code,
49 On successful converion, returns the result string,
50 else returns nil. [emu-nemacs.el; Mule emulating function]"
52 (convert-string-kanji-code str ic oc)
56 ;;; @ character and string
59 (defun char-bytes (chr)
60 "Return number of bytes CHAR will occupy in a buffer.
61 [Mule compatible function in tm-nemacs]"
64 (defun char-width (chr)
65 "Return number of columns CHAR will occupy when displayed.
66 [Mule compatible function in tm-nemacs]"
70 (defun string-width (str)
71 "Return number of columns STRING will occupy.
72 [Mule compatible function in tm-nemacs]"
75 (defun string-to-char-list (str)
76 (let ((i 0)(len (length str)) dest chr)
78 (setq chr (aref str i))
81 chr (+ (lsh chr 8) (aref str i))
83 (setq dest (cons chr dest))
89 (defun find-charset-string (str)
90 (if (string-match "[\200-\377]" str)
94 (defun find-charset-region (start end)
97 (narrow-to-region start end)
99 (re-search-forward "[\200-\377]" nil t)
104 (defun check-ASCII-string (str)
107 (setq len (length str))
110 (if (>= (elt str i) 128)
117 ;;; @ text property emulation
120 (setq tl:available-face-attribute-alist
122 ;;(bold . inversed-region)
123 (italic . underlined-region)
124 (underline . underlined-region)
127 ;; by YAMATE Keiichirou 1994/10/28
128 (defun attribute-add-narrow-attribute (attr from to)
129 (or (consp (symbol-value attr))
131 (let* ((attr-value (symbol-value attr))
132 (len (car attr-value))
135 (while (and (< posfrom len)
136 (> from (nth posfrom attr-value)))
137 (setq posfrom (1+ posfrom)))
139 (while (and (< posto len)
140 (> to (nth posto attr-value)))
141 (setq posto (1+ posto)))
142 (if (= posto posfrom)
143 (if (= (% posto 2) 1)
145 (= to (nth posto attr-value)))
146 (set-marker (nth posto attr-value) from)
147 (setcdr (nthcdr (1- posfrom) attr-value)
148 (cons (set-marker-type (set-marker (make-marker)
151 (cons (set-marker-type (set-marker (make-marker)
154 (nthcdr posto attr-value))))
155 (setcar attr-value (+ len 2))))
156 (if (= (% posfrom 2) 0)
157 (setq posfrom (1- posfrom))
158 (set-marker (nth posfrom attr-value) from))
159 (if (= (% posto 2) 0)
161 (setq posto (1- posto))
162 (set-marker (nth posto attr-value) to))
163 (setcdr (nthcdr posfrom attr-value)
164 (nthcdr posto attr-value)))))
166 (defalias 'tl:make-overlay 'cons)
168 (defun tl:overlay-put (overlay prop value)
169 (let ((ret (and (eq prop 'face)
170 (assq value tl:available-face-attribute-alist)
173 (attribute-add-narrow-attribute (cdr ret)
174 (car overlay)(cdr overlay))
177 (defun tl:add-text-properties (start end properties &optional object))
183 (provide 'emu-nemacs)