[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case conversion by replace-match

From: Andreas Schwab
Subject: Re: case conversion by replace-match
Date: Fri, 16 May 2003 23:07:40 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3.50 (gnu/linux)

Roland Winkler <address@hidden> 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.  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.


Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 N├╝rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]