1 ;;; mule-caesar.el --- ROT 13-47 Caesar rotation utility
3 ;; Copyright (C) 1997,1998 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: ROT 13-47, caesar, mail, news, text/x-rot13-47
8 ;; This file is part of APEL (A Portable Emacs Library).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (defun mule-caesar-region (start end &optional stride-ascii)
30 "Caesar rotation of current region.
31 Optional argument STRIDE-ASCII is rotation-size for Latin alphabet
32 \(A-Z and a-z). For non-ASCII text, ROT-N/2 will be performed in any
33 case (N=charset-chars; 94 for 94 or 94x94 graphic character set; 96
34 for 96 or 96x96 graphic character set)."
36 (setq stride-ascii (if stride-ascii
41 (narrow-to-region start end)
43 (while (< (point)(point-max))
44 (let* ((chr (char-after (point))))
45 (cond ((and (<= ?A chr) (<= chr ?Z))
46 (setq chr (+ chr stride-ascii))
53 ((and (<= ?a chr) (<= chr ?z))
54 (setq chr (+ chr stride-ascii))
65 (let* ((stride (lsh (charset-chars (char-charset chr)) -1))
66 (ret (mapcar (function
72 (cdr (split-char chr)))))
74 (insert (make-char (char-charset chr)
75 (car ret)(car (cdr ret))))
80 (provide 'mule-caesar)
82 ;;; mule-caesar.el ends here