From: Eli Zaretskii <eliz@gnu.org>
To: Rah Guzar <rahguzar@zohomail.eu>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 61098@debbugs.gnu.org
Subject: bug#61098: 29.0.60; Confusing behavior of show-paren-mode
Date: Sat, 28 Jan 2023 14:20:05 +0200 [thread overview]
Message-ID: <83o7qiam16.fsf@gnu.org> (raw)
In-Reply-To: <877cx8ose0.fsf@zohomail.eu> (bug-gnu-emacs@gnu.org)
> Date: Fri, 27 Jan 2023 17:03:14 +0100
> From: Rah Guzar via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
>
> Dear Emacs maintainers,
> After updating to Emacs 29, I saw in NEWS that show-paren-mode
> is no longer enabled in special-mode buffers. I think that is a
> welcome change. However in some cases (like reading the elisp
> manual) it is helpful to have it enabled. My impression after
> reading the NEWS entry, the manual entry for show-paren-mode
> and documentation for show-paren-local-mode was that I should
> be able to able to turn on show-paren-mode buffer locally by
>
> M-x show-paren-local-mode RET
>
> However this doesn't work and after much confusion I realized
> that calling show-paren-local-mode has effect only if I customize
> show-paren-predicate. My (incorrect) impression after reading
> the documentation was that show-paren-predicate determines only
> whether show-paren-mode is enabled in a buffer by default but
> doesn't prohibit the possibility of turning it off.
Your impression was correct: there should be no need to customize
show-paren-predicate to turn on show-paren-local-mode in a buffer that
is under a descendant of special-mode. The patch below fixes the bug
and allows you to do what you want without messing with
show-paren-predicate.
However, there's one glitch: after applying the patch, when you invoke
M-x show-paren-local-mode RET
in a special-mode buffer, it says the mode is _disabled_, and indeed
disables the mode. You need to enable it by invoking the same command
again.
I'm not sure I understand the reason, but it is probably related to
the fact that we use the same show-paren-mode variable for the
localized mode, and the default value of that variable is t.
Stefan, can you help here? how do we make show-paren-local-mode be
enabled when the user explicitly invokes it?
Here's the patch I promised above:
diff --git a/lisp/paren.el b/lisp/paren.el
index b2a7962..de14de2 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -167,8 +167,11 @@ show-paren-local-mode
(unless show-paren-mode
(show-paren--delete-overlays))
(kill-local-variable 'show-paren-mode))
- ((not (default-value 'show-paren-mode))
- ;; Locally enabled, but globally disabled.
+ ((or
+ ;; Locally enabled, but globally disabled.
+ (not (default-value 'show-paren-mode))
+ ;; Disabled by 'show-paren-predicate'.
+ (not (buffer-match-p show-paren-predicate (current-buffer))))
(show-paren-mode 1) ; Setup the timer.
(setq-default show-paren-mode nil) ; But keep it globally disabled.
)
next prev parent reply other threads:[~2023-01-28 12:20 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 [this message]
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83o7qiam16.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=61098@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).