From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Emacs Development" <emacs-devel@gnu.org>
Subject: Using rot13-region in format-alist
Date: Thu, 11 Sep 2008 05:04:48 +0200 [thread overview]
Message-ID: <f7ccd24b0809102004v6b43f27q294cda39ccd1236c@mail.gmail.com> (raw)
I have the following patch to make format-alist use rot13-region (from
lisp/rot13.el) instead of the external command "tr" for the ROT13
format. The main reason is that "tr" is not available on Windows
unless the user has installed it from one of the available
Unix-compatibility toolsets.
The only trouble is that rot13-region converts also uppercase letters
(which is IMHO a more common interpretation of how ROT13 works), while
the tr commands used in format-alist do not. That breaks compatibility
with files encoded with the current implementation. OTOH, as case is
preserved, any possible trouble is easily fixed; and it's hard to
imagine anyone using ROT13 to store valuable data anyhow.
So I'd like to go on with the commit.
Comments?
Juanma
2008-09-11 Juanma Barranquero <lekktu@gmail.com>
* format.el (format-alist): Use `rot13-region' for ROT13 format
instead of external command "tr".
* rot13.el (rot13-region): Add dummy arg BUFFER for compatibility
with `format-alist'.
Index: lisp/format.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/format.el,v
retrieving revision 1.61
diff -u -2 -r1.61 format.el
--- lisp/format.el 6 May 2008 07:57:36 -0000 1.61
+++ lisp/format.el 10 Sep 2008 15:41:32 -0000
@@ -83,5 +83,5 @@
(rot13 "rot13"
nil
- "tr a-mn-z n-za-m" "tr a-mn-z n-za-m" t nil)
+ rot13-region rot13-region t nil)
(duden "Duden Ersatzdarstellung"
nil
Index: lisp/rot13.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/rot13.el,v
retrieving revision 1.28
diff -u -2 -r1.28 rot13.el
--- lisp/rot13.el 6 May 2008 07:57:48 -0000 1.28
+++ lisp/rot13.el 10 Sep 2008 15:49:12 -0000
@@ -80,6 +80,7 @@
;;;###autoload
-(defun rot13-region (start end)
- "ROT13 encrypt the region between START and END in current buffer."
+(defun rot13-region (start end &optional buffer)
+ "ROT13 encrypt the region between START and END in current buffer.
+Optional arg BUFFER is ignored (for use in `format-alist')."
(interactive "r")
(translate-region start end rot13-translate-table))
reply other threads:[~2008-09-11 3:04 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=f7ccd24b0809102004v6b43f27q294cda39ccd1236c@mail.gmail.com \
--to=lekktu@gmail.com \
--cc=emacs-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.