all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: rahguzar@zohomail.eu, Eli Zaretskii <eliz@gnu.org>,
	61098-done@debbugs.gnu.org
Subject: bug#61098: 29.0.60; Confusing behavior of show-paren-mode
Date: Sun, 5 Feb 2023 21:09:36 +0200	[thread overview]
Message-ID: <4063c95f-041e-4c12-52bc-20e63730b9ae@yandex.ru> (raw)
In-Reply-To: <jwvk00w7xhk.fsf-monnier+emacs@gnu.org>

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






  reply	other threads:[~2023-02-05 19:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 16:03 bug#61098: 29.0.60; Confusing behavior of show-paren-mode Rah Guzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-28 12:20 ` Eli Zaretskii
2023-01-30 19:21   ` Rah Guzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-31 12:03     ` Eli Zaretskii
2023-01-31 13:03       ` Rah Guzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-31 14:13         ` Eli Zaretskii
2023-01-31 14:41           ` Dmitry Gutov
2023-01-31 22:42       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-01 17:48         ` Eli Zaretskii
2023-02-05 15:19           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 15:24             ` Eli Zaretskii
2023-02-05 17:21               ` Dmitry Gutov
2023-02-05 18:29                 ` Eli Zaretskii
2023-02-05 19:06                   ` Dmitry Gutov
2023-02-05 18:57                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 19:09                   ` Dmitry Gutov [this message]
2023-01-31  2:37   ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4063c95f-041e-4c12-52bc-20e63730b9ae@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=61098-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rahguzar@zohomail.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.