comparison lisp/mule/mule-misc.el @ 418:e804706bfb8c r21-2-17

Import from CVS: tag r21-2-17
author cvs
date Mon, 13 Aug 2007 11:23:13 +0200
parents 697ef44129c6
children 41dbb7a9d5f2
comparison
equal deleted inserted replaced
417:43a18b32d56e 418:e804706bfb8c
188 "Return a list of charsets except ascii in the region between START and END. 188 "Return a list of charsets except ascii in the region between START and END.
189 It might be available for compatibility with Mule 2.3, 189 It might be available for compatibility with Mule 2.3,
190 because its `find-charset-string' ignores ASCII charset." 190 because its `find-charset-string' ignores ASCII charset."
191 (delq 'ascii (charsets-in-region start end))) 191 (delq 'ascii (charsets-in-region start end)))
192 192
193 (defun split-char (char) 193 ;(defun split-char (char)
194 "Return list of charset and one or two position-codes of CHAR." 194 ; "Return list of charset and one or two position-codes of CHAR."
195 (let ((charset (char-charset char))) 195 ; (let ((charset (char-charset char)))
196 (if (eq charset 'ascii) 196 ; (if (eq charset 'ascii)
197 (list charset (char-int char)) 197 ; (list charset (char-int char))
198 (let ((i 0) 198 ; (let ((i 0)
199 (len (charset-dimension charset)) 199 ; (len (charset-dimension charset))
200 (code (if (integerp char) 200 ; (code (if (integerp char)
201 char 201 ; char
202 (char-int char))) 202 ; (char-int char)))
203 dest) 203 ; dest)
204 (while (< i len) 204 ; (while (< i len)
205 (setq dest (cons (logand code 127) dest) 205 ; (setq dest (cons (logand code 127) dest)
206 code (lsh code -7) 206 ; code (lsh code -7)
207 i (1+ i))) 207 ; i (1+ i)))
208 (cons charset dest) 208 ; (cons charset dest)
209 )))) 209 ; ))))
210 210
211 (defun split-char-or-char-int (char) 211 (defun char-octet (ch &optional n)
212 "Return list of charset and one or two position-codes of CHAR. 212 "Return the octet numbered N (should be 0 or 1) of char CH.
213 CHAR must be character or integer." 213 N defaults to 0 if omitted."
214 (if (characterp char) 214 (let ((split (split-char ch)))
215 (split-char char) 215 (cond ((eq n 0)
216 (let ((c (int-char char))) 216 (nth 1 split))
217 (if c 217 ((eq n 1)
218 (split-char c) 218 (nth 2 split))
219 (list 'ascii c) 219 (t (error "n must be 0 or 1")))))
220 )))) 220 ;; Made obsolete June 15, 1999. Delete ASAP.
221 (make-obsolete 'char-octet "Use split-char")
222
223 ;(defun split-char-or-char-int (char)
224 ; "Return list of charset and one or two position-codes of CHAR.
225 ;CHAR must be character or integer."
226 ; (if (characterp char)
227 ; (split-char char)
228 ; (let ((c (int-char char)))
229 ; (if c
230 ; (split-char c)
231 ; (list 'ascii c)
232 ; ))))
221 233
222 234
223 ;;; Commands 235 ;;; Commands
224 236
225 (defun set-buffer-process-coding-system (decoding encoding) 237 (defun set-buffer-process-coding-system (decoding encoding)