GNU bug report logs - #63398
28.2; Doc or behavior of replacement commands (e.g. `replace-string')

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Tue, 9 May 2023 20:14:01 UTC

Severity: normal

Found in version 28.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "63398-done <at> debbugs.gnu.org" <63398-done <at> debbugs.gnu.org>
Subject: bug#63398: 28.2; Doc or behavior of replacement commands (e.g. `replace-string')
Date: Wed, 10 May 2023 14:20:10 +0000
> The manual says "try", and for a good reason.  There's a heuristics
> involved that tries to DTRT. The "when the NEWSTRING argument is all
> or partly lower case" part is relevant.

Yes, I assumed that.  But seeing "try" still can make
a reader wonder.

> What you expect will happen
> if the original text doesn't include digits, as in
> 
>   Testing
>   testing
> 
>   M-x replace-string RET testing RET foobar RET

Yes, I know.  That's why I included the digits - it's
this case that seems not to follow what the doc says.

Are you perhaps connecting this with your previous
sentence, about success of a "trial" depending on
NEWSTRING being partly or all lower case?  Are you
saying that if there are non-letter chars then what
the doc says might not happen because trying doesn't
succeed?

I guess it's not clear to me whether you're saying
that the behavior isn't what it should be (per the
doc) in this case, but that's unavoidable or OK, or
you're saying that the behavior does follow the doc,
and the doc is trying to say that the behavior
follows what it says only if there are no digits?

There are several variables that can affect the
behavior, which makes trying to describe (doc) and
trying to understand (reader) the behavior not so
easy.

FWIW, this was raised by a user question on reddit:

https://www.reddit.com/r/emacs/comments/13d1a5x/replacestring_keeping_case_of_the_matched_string

You closed this as fixed, but I still find the doc
- or the behavior - unclear wrt this example.
Could you maybe (e.g. here) explain a bit more how
the behavior fits the description?

> > [It's also not very good to refer to argument NEWSTRING in a topic/node
> > that doesn't define it. Users have to look backward through the doc to
> > see if they can find out which argument this is talking about.]\
> 
> Fixed.

Thx.

> In your post the em dash was the ASCII character '-',

Dunno how that happened; sorry.  It's an em dash in
the Emacs text.  And with a fixed-width font (default,
emacs -Q) the problem I cited is real.

> but on my system it is an actual em dash -- a much
> longer character, thus the confusion
> is unlikely.

How can it be a longer char, if the font is fixed width?

> As for why there are no spaces -- that's our style.

That's fine, provide the em space is actually longer
than the fixed width.

(Typographic practice varies, but a thin space is often
or typically used on each side of an em dash.)




This bug report was last modified 2 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.