From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Yates Newsgroups: gmane.emacs.devel Subject: case-replace Date: Wed, 16 Mar 2011 22:17:48 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1300328323 3724 80.91.229.12 (17 Mar 2011 02:18:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 Mar 2011 02:18:43 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 17 03:18:37 2011 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.69) (envelope-from ) id 1Q02nB-000088-Tr for ged-emacs-devel@m.gmane.org; Thu, 17 Mar 2011 03:18:37 +0100 Original-Received: from localhost ([127.0.0.1]:47709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q02n9-0003zw-Pw for ged-emacs-devel@m.gmane.org; Wed, 16 Mar 2011 22:18:23 -0400 Original-Received: from [140.186.70.92] (port=41897 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q02mc-0003bO-Bd for emacs-devel@gnu.org; Wed, 16 Mar 2011 22:17:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q02mb-0007ku-7R for emacs-devel@gnu.org; Wed, 16 Mar 2011 22:17:50 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:33921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q02mb-0007kM-4P for emacs-devel@gnu.org; Wed, 16 Mar 2011 22:17:49 -0400 Original-Received: by iyf13 with SMTP id 13so2904981iyf.0 for ; Wed, 16 Mar 2011 19:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=GxNNkJI3/BradyD1eo7IAMin3FtlY8K72TgssklY/KA=; b=W0eKeSCmxM0KOsGY+o0vq2zBeO/R73iW7c11g1q5uJT9N6EvemYp4HXWn2U/1ihNWz 6JE/hhBKMw/oD9JbEuYMByPwB+FQJ9FndLw6X3U1XnpOJiTbC96GomH6u86EDoRW7Y5K AhPpexPZZBzJknsm/SSo86cJHsRViOIv/qUxs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=LqCSNlAsKO8iLWzqi0HrOnvb//wEQWhiVOuhtVmry34qeBHQQi/rSVRzRZgXpTPR4e 0pfrDlp6hqezGq/zEhJ7M1PamBoEVlv8o2p33TTXZU9MoesiSnQ4CpFJZoGh+1xFrytu Mm/8cOl/IRznvinzq0w78toVwBqvClFc5HQ7E= Original-Received: by 10.43.64.2 with SMTP id xg2mr1128005icb.170.1300328268150; Wed, 16 Mar 2011 19:17:48 -0700 (PDT) Original-Received: by 10.42.158.69 with HTTP; Wed, 16 Mar 2011 19:17:48 -0700 (PDT) X-Google-Sender-Auth: TS1BdPgEhKzzNbel3-2mD6M5rrA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 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:137324 Archived-At: Here is a description of case-replace as it behaves today: | Replacement transfers the case | pattern of the old text to the new text, if `case-replace' and | `case-fold-search' are non-nil and FROM-STRING has no uppercase | letters. (Transferring the case pattern means that if the old text | matched is all caps, or capitalized, then its replacement is upcased | or capitalized.) Thus we give a request to replace 'ab' by 'xyz' we get ab -> xyz Ab -> Xyz AB -> XYZ aB -> xyz <<<< These rules make sense when FROM and TO differ in length. I often find myself replacing a FROM string with a TO of identical length. In such a case I would really appreciate it if case were preserved at each character position. E.g. replacing 'ab' by 'xy' would give me: ab -> xy Ab -> Xy AB -> XY aB -> xY <<<< /john