;; Copyright (C) 1997 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: mule-caesar.el,v 1.3 1997-05-09 02:47:55 morioka Exp $
+;; Version: $Id: mule-caesar.el,v 1.4 1998-06-05 00:26:48 morioka Exp $
;; Keywords: ROT 13-47, caesar, mail, news, text/x-rot13-47
;; This file is part of APEL (A Portable Emacs Library).
;;; Code:
+;; avoid bug of XEmacs
+(or (integerp (cdr (split-char ?a)))
+ (defun split-char (char)
+ "Return list of charset and one or two position-codes of CHAR."
+ (let ((charset (char-charset char)))
+ (if (eq charset 'ascii)
+ (list charset (char-int char))
+ (let ((i 0)
+ (len (charset-dimension charset))
+ (code (if (integerp char)
+ char
+ (char-int char)))
+ dest)
+ (while (< i len)
+ (setq dest (cons (logand code 127) dest)
+ code (lsh code -7)
+ i (1+ i)))
+ (cons charset dest)
+ ))))
+ )
+
(defun char-to-octet-list (character)
"Return list of octets in code table of graphic character set."
- (let* ((code (char-int character))
- (dim (charset-dimension (char-charset code)))
- dest)
- (while (> dim 0)
- (setq dest (cons (logand code 127) dest)
- dim (1- dim)
- code (lsh code -7))
- )
- dest))
+ (cdr (split-char character)))
(defun mule-caesar-region (start end &optional stride-ascii)
"Caesar rotation of current region.