From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: case conversion by replace-match Date: Fri, 16 May 2003 15:32:48 -0600 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3EC55900.10008@yahoo.com> References: <16068.62114.573866.744811@tfkp07.physik.uni-erlangen.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1053120901 9842 80.91.224.249 (16 May 2003 21:35:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 16 May 2003 21:35:01 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 16 23:34:59 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Gmo6-0002LS-00 for ; Fri, 16 May 2003 23:32:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GmpX-0005lX-0B for gnu-bug-gnu-emacs@m.gmane.org; Fri, 16 May 2003 17:33:31 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19Gmp5-00058Q-00 for bug-gnu-emacs@prep.ai.mit.edu; Fri, 16 May 2003 17:33:03 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Gmov-0004yv-00 for bug-gnu-emacs@prep.ai.mit.edu; Fri, 16 May 2003 17:32:56 -0400 Original-Received: from horus.isnic.is ([193.4.58.12]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Gmoh-0004di-00 for bug-gnu-emacs@prep.ai.mit.edu; Fri, 16 May 2003 17:32:39 -0400 Original-Received: from mail.fu-berlin.de (root@mail.fu-berlin.de [160.45.11.165]) by horus.isnic.is (8.12.9/8.12.9/isnic) with ESMTP id h4GLWbgO098609 for ; Fri, 16 May 2003 21:32:37 GMT (envelope-from ihs_4664@yahoo.com) Original-Received: by mail.fu-berlin.de (Smail3.2.0.98) from Curry.ZEDAT.FU-Berlin.DE (160.45.10.36) with esmtp id ; Fri, 16 May 2003 23:32:36 +0200 (MEST) Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.fu-berlin.de with bsmtp id ; Fri, 16 May 2003 23:32:36 +0200 (MEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: 170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 49 X-Orig-NNTP-Posting-Host: 170.207.51.80 X-Orig-X-Trace: fu-berlin.de 1053120756 26580095 170.207.51.80 (16 [82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5090 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5090 Andreas Schwab wrote: > Roland Winkler writes: > > |> Start a fresh emacs --no-init-file > |> > |> define the following function > |> > |> (defun foo () > |> (interactive) > |> (let (case-fold-search) > |> (while (search-forward "=FC" nil t) > |> (replace-match (string 252) nil t)))) > |> > |> `(string 252)' gives a lowercase umlaut-u (iso-latin-1) > |> > |> However, when foo is run in a buffer containing the string "=FC", > |> this string will be replaced with an uppercase umlaut-U. > > Exactly as documented. That's what I thought at first. Then I thought the "=" obviously means that not all the characters in the replacement text are capital letters, so NEXTEXT should not be uppercase'd. But then I thought the "=" divides the replacement text into 2 words, an empty word and an uppercase word; so if the empty word is ignored and an uppercase word is considered to be capitalized, then (each word in) the replacement text should be capitalized. But really, that's all just a rationalization to support the observed behavior. The user should specify FIXEDCASE as t if he/she knows that NEWTEXT is is case- precise. And Emacs should not consider "=FC" to be a sequence of capitalized words. > If you don't want this, pass a non-nil second > argument to replace-match: > > If second arg FIXEDCASE is non-nil, do not alter case of replacement text. > Otherwise maybe capitalize the whole text, or maybe just word initials, > based on the replaced text. > If the replaced text has only capital letters > and has at least one multiletter word, convert NEWTEXT to all caps. > Otherwise if all words are capitalized in the replaced text, > capitalize each word in NEWTEXT. -- Kevin Rodgers