From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: phillip.lord@newcastle.ac.uk (Phillip Lord) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Nov 2014 17:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19208@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141719404429669 (code B ref -1); Fri, 28 Nov 2014 17:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Nov 2014 17:00:44 +0000 Received: from localhost ([127.0.0.1]:48618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XuOuR-0007iS-FI for submit@debbugs.gnu.org; Fri, 28 Nov 2014 12:00:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40027) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XuOuO-0007iI-Ul for submit@debbugs.gnu.org; Fri, 28 Nov 2014 12:00:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuOuF-0002dA-8Y for submit@debbugs.gnu.org; Fri, 28 Nov 2014 12:00:40 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:51254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuOuF-0002d1-6Y for submit@debbugs.gnu.org; Fri, 28 Nov 2014 12:00:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuOu8-0004mF-FN for bug-gnu-emacs@gnu.org; Fri, 28 Nov 2014 12:00:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuOu2-0002Ns-BF for bug-gnu-emacs@gnu.org; Fri, 28 Nov 2014 12:00:24 -0500 Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:51141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuOu2-0002NR-6C for bug-gnu-emacs@gnu.org; Fri, 28 Nov 2014 12:00:18 -0500 Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1XuOu0-0000ga-DL for bug-gnu-emacs@gnu.org; Fri, 28 Nov 2014 17:00:16 +0000 Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XuOu0-0005bm-0O for bug-gnu-emacs@gnu.org; Fri, 28 Nov 2014 17:00:16 +0000 From: phillip.lord@newcastle.ac.uk (Phillip Lord) Date: Fri, 28 Nov 2014 17:00:15 +0000 Message-ID: <87r3wn5kgw.fsf@newcastle.ac.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Occurs in Emacs 24.3 and trunk Running this code in *scratch* buffer (progn (goto-char (point-min)) (re-search-forward "This") (replace-match "That" nil nil nil)) Now undo and run this code (progn (goto-char (point-min)) (re-search-forward "This") (replace-match "That" nil nil nil 1)) This causes the following error. progn: Args out of range: -1, -1 The error is caused because I have asked for a subexp that doesn't exist in the regexp. A programmer error for sure, but the Args out of range error seems rather unfriendly to me, especially as I have no idea where the -1, or -1 has come from. "Attempt to replace regexp subexpression that doesn't exist", for example, would be nicer. From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 14:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: phillip.lord@newcastle.ac.uk (Phillip Lord) Cc: 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156484088421098 (code B ref 19208); Sat, 03 Aug 2019 14:02:02 +0000 Received: (at 19208) by debbugs.gnu.org; 3 Aug 2019 14:01:24 +0000 Received: from localhost ([127.0.0.1]:59662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htub5-0005UE-Rn for submit@debbugs.gnu.org; Sat, 03 Aug 2019 10:01:24 -0400 Received: from quimby.gnus.org ([80.91.231.51]:47948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htub3-0005U2-IS for 19208@debbugs.gnu.org; Sat, 03 Aug 2019 10:01:22 -0400 Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htuay-0004xh-PP; Sat, 03 Aug 2019 16:01:19 +0200 From: Lars Ingebrigtsen References: <87r3wn5kgw.fsf@newcastle.ac.uk> Date: Sat, 03 Aug 2019 16:01:15 +0200 In-Reply-To: <87r3wn5kgw.fsf@newcastle.ac.uk> (Phillip Lord's message of "Fri, 28 Nov 2014 17:00:15 +0000") Message-ID: <87imreic0k.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: phillip.lord@newcastle.ac.uk (Phillip Lord) writes: > (progn > (goto-char (point-min)) > (re-search-forward "This") > (replace-match "That" nil nil nil 1)) > > This causes the following error. > > progn: Args out of range: -1, -1 > > The error is cause [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) phillip.lord@newcastle.ac.uk (Phillip Lord) writes: > (progn > (goto-char (point-min)) > (re-search-forward "This") > (replace-match "That" nil nil nil 1)) > > This causes the following error. > > progn: Args out of range: -1, -1 > > The error is caused because I have asked for a subexp that doesn't exist in > the regexp. A programmer error for sure, but the Args out of range error seems > rather unfriendly to me, especially as I have no idea where the -1, or > -1 has come from. > > "Attempt to replace regexp subexpression that doesn't exist", for > example, would be nicer. Yup. This is the code that signals the error: if (search_regs.start[sub] < BEGV || search_regs.start[sub] > search_regs.end[sub] || search_regs.end[sub] > ZV) args_out_of_range (make_fixnum (search_regs.start[sub]), make_fixnum (search_regs.end[sub])); Which is a weird way to check for this, surely? It looks more like a sanity checks that checks whether start[sub] and end[sub] is inside the buffer, and that the start is before the end. This happens to actually work here because when there is no match, start[sub] is -1, which is always less than BEGV. And this explains where the -1 in the args out of range comes from. The sanity check seems sensible (because the buffer may have been narrowed before calling replace-match), so I propose to add an additional check that actually explicitly checks whether the subexp is valid. Hm... or is this what the check right above it tried to do? if (NILP (subexp)) sub = 0; else { CHECK_FIXNUM (subexp); if (! (0 <= XFIXNUM (subexp) && XFIXNUM (subexp) < search_regs.num_regs)) args_out_of_range (subexp, make_fixnum (search_regs.num_regs)); sub = XFIXNUM (subexp); } Yoda conditionals and a !... Let's see... No, that's just another sanity check -- num_regs is the max allowed number of sub-matches. (I've now added some comments to clarify.) I've now added a new check to check for this situation, and I've used your suggested error string. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 03 10:01:29 2019 Received: (at control) by debbugs.gnu.org; 3 Aug 2019 14:01:29 +0000 Received: from localhost ([127.0.0.1]:59665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htubB-0005UV-78 for submit@debbugs.gnu.org; Sat, 03 Aug 2019 10:01:29 -0400 Received: from quimby.gnus.org ([80.91.231.51]:47970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htub9-0005UN-5A for control@debbugs.gnu.org; Sat, 03 Aug 2019 10:01:27 -0400 Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htub6-0004xr-HB for control@debbugs.gnu.org; Sat, 03 Aug 2019 16:01:26 +0200 Date: Sat, 03 Aug 2019 16:01:24 +0200 Message-Id: <87h86yic0b.fsf@mouse.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #19208 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 19208 fixed close 19208 27.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 19208 fixed close 19208 27.1 quit From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message References: <87r3wn5kgw.fsf@newcastle.ac.uk> In-Reply-To: <87r3wn5kgw.fsf@newcastle.ac.uk> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 20:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Lars Ingebrigtsen Cc: Phillip Lord , 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156486376032678 (code B ref 19208); Sat, 03 Aug 2019 20:23:02 +0000 Received: (at 19208) by debbugs.gnu.org; 3 Aug 2019 20:22:40 +0000 Received: from localhost ([127.0.0.1]:60015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0Y4-0008V0-AA for submit@debbugs.gnu.org; Sat, 03 Aug 2019 16:22:40 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:36744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0Y1-0008Ul-Je for 19208@debbugs.gnu.org; Sat, 03 Aug 2019 16:22:38 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7D8791618B1; Sat, 3 Aug 2019 13:22:31 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DQiCEvab3kK3; Sat, 3 Aug 2019 13:22:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 48CFE162639; Sat, 3 Aug 2019 13:22:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id datY1iTFUlwV; Sat, 3 Aug 2019 13:22:30 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0F62A1618B1; Sat, 3 Aug 2019 13:22:30 -0700 (PDT) From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 3 Aug 2019 13:22:26 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8CEEC21914ECC17B7ED14FD6" Content-Language: en-US X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) This is a multi-part message in MIME format. --------------8CEEC21914ECC17B7ED14FD6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > No, that's just another sanity check -- num_regs is the max allowed > number of sub-matches. (I've now added some comments to clarify.) Unfortunately that patch messes up the sanity check, as the patched code allows 'sub' to be negative, or to be equal to search_regs.num_regs, and in either case this results in a bad pointer. > Yoda conditionals and a !... Actually those were Leibniz conditionals, which are comparisons involving "<" or "<=". The idea is that the conditionals' textual order reflects numeric order. This is a common style in math when doing range checking, e.g., "0 <= i < n". Yoda conditionals are expressions like "0 != x" which I agree are confusing. I learned Leibniz conditionals from the late Val Schorre, who was *really* good at programming and programming style: Knuth credits Schorre with the invention of goto-less programming in the early 1960s. When I redid your patch as a Leibniz conditional, I instantly spotted the bug that it introduced. You might give Leibniz conditionals a try, as they help make code more readable and reliable when checking for range errors or overflow. While in the neighborhood I spotted some other rare possibilities for bad behavior due to out-of-range indexes. I fixed the bugs I found by installing the attached. --------------8CEEC21914ECC17B7ED14FD6 Content-Type: text/x-patch; name="0001-Fix-rare-undefined-behaviors-in-replace-match.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-rare-undefined-behaviors-in-replace-match.patch" >From 13fe8a27042b1539d43727e6df97c386c61c3053 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 Aug 2019 12:45:19 -0700 Subject: [PATCH] Fix rare undefined behaviors in replace-match * src/search.c (Freplace_match): Simplify by caching search_regs components. Fix sanity check for out-of-range subscripts; it incorrectly allowed negative subscripts, subscripts equal to search_regs.num_regs, and it had undefined behavior for subscripts outside ptrdiff_t range. Improve wording of newly-introduced replace-match diagnostic. Rework use of opoint, to avoid setting point to an out-of-range value in rare cases involving modification hooks. --- src/search.c | 107 ++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 69 deletions(-) diff --git a/src/search.c b/src/search.c index 0e2ae059e8..9b674a5810 100644 --- a/src/search.c +++ b/src/search.c @@ -2389,44 +2389,32 @@ since only regular expressions have distinguished subexpressions. */) case_action = nochange; /* We tried an initialization */ /* but some C compilers blew it */ - if (search_regs.num_regs <= 0) + ptrdiff_t num_regs = search_regs.num_regs; + if (num_regs <= 0) error ("`replace-match' called before any match found"); if (NILP (subexp)) sub = 0; else { - CHECK_FIXNUM (subexp); + CHECK_RANGED_INTEGER (subexp, 0, num_regs - 1); sub = XFIXNUM (subexp); - /* Sanity check to see whether the subexp is larger than the - allowed number of sub-regexps. */ - if (sub >= 0 && sub > search_regs.num_regs) - args_out_of_range (subexp, make_fixnum (search_regs.num_regs)); } - /* Check whether the subexpression to replace is greater than the - number of subexpressions in the regexp. */ - if (sub > 0 && search_regs.start[sub] == -1) - args_out_of_range (build_string ("Attempt to replace regexp subexpression that doesn't exist"), - subexp); + ptrdiff_t sub_start = search_regs.start[sub]; + ptrdiff_t sub_end = search_regs.end[sub]; + eassert (sub_start <= sub_end); - /* Sanity check to see whether the text to replace is present in the - buffer/string. */ - if (NILP (string)) + /* Check whether the text to replace is present in the buffer/string. */ + if (! (NILP (string) + ? BEGV <= sub_start && sub_end <= ZV + : 0 <= sub_start && sub_end <= SCHARS (string))) { - if (search_regs.start[sub] < BEGV - || search_regs.start[sub] > search_regs.end[sub] - || search_regs.end[sub] > ZV) - args_out_of_range (make_fixnum (search_regs.start[sub]), - make_fixnum (search_regs.end[sub])); - } - else - { - if (search_regs.start[sub] < 0 - || search_regs.start[sub] > search_regs.end[sub] - || search_regs.end[sub] > SCHARS (string)) - args_out_of_range (make_fixnum (search_regs.start[sub]), - make_fixnum (search_regs.end[sub])); + if (sub_start < 0) + xsignal2 (Qerror, + build_string ("replace-match subexpression does not exist"), + subexp); + args_out_of_range (make_fixnum (sub_start), make_fixnum (sub_end)); } if (NILP (fixedcase)) @@ -2434,8 +2422,8 @@ since only regular expressions have distinguished subexpressions. */) /* Decide how to casify by examining the matched text. */ ptrdiff_t last; - pos = search_regs.start[sub]; - last = search_regs.end[sub]; + pos = sub_start; + last = sub_end; if (NILP (string)) pos_byte = CHAR_TO_BYTE (pos); @@ -2511,9 +2499,8 @@ since only regular expressions have distinguished subexpressions. */) { Lisp_Object before, after; - before = Fsubstring (string, make_fixnum (0), - make_fixnum (search_regs.start[sub])); - after = Fsubstring (string, make_fixnum (search_regs.end[sub]), Qnil); + before = Fsubstring (string, make_fixnum (0), make_fixnum (sub_start)); + after = Fsubstring (string, make_fixnum (sub_end), Qnil); /* Substitute parts of the match into NEWTEXT if desired. */ @@ -2542,12 +2529,12 @@ since only regular expressions have distinguished subexpressions. */) if (c == '&') { - substart = search_regs.start[sub]; - subend = search_regs.end[sub]; + substart = sub_start; + subend = sub_end; } else if (c >= '1' && c <= '9') { - if (c - '0' < search_regs.num_regs + if (c - '0' < num_regs && search_regs.start[c - '0'] >= 0) { substart = search_regs.start[c - '0']; @@ -2612,13 +2599,8 @@ since only regular expressions have distinguished subexpressions. */) return concat3 (before, newtext, after); } - /* Record point, then move (quietly) to the start of the match. */ - if (PT >= search_regs.end[sub]) - opoint = PT - ZV; - else if (PT > search_regs.start[sub]) - opoint = search_regs.end[sub] - ZV; - else - opoint = PT; + /* Record point. A nonpositive OPOINT is actually an offset from ZV. */ + opoint = PT <= sub_start ? PT : max (PT, sub_end) - ZV; /* If we want non-literal replacement, perform substitution on the replacement string. */ @@ -2687,7 +2669,7 @@ since only regular expressions have distinguished subexpressions. */) if (c == '&') idx = sub; - else if (c >= '1' && c <= '9' && c - '0' < search_regs.num_regs) + else if ('1' <= c && c <= '9' && c - '0' < num_regs) { if (search_regs.start[c - '0'] >= 1) idx = c - '0'; @@ -2745,25 +2727,11 @@ since only regular expressions have distinguished subexpressions. */) xfree (substed); } - /* The functions below modify the buffer, so they could trigger - various modification hooks (see signal_before_change and - signal_after_change). If these hooks clobber the match data we - error out since otherwise this will result in confusing bugs. */ - ptrdiff_t sub_start = search_regs.start[sub]; - ptrdiff_t sub_end = search_regs.end[sub]; - ptrdiff_t num_regs = search_regs.num_regs; - newpoint = search_regs.start[sub] + SCHARS (newtext); + newpoint = sub_start + SCHARS (newtext); + ptrdiff_t newstart = sub_start == sub_end ? newpoint : sub_start; /* Replace the old text with the new in the cleanest possible way. */ - replace_range (search_regs.start[sub], search_regs.end[sub], - newtext, 1, 0, 1, 1); - /* Update saved data to match adjustment made by replace_range. */ - { - ptrdiff_t change = newpoint - sub_end; - if (sub_start >= sub_end) - sub_start += change; - sub_end += change; - } + replace_range (sub_start, sub_end, newtext, 1, 0, 1, true); if (case_action == all_caps) Fupcase_region (make_fixnum (search_regs.start[sub]), @@ -2773,17 +2741,18 @@ since only regular expressions have distinguished subexpressions. */) Fupcase_initials_region (make_fixnum (search_regs.start[sub]), make_fixnum (newpoint)); - if (search_regs.start[sub] != sub_start - || search_regs.end[sub] != sub_end - || search_regs.num_regs != num_regs) + /* The replace_range etc. functions can trigger modification hooks + (see signal_before_change and signal_after_change). Try to error + out if these hooks clobber the match data since clobbering can + result in confusing bugs. Although this sanity check does not + catch all possible clobberings, it should catch many of them. */ + if (! (search_regs.num_regs == num_regs + && search_regs.start[sub] == newstart + && search_regs.end[sub] == newpoint)) error ("Match data clobbered by buffer modification hooks"); - /* Put point back where it was in the text. */ - if (opoint <= 0) - TEMP_SET_PT (opoint + ZV); - else - TEMP_SET_PT (opoint); - + /* Put point back where it was in the text, if possible. */ + TEMP_SET_PT (clip_to_bounds (BEGV, opoint + (opoint <= 0 ? ZV : 0), ZV)); /* Now move point "officially" to the start of the inserted replacement. */ move_if_not_intangible (newpoint); -- 2.17.1 --------------8CEEC21914ECC17B7ED14FD6-- From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 20:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Paul Eggert Cc: Phillip Lord , 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.15648642856374 (code B ref 19208); Sat, 03 Aug 2019 20:32:02 +0000 Received: (at 19208) by debbugs.gnu.org; 3 Aug 2019 20:31:25 +0000 Received: from localhost ([127.0.0.1]:60031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0gX-0001eP-3P for submit@debbugs.gnu.org; Sat, 03 Aug 2019 16:31:25 -0400 Received: from quimby.gnus.org ([80.91.231.51]:53338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0gV-0001by-33 for 19208@debbugs.gnu.org; Sat, 03 Aug 2019 16:31:23 -0400 Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hu0gQ-0007n2-Bh; Sat, 03 Aug 2019 22:31:20 +0200 From: Lars Ingebrigtsen References: Date: Sat, 03 Aug 2019 22:31:17 +0200 In-Reply-To: (Paul Eggert's message of "Sat, 3 Aug 2019 13:22:26 -0700") Message-ID: <87imrec7oq.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Paul Eggert writes: >> No, that's just another sanity check -- num_regs is the max allowed >> number of sub-matches. (I've now added some comments to clarify.) > > Unfortunately that patch messes up the sanity check, as [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Paul Eggert writes: >> No, that's just another sanity check -- num_regs is the max allowed >> number of sub-matches. (I've now added some comments to clarify.) > > Unfortunately that patch messes up the sanity check, as the patched > code allows 'sub' to be negative, or to be equal to > search_regs.num_regs, and in either case this results in a bad > pointer. Sorry; thanks for fixing. >> Yoda conditionals and a !... > > Actually those were Leibniz conditionals, which are comparisons > involving "<" or "<=". The idea is that the conditionals' textual > order reflects numeric order. This is a common style in math when > doing range checking, e.g., "0 <= i < n". Yoda conditionals are > expressions like "0 != x" which I agree are confusing. Well, I think both are called Yoda conditionals, and they are demonstrably confusing for people not used to seeing conditionals written that way, which is I think pretty much everybody, except four people working on Emacs. :-) In real life, nobody says "if 62 is less than your age, you're eligible for Medicare". I think one should write code for legibility -- but opinions on what's legible various, of course. Reading "if (62 < age)", for me, requires mental gymnastics. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 20:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Lars Ingebrigtsen Cc: Phillip Lord , 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156486546519575 (code B ref 19208); Sat, 03 Aug 2019 20:52:01 +0000 Received: (at 19208) by debbugs.gnu.org; 3 Aug 2019 20:51:05 +0000 Received: from localhost ([127.0.0.1]:60085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0zZ-00055f-Do for submit@debbugs.gnu.org; Sat, 03 Aug 2019 16:51:05 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu0zX-000559-2N for 19208@debbugs.gnu.org; Sat, 03 Aug 2019 16:51:03 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 300DC16183C; Sat, 3 Aug 2019 13:50:57 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id QjcjhBI7TY3t; Sat, 3 Aug 2019 13:50:56 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 352941618B1; Sat, 3 Aug 2019 13:50:56 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ofpIjIMCzrc3; Sat, 3 Aug 2019 13:50:56 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BEF6616183C; Sat, 3 Aug 2019 13:50:55 -0700 (PDT) References: <87imrec7oq.fsf@mouse.gnus.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 3 Aug 2019 13:50:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <87imrec7oq.fsf@mouse.gnus.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Lars Ingebrigtsen wrote: > they are > demonstrably confusing for people not used to seeing conditionals > written that way, which is I think pretty much everybody, except four > people working on Emacs. :-) Just four? :-) (Actually the style is also used in other GNU projects.) In this particular case the Leibniz style caught a potentially-serious bug. Although I understand that it can be a minor irritation for newcomers, it is quite useful for range checking and in practice I find that its reliability outweighs any irritation. (I didn't like Val Schorre's advice either, when I first heard it - but he was right.) From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 00:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Lars Ingebrigtsen Cc: 19208@debbugs.gnu.org, Phillip Lord , Paul Eggert Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156487679521531 (code B ref 19208); Sun, 04 Aug 2019 00:00:02 +0000 Received: (at 19208) by debbugs.gnu.org; 3 Aug 2019 23:59:55 +0000 Received: from localhost ([127.0.0.1]:60196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu3wI-0005bD-LY for submit@debbugs.gnu.org; Sat, 03 Aug 2019 19:59:54 -0400 Received: from mail-io1-f45.google.com ([209.85.166.45]:41049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hu3wH-0005b0-55 for 19208@debbugs.gnu.org; Sat, 03 Aug 2019 19:59:53 -0400 Received: by mail-io1-f45.google.com with SMTP id j5so156018422ioj.8 for <19208@debbugs.gnu.org>; Sat, 03 Aug 2019 16:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IrPAkaX4GRNy9rxbjS9Th+NyMfhEaHXbtBl9UAtnYUo=; b=JKYwAq9ZuZGfrnUwgu7Qe6cUqNRf+UnGIsxHjK93kitpwOQegd+jB6G3D0WneVAi4N gAgHCFOzBGcKRnTDyJ6V5+lMmQ07Dbx6bLsFYFOJoi6LHVIxbh7FsR+6LXuCjE9oZeoa lckl/crRcv8eS1CwnqbSGridXnj5+5IALdAP8hDvAGJK/TyE3P2ALKDpN51I24zkF6p4 xAmKhzgdqHvPRMS1GeQo8JkhJ07MpvlR+9RHifD3mz6/tSYZOJBb6zF0ZoVo4SjARo2J fztderbbtGmX0tVGdb7GKTzkkJHdCy1HqS3cCtXt0tbcxlEA9dUxfUvxOJXLcujJA0OD 9LYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IrPAkaX4GRNy9rxbjS9Th+NyMfhEaHXbtBl9UAtnYUo=; b=ubrceQULZu72fidClGthv5SxsNbPJzcKPRYrgZ9ZMKmzn/wytRqv67EZ6VKhhDjurq ilJHZYXNWAP862LxHUaHO3Q76lS+W7TuQaCWVx1WCyM6T4eO0kZA9vsDznh4tvkwnUxk qL+JCnL4gkA9Wx9H1YlTYrJQoG4wU5aU3bKy683t5lPZxkDtl5ijNPuYXXmKGi8YoRgf uAXMPNTNv002Xjq0y9IOCqdfdlOkRlcf2Vbfrj3DWpGPl9GI2gIi9NI5wGOoZAlEd02i jt1Wsp17fyHZXvXlh8OO34RXDoqR9Q417px1ioctyDi1oyClM+aAXg3kmAscs/9UQ8lG doNQ== X-Gm-Message-State: APjAAAU+4l3FyQfawjKK9D7JQXh9eino/EEkDv6NVEtxNvJuNFRpDhKP ZJa4s2zuafT7OwpcyKTxgMYBZyIi X-Google-Smtp-Source: APXvYqxcHJ6UGfDvKCzAFJ3l/KDWhIPcIaaJ6c43yq7snhmvdtzqeF9KUtPlkKDU9EJBuaAw6dfKpQ== X-Received: by 2002:a6b:691d:: with SMTP id e29mr817379ioc.96.1564876787445; Sat, 03 Aug 2019 16:59:47 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id b8sm64921156ioj.16.2019.08.03.16.59.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Aug 2019 16:59:46 -0700 (PDT) From: Noam Postavsky References: <87imrec7oq.fsf@mouse.gnus.org> Date: Sat, 03 Aug 2019 19:59:45 -0400 In-Reply-To: <87imrec7oq.fsf@mouse.gnus.org> (Lars Ingebrigtsen's message of "Sat, 03 Aug 2019 22:31:17 +0200") Message-ID: <87sgqhssum.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> Actually those were Leibniz conditionals, which are comparisons >> involving "<" or "<=". The idea is that the conditionals' textual >> order reflects numeric order. This is a common style in math when >> doing range checking, e.g., "0 <= i < n". Yoda conditionals are >> expressions like "0 != x" which I agree are confusing. > > Well, I think both are called Yoda conditionals, and they are > demonstrably confusing for people not used to seeing conditionals > written that way, which is I think pretty much everybody, except four > people working on Emacs. :-) > > In real life, nobody says "if 62 is less than your age, you're eligible > for Medicare". People might say things like "your height must be between 120 and 200 cm to ride this roller coaster" as opposed to "your height must be more than 120 cm and your height must be less than 200 cm". > I think one should write code for legibility -- but opinions on what's > legible various, of course. Reading "if (62 < age)", for me, requires > mental gymnastics. "if (height > 120 && height < 200)" require mental gymnastics, for me, because each comparison is a different direction. From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 09:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Noam Postavsky Cc: 19208@debbugs.gnu.org, Lars Ingebrigtsen , Phillip Lord , Paul Eggert Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156490935816573 (code B ref 19208); Sun, 04 Aug 2019 09:03:01 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 09:02:38 +0000 Received: from localhost ([127.0.0.1]:60419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huCPV-0004JE-Tr for submit@debbugs.gnu.org; Sun, 04 Aug 2019 05:02:38 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:33091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huCPT-0004J2-0t for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 05:02:35 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 461Zfd2b1Kz1rJh3; Sun, 4 Aug 2019 11:02:32 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 461Zfc3GxBz1qqkk; Sun, 4 Aug 2019 11:02:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id kBW2nwrllT4m; Sun, 4 Aug 2019 11:02:31 +0200 (CEST) X-Auth-Info: 2MRYNrR+00mH+DBsFJ60whpOHyqsuhoCFo4U17cUXsaWtZKMxpSkYp2nyyTm2rcA Received: from linux.local (ppp-46-244-175-194.dynamic.mnet-online.de [46.244.175.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 4 Aug 2019 11:02:31 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id C883F1E532C; Sun, 4 Aug 2019 11:02:26 +0200 (CEST) From: Andreas Schwab References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> X-Yow: Bo Derek ruined my life! Date: Sun, 04 Aug 2019 11:02:26 +0200 In-Reply-To: <87sgqhssum.fsf@gmail.com> (Noam Postavsky's message of "Sat, 03 Aug 2019 19:59:45 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Aug 03 2019, Noam Postavsky wrote: > People might say things like "your height must be between 120 and 200 cm > to ride this roller coaster" This still puts "height" (the variable) first. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 09:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Paul Eggert Cc: Phillip Lord , Lars Ingebrigtsen , 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156490977117226 (code B ref 19208); Sun, 04 Aug 2019 09:10:02 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 09:09:31 +0000 Received: from localhost ([127.0.0.1]:60425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huCWA-0004Tm-MZ for submit@debbugs.gnu.org; Sun, 04 Aug 2019 05:09:30 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:37733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huCW8-0004Td-Dg for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 05:09:29 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 461Zpc04BMz1rJh3; Sun, 4 Aug 2019 11:09:28 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 461Zpb6m7Lz1qqkr; Sun, 4 Aug 2019 11:09:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id NcPAovGGsEqz; Sun, 4 Aug 2019 11:09:26 +0200 (CEST) X-Auth-Info: F6Z21PQc/urNGXreJoubNl3N0CgNz+UJaUcK1j/WI8nCewIrI3MWzeM0wXuBK+na Received: from linux.local (ppp-46-244-175-194.dynamic.mnet-online.de [46.244.175.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 4 Aug 2019 11:09:26 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id 541561E532C; Sun, 4 Aug 2019 11:09:25 +0200 (CEST) From: Andreas Schwab References: <87imrec7oq.fsf@mouse.gnus.org> X-Yow: I am a jelly donut. I am a jelly donut. Date: Sun, 04 Aug 2019 11:09:25 +0200 In-Reply-To: (Paul Eggert's message of "Sat, 3 Aug 2019 13:50:55 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Aug 03 2019, Paul Eggert wrote: > Lars Ingebrigtsen wrote: >> they are >> demonstrably confusing for people not used to seeing conditionals >> written that way, which is I think pretty much everybody, except four >> people working on Emacs. :-) > > Just four? :-) (Actually the style is also used in other GNU projects.) And always the same four people. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 09:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Paul Eggert Cc: Phillip Lord , Lars Ingebrigtsen , 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156491030318007 (code B ref 19208); Sun, 04 Aug 2019 09:19:02 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 09:18:23 +0000 Received: from localhost ([127.0.0.1]:60430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huCek-0004gM-MO for submit@debbugs.gnu.org; Sun, 04 Aug 2019 05:18:22 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:40881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huCej-0004gF-1F for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 05:18:21 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 461b0r3c8pz1rD9k; Sun, 4 Aug 2019 11:18:20 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 461b0r3BFXz1qqkk; Sun, 4 Aug 2019 11:18:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id nPLrHkLxFFQu; Sun, 4 Aug 2019 11:18:19 +0200 (CEST) X-Auth-Info: rFanSZiW2XGRFiB51qrTay9joWpJgPEbzMsU53Ql+FEDRM9WnI8xTiK32wRtkw4h Received: from linux.local (ppp-46-244-175-194.dynamic.mnet-online.de [46.244.175.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 4 Aug 2019 11:18:19 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id 70CA51E532C; Sun, 4 Aug 2019 11:18:17 +0200 (CEST) From: Andreas Schwab References: <87r3wn5kgw.fsf@newcastle.ac.uk> X-Yow: Yow! Maybe I should have asked for my Neutron Bomb in PAISLEY-- Date: Sun, 04 Aug 2019 11:18:17 +0200 In-Reply-To: (Paul Eggert's message of "Sat, 3 Aug 2019 13:22:26 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Aug 03 2019, Paul Eggert wrote: > I learned Leibniz conditionals from the late Val Schorre, who was *really* > good at programming and programming style: Knuth credits Schorre with the > invention of goto-less programming in the early 1960s. When I redid your > patch as a Leibniz conditional, I instantly spotted the bug that it > introduced. You might give Leibniz conditionals a try, as they help make > code more readable and reliable when checking for range errors or > overflow. Perhaps those that need that construct are not good enough to cope with natural languages. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 11:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Noam Postavsky Cc: 19208@debbugs.gnu.org, Phillip Lord , Paul Eggert Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.15649192278273 (code B ref 19208); Sun, 04 Aug 2019 11:48:02 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 11:47:07 +0000 Received: from localhost ([127.0.0.1]:60694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huEyh-00029N-Bb for submit@debbugs.gnu.org; Sun, 04 Aug 2019 07:47:07 -0400 Received: from quimby.gnus.org ([80.91.231.51]:36200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huEyf-00029C-3E for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 07:47:05 -0400 Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1huEya-00070l-Pt; Sun, 04 Aug 2019 13:47:03 +0200 From: Lars Ingebrigtsen References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> Date: Sun, 04 Aug 2019 13:47:00 +0200 In-Reply-To: <87sgqhssum.fsf@gmail.com> (Noam Postavsky's message of "Sat, 03 Aug 2019 19:59:45 -0400") Message-ID: <87h86xb1aj.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Noam Postavsky writes: > People might say things like "your height must be between 120 and 200 cm > to ride this roller coaster" as opposed to "your height must be more > than 120 cm and your height must be less than 200 cm [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Noam Postavsky writes: > People might say things like "your height must be between 120 and 200 cm > to ride this roller coaster" as opposed to "your height must be more > than 120 cm and your height must be less than 200 cm". And they don't say "120 cm must be less than your height, which must also be less than 200 cm". :-) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 14:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Andreas Schwab Cc: Phillip Lord , Lars Ingebrigtsen , 19208@debbugs.gnu.org, Paul Eggert Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156492793816031 (code B ref 19208); Sun, 04 Aug 2019 14:13:02 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 14:12:18 +0000 Received: from localhost ([127.0.0.1]:34070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huHFA-0004AS-N8 for submit@debbugs.gnu.org; Sun, 04 Aug 2019 10:12:18 -0400 Received: from mail-io1-f44.google.com ([209.85.166.44]:33369) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huHF8-0004AF-1U for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 10:12:14 -0400 Received: by mail-io1-f44.google.com with SMTP id z3so21009913iog.0 for <19208@debbugs.gnu.org>; Sun, 04 Aug 2019 07:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2H4DC3DDXmcnCdlfZIWoJ2uRa+wcVoorFT/ygqRjYTc=; b=Pqb2ju5jhDVwrdtKQ8R/Ru0uqsRQeZ4N3/WOjmH/njZUHtpn2S9y4bcbtCMxoe7DUa K14+S2kJgQ9yYP/VYnkNMOXy49y8oBFcXxrrtzVeq7bOSQv1iAU2T2vp8W2A1S8eW4uz fBIdniu3Y5DE4hI276l/zU8gUCczwfduvj5BdX6k8QKmOmcnXVPVRoJ89j8kYGm0o/X/ XTPMiGR0Nv9Q0Veb7BQMXIi2vxtuj98yghKcEK2FzO6uKAmzLowzxGYQqgoU5POG0Z4A ARYpL6DHIXxK+d3nDYpSGbqD0GZWuRHKJ6aOpQ6LqZ31LpK83QBLOpTPlPP9T7hiRm7/ HXyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2H4DC3DDXmcnCdlfZIWoJ2uRa+wcVoorFT/ygqRjYTc=; b=LyUR4d01saxNdC8Vog/wyiPtJNTuusl3GI1r9asBGKO0pUhpApvbOc4Bt3wUV+E5oF eD3isrZohZlG1WHbDOjaUbmV2D0HqDLWj9Bs5WnYoypPzSKlzR85VJJNcxW8+z7Gh9mu OT2QxWsXEpITe6L0Z8hPA7izz1Xq77llg7v1ZPo2UDyC6nAPynMFvOjlrbU0+UNnNN0a EKbUhvQgU4QTcpNxTymb0E3ZT87bl38rLeVBF4R7dyT3TI+OTBmqrE/3XMHR+Htlvj63 ClTafXmuFSXeCBoOCar6SA8ccARyseIrkRvJHU8d0ImqM2lawb9agAR/5GT7uBoTzM48 YwTw== X-Gm-Message-State: APjAAAVf8LFXiA9uANjtzb0iDu1uWG8s+US9S6W6NWRV94s0PAdmjTfy H+4EDT74c8+W1+OI0KAKtls= X-Google-Smtp-Source: APXvYqyAFXxfrv9RZF0WjVZ2vdm6N3GH95kltGNHbvtsdgMUrVKw9u0LaFqKXATZ897Gob3Af1uaNA== X-Received: by 2002:a6b:dc17:: with SMTP id s23mr24289454ioc.56.1564927928453; Sun, 04 Aug 2019 07:12:08 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id f17sm78200174ioc.2.2019.08.04.07.12.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Aug 2019 07:12:07 -0700 (PDT) From: Noam Postavsky References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> Date: Sun, 04 Aug 2019 10:12:06 -0400 In-Reply-To: (Andreas Schwab's message of "Sun, 04 Aug 2019 11:02:26 +0200") Message-ID: <87ef21rpe1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Andreas Schwab writes: > On Aug 03 2019, Noam Postavsky wrote: > >> People might say things like "your height must be between 120 and 200 cm >> to ride this roller coaster" > > This still puts "height" (the variable) first. Lars Ingebrigtsen writes: > > And they don't say "120 cm must be less than your height, which must also > be less than 200 cm". :-) Right, but unless we want to use a macro like IN_RANGE_P (height, 120, 200) I think ((120 < height) && (height < 200)) is the closest we can get to the natural phrasing. In Elisp we can do (< 120 height 200) which is nicer, but we're still stuck with `and' for semi-closed intervals. From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Noam Postavsky Cc: Phillip Lord , Lars Ingebrigtsen , 19208@debbugs.gnu.org, Paul Eggert Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156493160321634 (code B ref 19208); Sun, 04 Aug 2019 15:14:02 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 15:13:23 +0000 Received: from localhost ([127.0.0.1]:34099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huICH-0005co-0R for submit@debbugs.gnu.org; Sun, 04 Aug 2019 11:13:21 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:33164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huICF-0005cg-83 for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 11:13:19 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 461ktP5CYZz1rGRh; Sun, 4 Aug 2019 17:13:16 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 461ktN6Gg3z1qqkv; Sun, 4 Aug 2019 17:13:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id mSlQ8ZcixQK1; Sun, 4 Aug 2019 17:13:15 +0200 (CEST) X-Auth-Info: TPuIPeMKgRx1t1Ty4U6RkuvGH6sR1+3PctEclEivIBnWd6/mBZB7MDHqqadcR/V4 Received: from igel.home (ppp-46-244-175-194.dynamic.mnet-online.de [46.244.175.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 4 Aug 2019 17:13:15 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 98D0E2C0F89; Sun, 4 Aug 2019 17:13:12 +0200 (CEST) From: Andreas Schwab References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> <87ef21rpe1.fsf@gmail.com> X-Yow: I pretend I'm living in a styrofoam packing crate, high in th' SWISS ALPS, still unable to accept th' idea of TOUCH-TONE DIALING!! Date: Sun, 04 Aug 2019 17:13:12 +0200 In-Reply-To: <87ef21rpe1.fsf@gmail.com> (Noam Postavsky's message of "Sun, 04 Aug 2019 10:12:06 -0400") Message-ID: <87r261ezg7.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Aug 04 2019, Noam Postavsky wrote: > I think ((120 < height) && (height < 200)) is the closest we can get to > the natural phrasing. "X is between A and B" means "X is bigger than A and [X is] smaller than B". You would never say "A is smaller than X and [X is] smaller than B". Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 17:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Andreas Schwab , Noam Postavsky Cc: Phillip Lord , Lars Ingebrigtsen , 19208@debbugs.gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.15649405103113 (code B ref 19208); Sun, 04 Aug 2019 17:42:01 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 17:41:50 +0000 Received: from localhost ([127.0.0.1]:34205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huKVx-0000o7-UB for submit@debbugs.gnu.org; Sun, 04 Aug 2019 13:41:50 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huKVv-0000ns-QG for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 13:41:48 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7C20F162639; Sun, 4 Aug 2019 10:41:41 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id g_gJN0DUt-OC; Sun, 4 Aug 2019 10:41:40 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B55FA1626A7; Sun, 4 Aug 2019 10:41:40 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 64GviJQcDPdA; Sun, 4 Aug 2019 10:41:40 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 73248162639; Sun, 4 Aug 2019 10:41:40 -0700 (PDT) References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> <87ef21rpe1.fsf@gmail.com> <87r261ezg7.fsf@igel.home> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 4 Aug 2019 10:41:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <87r261ezg7.fsf@igel.home> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is not strictly a question of what one would say in English, as mathematical notation is typically a better choice for mathematical notions. For example, in C it's typically better to write sixteen as "16" rather than as "6 + 10" even though the latter is closer to the original English. If we wanted code to mimic English better, COBOL would be a good choice. (Or maybe Perl. :-) But the goal is to write readable code, not to imitate how Anglo-Saxons talked. From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Aug 2019 18:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Paul Eggert Cc: Phillip Lord , Lars Ingebrigtsen , 19208@debbugs.gnu.org, Noam Postavsky Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.156494246414324 (code B ref 19208); Sun, 04 Aug 2019 18:15:01 +0000 Received: (at 19208) by debbugs.gnu.org; 4 Aug 2019 18:14:24 +0000 Received: from localhost ([127.0.0.1]:34229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huL1U-0003iy-8b for submit@debbugs.gnu.org; Sun, 04 Aug 2019 14:14:24 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:34102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huL1S-0003ip-8r for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 14:14:22 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 461pvK25sRz1rGRl; Sun, 4 Aug 2019 20:14:21 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 461pvK1YZmz1qqkt; Sun, 4 Aug 2019 20:14:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id pxyLZXTGEyYN; Sun, 4 Aug 2019 20:14:20 +0200 (CEST) X-Auth-Info: 5lw7a0CBUanu1P2LR7TOqGYp8/+7UchmpyqUzgiANuFiM5moCKv2y3dWUdvNcW+O Received: from igel.home (ppp-46-244-175-194.dynamic.mnet-online.de [46.244.175.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 4 Aug 2019 20:14:20 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id BC41C2C0F89; Sun, 4 Aug 2019 20:14:19 +0200 (CEST) From: Andreas Schwab References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> <87ef21rpe1.fsf@gmail.com> <87r261ezg7.fsf@igel.home> X-Yow: There's enough money here to buy 5000 cans of Noodle-Roni! Date: Sun, 04 Aug 2019 20:14:19 +0200 In-Reply-To: (Paul Eggert's message of "Sun, 4 Aug 2019 10:41:40 -0700") Message-ID: <87mugog5ms.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Aug 04 2019, Paul Eggert wrote: > readable code Exactly. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 11:25:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19208: replace-match unhelpful error message Resent-From: Richard Stallman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Aug 2019 02:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Noam Postavsky Cc: phillip.lord@newcastle.ac.uk, larsi@gnus.org, 19208@debbugs.gnu.org, schwab@linux-m68k.org, eggert@cs.ucla.edu Reply-To: rms@gnu.org Received: via spool by 19208-submit@debbugs.gnu.org id=B19208.15649719447068 (code B ref 19208); Mon, 05 Aug 2019 02:26:02 +0000 Received: (at 19208) by debbugs.gnu.org; 5 Aug 2019 02:25:44 +0000 Received: from localhost ([127.0.0.1]:34434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huSgx-0001pu-Sq for submit@debbugs.gnu.org; Sun, 04 Aug 2019 22:25:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1huSgw-0001pe-4G for 19208@debbugs.gnu.org; Sun, 04 Aug 2019 22:25:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1huSgo-0006iv-Up; Sun, 04 Aug 2019 22:25:35 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1huSgm-0003s6-IH; Sun, 04 Aug 2019 22:25:32 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman In-Reply-To: <87ef21rpe1.fsf@gmail.com> (message from Noam Postavsky on Sun, 04 Aug 2019 10:12:06 -0400) References: <87imrec7oq.fsf@mouse.gnus.org> <87sgqhssum.fsf@gmail.com> <87ef21rpe1.fsf@gmail.com> Message-Id: Date: Sun, 04 Aug 2019 22:25:32 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I think ((120 < height) && (height < 200)) is the closest we can get to > the natural phrasing. That parallels the mathematical expression 120 < h < 200, which is a plus, but doesn't parallel the textual form "height must be between 120 and 200", which is a minus. The way to parallel the latter is (height > 120 && height < 200). I think both of those are ok, but let's avoid other orderings -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)