all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: case conversion by replace-match
Date: Fri, 16 May 2003 15:32:48 -0600	[thread overview]
Message-ID: <3EC55900.10008@yahoo.com> (raw)
In-Reply-To: mailman.6326.1053119374.21513.bug-gnu-emacs@gnu.org

Andreas Schwab wrote:

> Roland Winkler <roland.winkler@physik.uni-erlangen.de> 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.


-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

  parent reply	other threads:[~2003-05-16 21:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-16 14:16 case conversion by replace-match Roland Winkler
2003-05-16 19:47 ` Stefan Monnier
2003-05-16 21:07 ` Andreas Schwab
     [not found] ` <mailman.6326.1053119374.21513.bug-gnu-emacs@gnu.org>
2003-05-16 21:32   ` Kevin Rodgers [this message]
2003-05-16 21:51     ` Andreas Schwab
2003-05-17 13:50 ` Richard Stallman
     [not found] ` <mailman.6339.1053179576.21513.bug-gnu-emacs@gnu.org>
2003-05-17 20:09   ` Roland Winkler
2003-05-19 20:24     ` Kevin Rodgers
2003-05-21  1:55       ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EC55900.10008@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.