* case sensitive replacement doesn't seem to work
@ 2014-04-10 14:11 Bogolisk
2014-04-10 14:27 ` Andreas Schwab
2014-04-10 14:31 ` David Kastrup
0 siblings, 2 replies; 4+ messages in thread
From: Bogolisk @ 2014-04-10 14:11 UTC (permalink / raw)
To: emacs-devel
Hi
In this example, the "%s" replacement text is always upcased to "%S"
regardless
of the value of case-fold-search or case-replace.
(let ((case-fold-search nil)
(case-replace nil)
(orig-string "this is a FOO bar")
new-string)
(when (string-match "FOO" orig-string)
(setq new-string (replace-match "%s" nil t orig-string))
(message "orig:`%s' new:`%s'" orig-string new-string)))
in both 23.1.1 and 24.3.50.1, the message is always:
"orig:`this is a FOO bar' new:`this is a %S bar'"
Is this a bug or expected behaviour?
--
Bogolisk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: case sensitive replacement doesn't seem to work
2014-04-10 14:11 case sensitive replacement doesn't seem to work Bogolisk
@ 2014-04-10 14:27 ` Andreas Schwab
2014-04-10 14:31 ` David Kastrup
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2014-04-10 14:27 UTC (permalink / raw)
To: Bogolisk; +Cc: emacs-devel
Bogolisk <bogolisk@gmail.com> writes:
> In this example, the "%s" replacement text is always upcased to "%S"
> regardless
> of the value of case-fold-search or case-replace.
case-replace has no effect on replace-match.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: case sensitive replacement doesn't seem to work
2014-04-10 14:11 case sensitive replacement doesn't seem to work Bogolisk
2014-04-10 14:27 ` Andreas Schwab
@ 2014-04-10 14:31 ` David Kastrup
2014-04-10 14:37 ` Bogolisk
1 sibling, 1 reply; 4+ messages in thread
From: David Kastrup @ 2014-04-10 14:31 UTC (permalink / raw)
To: emacs-devel
Bogolisk <bogolisk@gmail.com> writes:
> Hi
>
> In this example, the "%s" replacement text is always upcased to "%S"
> regardless
> of the value of case-fold-search or case-replace.
>
>
> (let ((case-fold-search nil)
> (case-replace nil)
> (orig-string "this is a FOO bar")
> new-string)
> (when (string-match "FOO" orig-string)
> (setq new-string (replace-match "%s" nil t orig-string))
> (message "orig:`%s' new:`%s'" orig-string new-string)))
>
>
> in both 23.1.1 and 24.3.50.1, the message is always:
>
> "orig:`this is a FOO bar' new:`this is a %S bar'"
>
>
> Is this a bug or expected behaviour?
replace-match is a built-in function in `C source code'.
(replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING SUBEXP)
[...]
If optional second arg FIXEDCASE is non-nil, do not alter the case of
the 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.
[...]
So why are you setting FIXEDCASE to nil here?
--
David Kastrup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: case sensitive replacement doesn't seem to work
2014-04-10 14:31 ` David Kastrup
@ 2014-04-10 14:37 ` Bogolisk
0 siblings, 0 replies; 4+ messages in thread
From: Bogolisk @ 2014-04-10 14:37 UTC (permalink / raw)
To: emacs-devel
David Kastrup <dak <at> gnu.org> writes:
>
>
> So why are you setting FIXEDCASE to nil here?
>
brainfart!
Thank you for pointing it out....
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-10 14:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 14:11 case sensitive replacement doesn't seem to work Bogolisk
2014-04-10 14:27 ` Andreas Schwab
2014-04-10 14:31 ` David Kastrup
2014-04-10 14:37 ` Bogolisk
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).