From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Date: Sun, 5 Feb 2023 21:09:36 +0200 Message-ID: <4063c95f-041e-4c12-52bc-20e63730b9ae@yandex.ru> References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> <83k011z38k.fsf@gnu.org> <83tu00qgmu.fsf@gnu.org> <4731344a-7406-5cf0-43eb-c77520c2a2c1@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38616"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: rahguzar@zohomail.eu, Eli Zaretskii , 61098-done@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 20:10:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pOkP8-0009wu-EJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 20:10:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOkOr-0000Ml-CF; Sun, 05 Feb 2023 14:10:05 -0500 Original-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 ) id 1pOkOo-0000Lu-R2 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 14:10:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOkOo-0005MK-IF for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 14:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOkOo-0005Q7-EK for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 14:10:02 -0500 Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 19:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61098 X-GNU-PR-Package: emacs Mail-Followup-To: 61098@debbugs.gnu.org, dgutov@yandex.ru, rahguzar@zohomail.eu Original-Received: via spool by 61098-done@debbugs.gnu.org id=D61098.167562418620800 (code D ref 61098); Sun, 05 Feb 2023 19:10:02 +0000 Original-Received: (at 61098-done) by debbugs.gnu.org; 5 Feb 2023 19:09:46 +0000 Original-Received: from localhost ([127.0.0.1]:46478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkOX-0005PQ-NP for submit@debbugs.gnu.org; Sun, 05 Feb 2023 14:09:46 -0500 Original-Received: from mail-wm1-f41.google.com ([209.85.128.41]:34591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkOW-0005PC-2D for 61098-done@debbugs.gnu.org; Sun, 05 Feb 2023 14:09:44 -0500 Original-Received: by mail-wm1-f41.google.com with SMTP id f23-20020a05600c491700b003dff4480a17so1408742wmp.1 for <61098-done@debbugs.gnu.org>; Sun, 05 Feb 2023 11:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=mtKnnZKdNSah1mzJ8mR4YsU6wGTaQ2n4p4zSEaBeUrI=; b=OoLZCLoDJkfto7not/62BWvVQlG0hmrWMvMCCw7drNBgHGzEzSX/I/h5SKlHUb3OIQ ZUbC7LnAwrayO8l1EtOvluPe/cNlcRAfmHxAlkPazF92pVT1GGSBigGyszcZH5z6Y6Jr 2xCtKGAZvQITZmj9n/8mIE9kWPRrG5LkIEkfzjZvxQLo3wi87ZWa/0qJGtiBDvMwu4Ee bJGqUcKpgoCwC507CS3++SAF0ppW9v3ju3ZXxB8vHVGLq+1YL5mi1qUlJ9XhnDkg9bRg w39W1IHHwvax8NVg2Z6ASbY2MeIVnTAuJO2oQ15C1UWVyIwRjAQrVzDLCwpCMfSFrnXS Kzfg== 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:cc: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=mtKnnZKdNSah1mzJ8mR4YsU6wGTaQ2n4p4zSEaBeUrI=; b=dEqe1vpF6QcwAafMWSMGmGxRF+gtHHQ5Z3oISp5cMThfevZYaN/TP2fl+ewTVJ+aR+ ol0SDtCwTso8TgBWV92Qbm4K+Y3VVts2xo0Nypt5GiCVpSW2mV64OOo+hh/zUFzHWUvE pX92UKKgwoj6rS9dxs1Qe5rWR3+zKNDEZqfmj167Q9G5x3g5wjO5EGU3z7p9sA0jWIPw 4FFgt5zUi2RDm9x9wTnsDT+ppIXM+5auRsY9OGoWhtMtWzk4vrYbtcUyafbQAcJ2EhVV VIj9+47wlPVVtKQDYKagiO5LB/DH6Jl/DbGG1H3TQrFVEc4EI5F8zZeac0ycyLATMQO+ V5IQ== X-Gm-Message-State: AO0yUKWUjGKqXuymy8mFuBjA1CJce58xgPv3al9ksfRs/tOEJYxG3IYt 8wj69azUv9XgXNc+UTWMagM= X-Google-Smtp-Source: AK7set/7oEPXWanXscFAU032bhhNf82rnh1h643eNwkLvMSwBbn84waFbv7uMLKOJ39TYQGyNQbR5w== X-Received: by 2002:a05:600c:a41:b0:3dc:5b79:2dbb with SMTP id c1-20020a05600c0a4100b003dc5b792dbbmr17190933wmq.25.1675624178594; Sun, 05 Feb 2023 11:09:38 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id j10-20020a05600c1c0a00b003dd1c45a7b0sm9579038wms.23.2023.02.05.11.09.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Feb 2023 11:09:38 -0800 (PST) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254885 Archived-At: On 05/02/2023 20:57, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: >> + :variable ( (and show-paren-mode >> + (buffer-match-p show-paren-predicate (current-buffer))) >> + . >> (lambda (val) (setq-local show-paren-mode val))) > This doesn't look quote right because it doesn't pay attention to > `local-variable-p`. We should extract the test performed in the timer > and reuse it here. Thank you, makes sense. Here's the patch I installed: diff --git a/lisp/paren.el b/lisp/paren.el index 7ee4e9ae682..4c91fd29490 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -161,8 +161,9 @@ show-paren--delete-overlays ;;;###autoload (define-minor-mode show-paren-local-mode "Toggle `show-paren-mode' only in this buffer." - :variable ( show-paren-mode . - (lambda (val) (setq-local show-paren-mode val))) + :variable ((show-paren--enabled-p) + . + (lambda (val) (setq-local show-paren-mode val))) (cond ((eq show-paren-mode (default-value 'show-paren-mode)) (unless show-paren-mode @@ -428,14 +429,17 @@ show-paren--show-context-in-overlay ;; `show-paren-delay'. (defvar-local show-paren--last-pos nil) +(defun show-paren--enabled-p () + (and show-paren-mode + ;; If we're using `show-paren-local-mode', then + ;; always heed the value. + (or (local-variable-p 'show-paren-mode) + ;; If not, check that the predicate matches. + (buffer-match-p show-paren-predicate (current-buffer))))) + (defun show-paren-function () "Highlight the parentheses until the next input arrives." - (let ((data (and show-paren-mode - ;; If we're using `show-paren-local-mode', then - ;; always heed the value. - (or (local-variable-p 'show-paren-mode) - ;; If not, check that the predicate matches. - (buffer-match-p show-paren-predicate (current-buffer))) + (let ((data (and (show-paren--enabled-p) (funcall show-paren-data-function)))) (if (not data) (progn