From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Using rot13-region in format-alist Date: Thu, 11 Sep 2008 05:04:48 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1221102316 32023 80.91.229.12 (11 Sep 2008 03:05:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Sep 2008 03:05:16 +0000 (UTC) To: "Emacs Development" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 11 05:06:11 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KdcVJ-0001nO-Am for ged-emacs-devel@m.gmane.org; Thu, 11 Sep 2008 05:05:57 +0200 Original-Received: from localhost ([127.0.0.1]:46371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdcUJ-0001aD-93 for ged-emacs-devel@m.gmane.org; Wed, 10 Sep 2008 23:04:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KdcUE-0001a4-NC for emacs-devel@gnu.org; Wed, 10 Sep 2008 23:04:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KdcUD-0001Zk-5S for emacs-devel@gnu.org; Wed, 10 Sep 2008 23:04:50 -0400 Original-Received: from [199.232.76.173] (port=49257 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdcUD-0001Zh-1N for emacs-devel@gnu.org; Wed, 10 Sep 2008 23:04:49 -0400 Original-Received: from rn-out-0910.google.com ([64.233.170.190]:61621) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KdcUC-0000ER-QK for emacs-devel@gnu.org; Wed, 10 Sep 2008 23:04:48 -0400 Original-Received: by rn-out-0910.google.com with SMTP id k32so125791rnd.7 for ; Wed, 10 Sep 2008 20:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=KEPZMG+MUsZPZTeDB74r8hoBVLXu/mM43e+opA1m7Qk=; b=KVE7mtq9DhP7M0fCwR+DJgkIZbnYjXDzoMZQ1Quo80syInYGk/c16uL4SMcKoVJHI4 oAHb+Vwk+S/Szr2eKfqSnyQiS4HRIJRxn0vaMs2RmEC37Y53uE5DHeEOspDGhmqZb/4R blLeD3CrAdMVIL3vJEHKQ7VSnHo6xWaw6ndCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=PpKhqj/yG20x1/dYLNN+94H1mzU1U2L5GyrqNxMb+Vvkqs1yqLP6+OYKiX2KX/B9Pf l83zHVN4y9HJKM7RJ8+4BFhs9ZeDy952k9Dsv4W6FiEDHgjXPEwoIuDKm+npG2hd0qZT JEWDSK8Q1rC17rVEG06hHuixRzppF7XG8i0GE= Original-Received: by 10.100.210.14 with SMTP id i14mr2715757ang.21.1221102288127; Wed, 10 Sep 2008 20:04:48 -0700 (PDT) Original-Received: by 10.100.13.13 with HTTP; Wed, 10 Sep 2008 20:04:48 -0700 (PDT) Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103793 Archived-At: 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 * 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))