From: Hrvoje Niksic <hniksic@iskon.hr>
Subject: [patch] Caesar rotation using translate-region
Date: 06 Dec 1999 15:26:12 +0100 [thread overview]
Message-ID: <9t9bt84kuwr.fsf@mraz.iskon.hr> (raw)
I noticed that message.el avoids using translate-region for rotating,
in order to preserve text properties. However, my tests show that, at
least under XEmacs, translate-region preserves the properties. And
judging by the source, it seems to me that it should preserve them
under FSF Emacs at least as well as the hand-crafted version does.
Doing it with translate-region is much, much, and visibly faster.
Especially for larger regions.
So here is a patch:
1999-12-06 Hrvoje Niksic <hniksic@iskon.hr>
* message.el (message-caesar-region): Use translate-region.
--- lisp/message.el.orig Mon Dec 6 15:21:48 1999
+++ lisp/message.el Mon Dec 6 15:21:49 1999
@@ -1707,14 +1707,7 @@
(/= (aref message-caesar-translation-table ?a) (+ ?a n)))
(setq message-caesar-translation-table
(message-make-caesar-translation-table n)))
- ;; Then we translate the region. Do it this way to retain
- ;; text properties.
- (while (< b e)
- (when (< (char-after b) 255)
- (subst-char-in-region
- b (1+ b) (char-after b)
- (aref message-caesar-translation-table (char-after b))))
- (incf b))))
+ (translate-region b e message-caesar-translation-table)))
(defun message-make-caesar-translation-table (n)
"Create a rot table with offset N."
reply other threads:[~1999-12-06 14:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9t9bt84kuwr.fsf@mraz.iskon.hr \
--to=hniksic@iskon.hr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).