* Using rot13-region in format-alist
@ 2008-09-11 3:04 Juanma Barranquero
0 siblings, 0 replies; only message in thread
From: Juanma Barranquero @ 2008-09-11 3:04 UTC (permalink / raw
To: Emacs Development
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))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-11 3:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-11 3:04 Using rot13-region in format-alist Juanma Barranquero
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.