GNU bug report logs - #58951
[PATCH] ; Fix handling of 'not' by 'buffer-match-p'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Philip Kaludercic <philipk@HIDDEN>; Keywords: patch; dated Tue, 1 Nov 2022 19:37:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 58951 <at> debbugs.gnu.org:


Received: (at 58951) by debbugs.gnu.org; 1 Nov 2022 22:09:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 18:09:21 2022
Received: from localhost ([127.0.0.1]:44365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opzRh-00034X-KV
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 18:09:21 -0400
Received: from mail-wm1-f45.google.com ([209.85.128.45]:39879)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1opzRg-00034K-BH
 for 58951 <at> debbugs.gnu.org; Tue, 01 Nov 2022 18:09:20 -0400
Received: by mail-wm1-f45.google.com with SMTP id
 i5-20020a1c3b05000000b003cf47dcd316so170779wma.4
 for <58951 <at> debbugs.gnu.org>; Tue, 01 Nov 2022 15:09:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :sender:from:to:cc:subject:date:message-id:reply-to;
 bh=EL5/uh+2VoJzEhPppBhWE1IfbEUtEIge5c94dOpjSkA=;
 b=kfqs2VTQu6Sq6ekAO6Qjv+8vL25cyumRcfjCg2SPOJlA76rR1+RMC7/iL4o67k638T
 wFPJV27GSOixvkVwlJQtYiifh0bjXuDhmXl3kvLKpdFI/aIfZCxvJsqyVRTOHod1le8/
 tMF1+2wZL758PdjQhSqBNKZKh+mdxlGkqmyiFcI+jKBWTmx1ijMIH3SPvvrVHCtRgJ1J
 67uO93VnOlJvqUJT/+xDm+FnfdxneOY+E0AkGTcF+oifuRfQ2FuDP5UZvy1wVTyIVg22
 BW3aCxlu7DTIE3vRfR7SIKrj562QipW2+4Bg2jZN8HpxApcKomVSO8nPv7WhnjvFC47z
 kXEw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:user-agent:mime-version:date:message-id
 :sender:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=EL5/uh+2VoJzEhPppBhWE1IfbEUtEIge5c94dOpjSkA=;
 b=gHKaihxtoUzma8unRJT5/ye6d4YYTTAaRAicJuvIzMNkHxpTnQScYflZRrdNoAPGhV
 nQl6kRvhkfqUcJNwuHT+lvlKhEri5DH0PRCWpAseJdNfjAJmn8JM4WUKJh70KoC8GHDo
 DSndcq/TUJ6O8Kr09xDUFhZjj8P7ZAtGX+nFxSCBRG2ixXxl1JlI+xOvJDg4yWLB9WYw
 HZ55+x0+gebxBam2fsKq7/xlDAD3ygqQ13tLiYBKAfl7c13jI98mAOBfjG/ZYWwniyAJ
 eQic3cxTAEQNeY2xShUXGQA2wN+hZlPUG0Yc+NAWCa1R2h2eCcywRK4pj5+zGJ2J1/On
 Y4rg==
X-Gm-Message-State: ACrzQf3e7cf5bpEAeYpCTx/ItqDyBbYQMrGg533BvOt7nOfW5t4aU2hY
 tD+uIclPwRMrkNcoC7aWJ3U=
X-Google-Smtp-Source: AMsMyM6JZS5fp+QB7uLeaKPcpl82fCH94wwOrCQE6ibnNMcVSKwqb1BkWWkD9VCPzQtu9YCO/4CAPg==
X-Received: by 2002:a05:600c:310a:b0:3c6:f9a6:5a7d with SMTP id
 g10-20020a05600c310a00b003c6f9a65a7dmr23513748wmo.29.1667340554123; 
 Tue, 01 Nov 2022 15:09:14 -0700 (PDT)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id
 o17-20020a5d4091000000b0022584c82c80sm11483592wrp.19.2022.11.01.15.09.13
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 01 Nov 2022 15:09:13 -0700 (PDT)
Message-ID: <44629860-db9a-d6f7-8188-e7a5b73ea48e@HIDDEN>
Date: Wed, 2 Nov 2022 00:09:11 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.2.2
Subject: Re: bug#58951: [PATCH] ; Fix handling of 'not' by 'buffer-match-p'
Content-Language: en-US
To: Philip Kaludercic <philipk@HIDDEN>, 58951 <at> debbugs.gnu.org
References: <871qqmeac3.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <871qqmeac3.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 58951
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

On 01.11.2022 21:36, Philip Kaludercic wrote:
> I believe this is preferable to fixing `show-paren-predicate', as this
> is the kind of issue a lot of people could trip over.
> 
> This patch is based on the patch from bug#58950, but can be back-ported
> to the previous implementations if there are any issues with that report.

I do agree that (not foo) is more convenient than (not . foo). Though 
the latter would be more regular compared to the rest of the syntax. I 
made just that mistake yesterday.

Let's change 'pcase' to 'pcase-exhaustive', though? So it will signal an 
error on invalid syntax.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58951; Package emacs. Full text available.

Message received at 58951 <at> debbugs.gnu.org:


Received: (at 58951) by debbugs.gnu.org; 1 Nov 2022 20:19:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 16:19:19 2022
Received: from localhost ([127.0.0.1]:44291 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opxjC-0000Ia-PC
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 16:19:19 -0400
Received: from mout02.posteo.de ([185.67.36.66]:47359)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1opxj9-0000IL-CL
 for 58951 <at> debbugs.gnu.org; Tue, 01 Nov 2022 16:19:15 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 75F75240104
 for <58951 <at> debbugs.gnu.org>; Tue,  1 Nov 2022 21:19:09 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667333949; bh=ZFuNV6PwDkOCyTxFhKWxdiRgugWB9S4s+TBhpRVLqXo=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=bNv4JLBCRskPGvKPRg5huR6uma6Za+j6XEo4WQZNeatZ0nEz+rVlK3tqWV/qCw1pi
 Tv8GvstGdgRWRpyV8CaSh+4upEG/9O4U9uCpaS5aEJqPGGqrVXQwTmAgl+EpD6FZMK
 /CFMfzW9kCFyDQ1VaHlbdFpEYnEIKzhu9Js8Vk1nDut7w2+afYA3zkIeJU+9MklCR1
 9rw22qE11lTYQ8DrwUA3ztG4VtfKeVpWCgdsTRXEaisv4oZYjrSmJ+nDC2ustHf2qZ
 3I1A3N0CQsEg5teIQ8hBaRLt+oUPi0T2Hd1kPoJxQw4JixLhZZAH/RVZTRgyJ9hTn3
 x8giU72FWt9QQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4N21ZM70wFz6tn3;
 Tue,  1 Nov 2022 21:19:07 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: help-debbugs@HIDDEN (GNU bug Tracking System)
Subject: Re: bug#58951: Acknowledgement ([PATCH] ; Fix handling of 'not' by
 'buffer-match-p')
In-Reply-To: <handler.58951.B.166733138129551.ack <at> debbugs.gnu.org> (GNU bug
 Tracking System's message of "Tue, 01 Nov 2022 19:37:02 +0000")
References: <871qqmeac3.fsf@HIDDEN>
 <handler.58951.B.166733138129551.ack <at> debbugs.gnu.org>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 01 Nov 2022 20:19:06 +0000
Message-ID: <87pme6cts5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 58951
Cc: 58951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain


I forgot to update the documentation in buffers.texi:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Fix-handling-of-not-by-buffer-match-p.patch

From 279f9561dd115d707b086efdbc19072fceb7a99f Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 1 Nov 2022 20:27:17 +0100
Subject: [PATCH] ; Fix handling of 'not' by 'buffer-match-p'

* lisp/subr.el (buffer-match-p): Look up the cadr instead of the cdr
for the negation in 'not'.
* doc/lispref/buffers.texi (Buffer List): Update documentation.
---
 doc/lispref/buffers.texi | 18 ++++++++----------
 lisp/subr.el             |  4 ++--
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index c40e088293..8405e28387 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -977,17 +977,15 @@ Buffer List
 A cons-cell @code{(@var{oper} . @var{expr})} where @var{oper} is one
 of
 @table @code
-@item not
-Satisfied if @var{expr} doesn't satisfy @code{buffer-match-p} with
+@item (not @var{cond})
+Satisfied if @var{cond} doesn't satisfy @code{buffer-match-p} with
 the same buffer and @code{arg}.
-@item or
-Satisfied if @var{expr} is a list and @emph{any} condition in
-@var{expr} satisfies @code{buffer-match-p}, with the same buffer and
-@code{arg}.
-@item and
-Satisfied if @var{expr} is a list and @emph{all} conditions in
-@var{expr} satisfy @code{buffer-match-p}, with the same buffer and
-@code{arg}.
+@item (or @var{conds}@dots{})
+Satisfied if and @emph{any} condition in @var{conds} satisfies
+@code{buffer-match-p}, with the same buffer and @code{arg}.
+@item (and @var{conds}@dots{})
+Satisfied if @emph{all} conditions in @var{conds} satisfy
+@code{buffer-match-p}, with the same buffer and @code{arg}.
 @item derived-mode
 Satisfied if the buffer's major mode derives from @var{expr}.
 @item major-mode
diff --git a/lisp/subr.el b/lisp/subr.el
index b667339db9..0252e66686 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7023,7 +7023,7 @@ string-lines
                `(provided-mode-derived-p
                  (buffer-local-value 'major-mode ,buffer-sym)
                  ',mode))
-              (`(not . ,cond)
+              (`(not ,cond)
                `(not ,(funcall translate cond)))
               (`(or . ,conds)
                `(or ,@(mapcar translate conds)))
@@ -7045,7 +7045,7 @@ string-lines
   * `major-mode': the buffer matches if the buffer's major mode
     is eq to the cons-cell's cdr.  Prefer using `derived-mode'
     instead when both can work.
-  * `not': the cdr is interpreted as a negation of a condition.
+  * `not': the cadr is interpreted as a negation of a condition.
   * `and': the cdr is a list of recursive conditions, that all have
     to be met.
   * `or': the cdr is a list of recursive condition, of which at
-- 
2.38.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58951; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Nov 2022 19:36:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 15:36:21 2022
Received: from localhost ([127.0.0.1]:44267 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opx3c-0007gZ-Rs
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 15:36:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:37354)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1opx3b-0007gR-3Q
 for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 15:36:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
 id 1opx3a-0006QH-22
 for bug-gnu-emacs@HIDDEN; Tue, 01 Nov 2022 15:36:18 -0400
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
 id 1opx3Y-0002Sd-1q
 for bug-gnu-emacs@HIDDEN; Tue, 01 Nov 2022 15:36:17 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 94F10240105
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Nov 2022 20:36:13 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667331373; bh=f4qTeUVFO/gkHQNodkZGOhCm4Iiwyw9twgMGuk52yhI=;
 h=From:To:Subject:Autocrypt:Date:From;
 b=J52qOylNjUKWZ4HpWTqcrXLkTvlDFYURrUmVS1N7Q8va2TifWAbGO+TVhoTPVCcza
 SQZ8Q7Mhm3BuC2ynMUt0f3/xEuwoAPYU74MVtQ4UoxMsRZ4eLrnrZnw4TMWy1MmpF9
 VqTYUlTB0QvXC1efOQn66HaGXzsb7zKTIkKnPGiACzz0KHec2HDBideA57ub5K19xv
 X8iUx9q97H57ZY61fBoRLyUSv7rWuiTlZAMLLAYpLhyGgoPCDpjrtIu9LQ59o3s2dT
 Y+A6jhJt6pvEZwtGJRo9MK4DutE/zOvNe1xwk3PmkixDAT8cSi+JfWSFNRGCXNThkY
 ELc+EMGZ8Hzeg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4N20cs1Wxhz6tmP
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Nov 2022 20:36:13 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] ; Fix handling of 'not' by 'buffer-match-p'
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 01 Nov 2022 19:36:12 +0000
Message-ID: <871qqmeac3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@HIDDEN;
 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-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Tags: patch


In preparing bug#58950 I noticed that the 'not' clause is confusing, and
is misused on the place I could find it being used in the core
(show-paren-predicate).  The current implementation would require a
negation to be written as

    (not . CONDITION)

while it is more natural to write

    (not CONDITION)

which is more in line with (and ...) and (or ...).

The issue appears to go back to `project--buffer-check', that takes a
list of conditions instead of a single one.  This means that the above
are equivalent. since (not CONDITION) will check each element in the
unary list in (not . (CONDITION)).

I believe this is preferable to fixing `show-paren-predicate', as this
is the kind of issue a lot of people could trip over.

This patch is based on the patch from bug#58950, but can be back-ported
to the previous implementations if there are any issues with that report.

In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.30, cairo version 1.16.0) of 2022-10-31 built on heron
Repository revision: 462a66e79edcc34ecbeef7cc1604765adfdc038e
Repository branch: feature/package+vc
System Description: Guix System

Configured using:
 'configure --with-pgtk --with-imagemagick
 PKG_CONFIG_PATH=/gnu/store/ssg343s6ldqdwh30136pnawhbgd0cb6i-profile/lib/pkgconfig:/gnu/store/ssg343s6ldqdwh30136pnawhbgd0cb6i-profile/share/pkgconfig'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Fix-handling-of-not-by-buffer-match-p.patch

From cb88a512eacb3ad73c22682c9c794cdc80445f43 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 1 Nov 2022 20:27:17 +0100
Subject: [PATCH] ; Fix handling of 'not' by 'buffer-match-p'

* lisp/subr.el (buffer-match-p): Look up the cadr instead of the cdr
for the negation in 'not'.
---
 lisp/subr.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index b667339db9..0252e66686 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7023,7 +7023,7 @@ string-lines
                `(provided-mode-derived-p
                  (buffer-local-value 'major-mode ,buffer-sym)
                  ',mode))
-              (`(not . ,cond)
+              (`(not ,cond)
                `(not ,(funcall translate cond)))
               (`(or . ,conds)
                `(or ,@(mapcar translate conds)))
@@ -7045,7 +7045,7 @@ string-lines
   * `major-mode': the buffer matches if the buffer's major mode
     is eq to the cons-cell's cdr.  Prefer using `derived-mode'
     instead when both can work.
-  * `not': the cdr is interpreted as a negation of a condition.
+  * `not': the cadr is interpreted as a negation of a condition.
   * `and': the cdr is a list of recursive conditions, that all have
     to be met.
   * `or': the cdr is a list of recursive condition, of which at
-- 
2.38.0


--=-=-=--




Acknowledgement sent to Philip Kaludercic <philipk@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#58951; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 1 Nov 2022 22:15:02 UTC

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