[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
they never thought I would query-replace an uppercase
From: |
Dan Jacobson |
Subject: |
they never thought I would query-replace an uppercase |
Date: |
29 Oct 2002 06:01:10 +0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
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
- they never thought I would query-replace an uppercase,
Dan Jacobson <=