unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Jacobson <jidanni@dman.ddts.net>
Subject: they never thought I would query-replace an uppercase
Date: 29 Oct 2002 06:01:10 +0800	[thread overview]
Message-ID: <878z0iw7dl.fsf@jidanni.org> (raw)

In todays episode a hasty Dan is again mislead by the documentation,
whereupon he stumbles upon something that needs to be documented.  All
is well in the end though.

The help for query-replace-regexp just says: "Preserves case in each
replacement if `case-replace' and `case-fold-search' are non-nil and
REGEXP has no uppercase letters."

Therefore, the user in a rush to replace a certain capital letter
thinks: Oh great, I was hoping to match only "S" and not "s", but this
possibility was apparently overlooked [by guess who].  Same apparently
with plain query-replace.

(dired-do-query-replace-regexp "S" "000") is what I was poking around
with.  Wanna know something really funny?  That command pooped out
with "replaced 0 occurrences" resting on the first match [a little
"s"].  I had to use little "s" to get the usual behavior.
echo s>file1
echo S>file2
LC_ALL=C emacs --no-site-file -q .
m m [mark all files]
(dired-do-query-replace-regexp "S" "000")
see what I mean.

By the way, I did "man ascii" to get the octal code for S, but it
seems I just couldn't figure out how to fool query-replace-regexp with
it.

Back to the first problem: from the Info page we see that we should
try setting case-fold-search to nil.  [We don't see such details
elsewhere, *Help* just sends us in my initial direction.] Didn't help:
perhaps because this becomes a local "t" variable in each new buffer
dired visits.

So you might mention on the dired-do-query-replace-regexp Help blurb
to do (set-default 'case-fold-search nil), which apparently has got me
rolling again.
-- 
http://jidanni.org/ Taiwan(04)25854780

             reply	other threads:[~2002-10-28 22:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-28 22:01 Dan Jacobson [this message]
     [not found] ` <E186wTw-00031O-00@fencepost.gnu.org>
2002-10-30 22:37   ` they never thought I would query-replace an uppercase Dan Jacobson
     [not found]     ` <E187YI7-0005sq-00@fencepost.gnu.org>
2002-11-03 21:10       ` Dan Jacobson

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=878z0iw7dl.fsf@jidanni.org \
    --to=jidanni@dman.ddts.net \
    /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).