From xemacs-m  Wed Jan 29 17:40:40 1997
Received: from venus.Sun.COM (venus.Sun.COM [192.9.25.5])
          by xemacs.org (8.8.4/8.8.4) with SMTP
	  id RAA06408 for <xemacs-beta@xemacs.org>; Wed, 29 Jan 1997 17:40:39 -0600 (CST)
Received: from Eng.Sun.COM ([129.146.1.25]) by venus.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id PAA26868; Wed, 29 Jan 1997 15:40:07 -0800
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id PAA10986; Wed, 29 Jan 1997 15:40:04 -0800
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id PAA08424; Wed, 29 Jan 1997 15:40:03 -0800
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id PAA07394; Wed, 29 Jan 1997 15:40:02 -0800
Date: Wed, 29 Jan 1997 15:40:02 -0800
Message-Id: <199701292340.PAA07394@xemacs.eng.sun.com>
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Steven L Baur <steve@miranova.com>,
        The Gnus Bugfixing Girls + Boys <gnus-bug@ifi.uio.no>
Cc: xemacs-beta@xemacs.org
Subject: Re: [PATCH!] Re: [rgnus-0.83] mark behavior change?
In-Reply-To: <m220b4kya2.fsf@altair.xemacs.org>
References: <vkg1zqzx9u.fsf@cdc.noaa.gov>
	<m2n2tyt96a.fsf@proletcult.slip.ifi.uio.no>
	<vkn2tvf07k.fsf@cdc.noaa.gov>
	<m2zpxvklkq.fsf@proletcult.slip.ifi.uio.no>
	<vkafpu52qn.fsf@cdc.noaa.gov>
	<m2k9oylqub.fsf@proletcult.slip.ifi.uio.no>
	<vk20b5ad9x.fsf@cdc.noaa.gov>
	<m2ohe9y6pg.fsf@proletcult.slip.ifi.uio.no>
	<vkwwswkzd7.fsf_-_@cdc.noaa.gov>
	<m220b4kya2.fsf@altair.xemacs.org>
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: text/plain; charset=US-ASCII

>>>>> "sb" == Steven L Baur <steve@miranova.com> writes:

sb> We still need to a fix for the broken message-caesar-region.
sb> tm:caesar-region is not a substitute because it only accepts an active
sb> region as input.

I sent a sample implementation of caesar-region to both Tomohiko and
Lars some time ago.  I'm sure Lars can create a working one by merging
the many implementations of caesar-region.  Here it mine again (it
has the virtue of being quite compact):

(Ben, avert thine eyes)

-----------------------------------------------------------------

(require 'cl)
(defun caesar-region (beg end stride)
      "Caesar rotation of region by STRIDE (default 13), for decrypting netnews.
ROT47 will be performed for non-ASCII text in any case."
      (interactive "r\nP")
      (setf stride (if (integerp stride) (mod stride 26) 13))
      (let ((str (buffer-substring beg end)))
	(loop for c across-ref str
	      do
	      (if (< c 128) ;; ASCII
		  (cond
		   ((and (<= ?a c) (<= c ?z))
		    (incf c stride)
		    (when (> c ?z) (decf c 26)))
		   ((and (<= ?A c) (<= c ?Z))
		    (incf c stride)
		    (when (> c ?Z) (decf c 26))))
		;; non-ASCII
		(let ((7bits (logand c 127)))
		  (when (and (< 32 7bits) (< 7bits 127))
		    (incf c (if (< 7bits 80) 47 -47))))))
	(setf (buffer-substring beg end) str)))

