GNU bug report logs -
#36372
27.0.50; replace-regexp-in-string skips START first chars in return value
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Tue, 25 Jun 2019 12:41:02 UTC
Severity: normal
Found in version 27.0.50
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
26 juni 2019 kl. 17.59 skrev Clément Pit-Claudel <cpitclaudel <at> gmail.com>:
>
>> (1) Does this code, in company-coq--loc-fully-qualified-name, actually work the way you intended? (Looks like it.)
>
> Yes, I think it does. It's a bit inscrutable, so here's an annotated copy:
Thanks, so at least it wasn't written blindly from the docs --- good to know.
> This code would probably be clearer if I just used a substring to trim out the beginning of the string ^^
Well I thought so, but who am I to judge? If it works...
>> (2) Did you learn how the START parameter affects the return value by reading the doc string, the manual, the source code, or by testing?
>
> Almost certainly the docstring, confirmed by testing. I haven't looked at this section of the manual.
>
>> (3) Are you aware of other code using the START parameter to replace-regexp-in-string?
>
> Nothing off the top of my head, but I probably wouldn't have thought of the instance in company-coq either. A quick grep through my local sources doesn't turn up anything else, but a quick visual check isn't a very reliable method (did you use a plain grep to find the instance in company-coq, or do you have a more sophisticated trick?).
Definitely not sophisticated, just re-purposed my old regexp trawler (attached in case you want to try).
Clément, thank you very much for humouring me. We are in the unenviable position to decide whether to fix an old, unsatisfactory, apparently very rarely used interface, or to document the behaviour. The stakes are low, but it looks like the semantics will be kept after all.
26 juni 2019 kl. 17.17 skrev Eli Zaretskii <eliz <at> gnu.org>:
>
> For the manual, I'd expand a bit on this, and explained how to get the
> result you thought you will when using non-nil START (by concatenating
> with the initial substring).
All right, I added a sentence to that effect.
[0001-Document-bug-in-replace-regexp-in-string.patch (application/octet-stream, attachment)]
[trawl.el (application/octet-stream, attachment)]
This bug report was last modified 5 years and 331 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.