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.0 1995/10/05 12:16:34 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 check-ASCII-string (str)
92 (setq len (length str))
95 (if (>= (elt str i) 128)
102 ;;; @ text property emulation
105 (setq tl:available-face-attribute-alist
107 ;;(bold . inversed-region)
108 (italic . underlined-region)
109 (underline . underlined-region)
112 ;; by YAMATE Keiichirou 1994/10/28
113 (defun attribute-add-narrow-attribute (attr from to)
114 (or (consp (symbol-value attr))
116 (let* ((attr-value (symbol-value attr))
117 (len (car attr-value))
120 (while (and (< posfrom len)
121 (> from (nth posfrom attr-value)))
122 (setq posfrom (1+ posfrom)))
124 (while (and (< posto len)
125 (> to (nth posto attr-value)))
126 (setq posto (1+ posto)))
127 (if (= posto posfrom)
128 (if (= (% posto 2) 1)
130 (= to (nth posto attr-value)))
131 (set-marker (nth posto attr-value) from)
132 (setcdr (nthcdr (1- posfrom) attr-value)
133 (cons (set-marker-type (set-marker (make-marker)
136 (cons (set-marker-type (set-marker (make-marker)
139 (nthcdr posto attr-value))))
140 (setcar attr-value (+ len 2))))
141 (if (= (% posfrom 2) 0)
142 (setq posfrom (1- posfrom))
143 (set-marker (nth posfrom attr-value) from))
144 (if (= (% posto 2) 0)
146 (setq posto (1- posto))
147 (set-marker (nth posto attr-value) to))
148 (setcdr (nthcdr posfrom attr-value)
149 (nthcdr posto attr-value)))))
151 (defalias 'tl:make-overlay 'cons)
153 (defun tl:overlay-put (overlay prop value)
154 (let ((ret (and (eq prop 'face)
155 (assq value tl:available-face-attribute-alist)
158 (attribute-add-narrow-attribute (cdr ret)
159 (car overlay)(cdr overlay))
162 (defun tl:add-text-properties (start end properties &optional object))
168 (provide 'emu-nemacs)