From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] Add compat.el Date: Fri, 08 Oct 2021 09:59:45 +0000 Message-ID: <874k9r96r2.fsf@posteo.net> References: <877dfavmzw.fsf@posteo.net> <87y278ieeh.fsf@posteo.net> <87y274mugn.fsf@posteo.net> <83czogys8x.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12034"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 08 12:01:23 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYmgt-0002vf-C8 for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Oct 2021 12:01:23 +0200 Original-Received: from localhost ([::1]:46802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYmgs-0001MI-Bn for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Oct 2021 06:01:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYmfP-0000BQ-F9 for emacs-devel@gnu.org; Fri, 08 Oct 2021 05:59:51 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:48579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYmfN-00079a-Dq for emacs-devel@gnu.org; Fri, 08 Oct 2021 05:59:51 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id C24D1240101 for ; Fri, 8 Oct 2021 11:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1633687186; bh=126BIhXS3xz0DMix+fksJgxS7sSc5cy1EwVNDgZjW0c=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=Dn2wnpkx/27edfj3qKc2Drs2bh63qhkyAsv1OEH0Lf6E+13D33BkMRC24YYWETD+7 XMZRq/XYWPBcF8z7dwwzdn2D2OQ8JKi4G6S65N7XYyy3HSWdGTEWu4HiIde5jWTQem tSxuQJlbds18R/N9WVoYx6i0MZSKn3gSjccBn3BTjuhWmk+4hSxfJnSR2SSXhxw5H4 CqUTE6OTjHOnM8VH97iYCsj/GdpU2ra3HgL/AF12iaoVYixz2Cl2m8mh+U6wcYs5Z3 LQVi5v964cWcD//kD2v9Bn6fItfx5iWQKGUKtWjqIeztyAMaTXck5vWJyTD27PsU8/ jc7NuTLETtHeA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HQkFG2HFfz9rxD; Fri, 8 Oct 2021 11:59:46 +0200 (CEST) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:276543 Archived-At: Eli Zaretskii writes: >> From: Philip Kaludercic >> Date: Thu, 07 Oct 2021 20:49:12 +0000 >> >> >From Emacs 27 onwards, this works as expected: >> >> (string-replace "\377" "x" "a\377b") >> ;; => "axb" >> >> internally, the compatibility function for string-replace uses >> replace-regexp-in-string. >> >> The same code, when evaluated by a version of Emacs older than 27 fails >> to replace the character >> >> (string-replace "\377" "x" "a\377b") >> ;; => "a\377b" > > Why did you expect that to work? What is the semantics of matching > unibyte strings to multibyte strings? do you compare bytes or do you > compare characters? There are no "100% correct" answers for these > questions. The only reason I expect it is that it does work for Emacs 27.1 and newer. >> I couldn't find anything in NEWS.27 to indicate that something had >> changed, so I wonder if there was a bug that was fixed? Does anyone >> know or remember why this behaviour changed? > > This is a gray area of regexp matching, and it keeps constantly > changing in Emacs under the hood. The changes are generally seen as > "bugfixes" (though IMNSHO they aren't), and so they aren't called out > in NEWS. And what would you say there about such subtle changes, > anyway? So no one should expect it to work the same in different > versions of Emacs. True, but my concern here is to provide older versions of Emacs with the same behaviour (for these newer functions, like string-search and string-replace), so I do have to take it into consideration. -- Philip Kaludercic