* they never thought I would query-replace an uppercase
@ 2002-10-28 22:01 Dan Jacobson
[not found] ` <E186wTw-00031O-00@fencepost.gnu.org>
0 siblings, 1 reply; 3+ messages in thread
From: Dan Jacobson @ 2002-10-28 22:01 UTC (permalink / 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: they never thought I would query-replace an uppercase
[not found] ` <E186wTw-00031O-00@fencepost.gnu.org>
@ 2002-10-30 22:37 ` Dan Jacobson
[not found] ` <E187YI7-0005sq-00@fencepost.gnu.org>
0 siblings, 1 reply; 3+ messages in thread
From: Dan Jacobson @ 2002-10-30 22:37 UTC (permalink / raw)
DJ> The help for query-replace-regexp just says: "Preserves case in each
DJ> replacement if `case-replace' and `case-fold-search' are non-nil and
DJ> REGEXP has no uppercase letters."
DJ> Therefore, the user in a rush to replace a certain capital letter
DJ> thinks: Oh great, I was hoping to match only "S" and not "s", but this
DJ> possibility was apparently overlooked [by guess who].
RMS> I don't understand, sorry. What is "this possibility"?
RMS> The way to match only S is to turn off case-fold-search.
Mainly the hurried user does describe-function query-replace-regexp,
and the only thing he sees semi-relevant to matching his S is that
sentence. Therefore add a sentence there advertising case-replace's
merits.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: they never thought I would query-replace an uppercase
[not found] ` <E187YI7-0005sq-00@fencepost.gnu.org>
@ 2002-11-03 21:10 ` Dan Jacobson
0 siblings, 0 replies; 3+ messages in thread
From: Dan Jacobson @ 2002-11-03 21:10 UTC (permalink / raw)
>>>>> "RMS" == Richard Stallman <rms@gnu.org> writes:
RMS> Do you think this is clear?
RMS> Matching is independent of case if `case-fold-search' is non-nil and
RMS> REGEXP has no uppercase letters. Replacement transfers the case
RMS> pattern of the old text to the new text, if `case-replace' and
RMS> `case-fold-search' are non-nil and REGEXP has no uppercase letters.
RMS> \(Transferring the case pattern means that if the old text matched is
RMS> all caps, or capitalized, then its replacement is upcased or
RMS> capitalized.)
Perhaps. However I pack a Limited Edition brain, so am not sure.
Another approach would be to just describe each affecting variable.
OK, over and out on this subject.
--
http://jidanni.org/ Taiwan(04)25854780
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-11-03 21:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-28 22:01 they never thought I would query-replace an uppercase Dan Jacobson
[not found] ` <E186wTw-00031O-00@fencepost.gnu.org>
2002-10-30 22:37 ` Dan Jacobson
[not found] ` <E187YI7-0005sq-00@fencepost.gnu.org>
2002-11-03 21:10 ` Dan Jacobson
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.