unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: John Yates <john@yates-sheets.org>
Cc: emacs-devel@gnu.org
Subject: Re: case-replace
Date: Thu, 17 Mar 2011 16:20:33 -0400	[thread overview]
Message-ID: <jwv8vwdld1s.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTi=LW=BSq3EZb5nEziXo15pNfc8Xa2q7hQh-YVz_@mail.gmail.com> (John Yates's message of "Wed, 16 Mar 2011 22:17:48 -0400")

> 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    <<<<

If you replace foobar with mrtoto, it would then replace FooBar with
MrtOto whereas you probably wanted MrToto instead.
There's no way for Emacs to know what you really mean here, so the only
solution I can see is to somehow let the user tell Emacs what she wants,
but I'm not sure how best to do that:
- prompt the user when encountering a new mixed-case word.
- let the user specify a case-insensitive replacement of FooBar by MrToto
  (currently if you specify such a replacement, Emacs will do it is
  a case-sensitive way).
- something else?


        Stefan



  parent reply	other threads:[~2011-03-17 20:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17  2:17 case-replace John Yates
2011-03-17  7:00 ` case-replace Leo
2011-03-17 14:54   ` case-replace John Yates
2011-03-18  9:06     ` case-replace Leo
2011-03-17 20:20 ` Stefan Monnier [this message]
2011-03-18 12:42   ` case-replace John Yates
2011-03-18 15:23     ` case-replace Andreas Röhler

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv8vwdld1s.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=john@yates-sheets.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).