From dd959fee54edf9e7dbb451c326bee79d501f2139 Mon Sep 17 00:00:00 2001 From: morioka Date: Fri, 5 Jun 1998 00:26:48 +0000 Subject: [PATCH] (split-char): Redefine if it has bug. (char-to-octet-list): Use `split-char'. --- mule-caesar.el | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/mule-caesar.el b/mule-caesar.el index 785db3a..5a6047f 100644 --- a/mule-caesar.el +++ b/mule-caesar.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1997 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; 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). @@ -25,17 +25,30 @@ ;;; 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. -- 1.7.10.4