[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61098: closed (29.0.60; Confusing behavior of show-paren-mode)

From: GNU bug Tracking System
Subject: bug#61098: closed (29.0.60; Confusing behavior of show-paren-mode)
Date: Sun, 05 Feb 2023 19:10:02 +0000

Your message dated Sun, 5 Feb 2023 21:09:36 +0200
with message-id <4063c95f-041e-4c12-52bc-20e63730b9ae@yandex.ru>
and subject line Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode
has caused the debbugs.gnu.org bug report #61098,
regarding 29.0.60; Confusing behavior of show-paren-mode
to be marked as done.

(If you believe you have received this mail in error, please contact

61098: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61098
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 29.0.60; Confusing behavior of show-paren-mode Date: Fri, 27 Jan 2023 17:03:14 +0100 User-agent: mu4e 1.8.13; emacs 29.0.60
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.

    I think a better default would be the equivalent of customizing
    show-buffer-predicate to t and then using

    (add-hook 'special-mode-hook
          (defun my-turn-off-show-paren () (show-paren-local-mode -1)))

    which is what I have added to my config. This was the result I was
    expecting from the NEWS and manual entry and I think those should
    be clarified.

In GNU Emacs 29.0.60 (build 1, x86_64-suse-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.17.6) of 2023-01-22 built on sheep83
System Description: openSUSE Tumbleweed

Configured using:
 'configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu
 --program-prefix= --disable-dependency-tracking --prefix=/usr
 --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
 --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-pgtk --with-native-compilation=aot
 --with-cairo --with-libotf --with-jpeg --with-tiff --with-gif
 --with-png --with-rsvg --with-xft --with-xml2 --with-dbus --with-sound
 --with-json --with-mailutils --with-gnutls --with-tree-sitter
 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
 -fstack-clash-protection -Werror=return-type -flto=auto'

Configured features:

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: mu4e:main

Minor modes in effect:
  delete-selection-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  eros-mode: t
  save-place-mode: t
  global-so-long-mode: t
  projectile-mode: t
  which-key-mode: t
  savehist-mode: t
  better-jumper-mode: t
  better-jumper-local-mode: t
  global-company-mode: t
  vertico-mode: t
  all-the-icons-completion-mode: t
  marginalia-mode: t
  evil-goggles-mode: t
  evil-escape-mode: t
  evil-snipe-override-mode: t
  evil-snipe-mode: t
  gcmh-mode: t
  winner-mode: t
  smartparens-global-mode: t
  ws-butler-global-mode: t
  global-undo-fu-session-mode: t
  undo-fu-mode: t
  recentf-mode: t
  mu4e-search-minor-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  mu4e-update-minor-mode: t
  mu4e-context-minor-mode: t
  dirvish-override-dired-mode: t
  server-mode: t
  solaire-global-mode: t
  solaire-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  windmove-mode: t
  workroom-mode: t
  +popup-mode: t
  +modeline-global-mode: t
  +modeline-mode: t
  override-global-mode: t
  general-override-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  window-divider-mode: t
  buffer-read-only: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
hides /home/azeem/.emacs.d/.local/straight/build-29.0.60/citar/citar-embark

(shadow emacsbug vertico-directory consult-flymake tabify
evil-collection-vc-git vc-git evil-collection-diff-mode diff-mode
vc-dispatcher char-fold company-ispell company-dabbrev adaptive-wrap
spell-fu evil-collection-embark embark-org embark-consult embark ffap
network-stream url-http url-gw nsm url-cache url-auth gts-engine-deepl
gts-implements gts-faces gts-core guess-language ispell
evil-collection-indent jka-compr evil-collection-helpful helpful
evil-collection-imenu imenu trace evil-collection-edebug edebug
evil-collection-debug debug backtrace info-look evil-collection-info
info evil-collection-elisp-refs elisp-refs evil-collection-xref xref
help-fns radix-tree evil-collection-help descr-text use-package-lint
hide-mode-line company-yasnippet delsel auto-minor-mode disp-table
whitespace bicycle hideshow evil-embrace evil-surround embrace
expand-region text-mode-expansions the-org-mode-expansions
er-basic-expansions expand-region-core expand-region-custom eros
highlight-quoted rainbow-delimiters highlight-numbers parent-mode
display-line-numbers hl-todo evil-collection-elisp-mode elisp-mode
saveplace evil-collection-so-long so-long cursor-sensor vertico-repeat
vc-svn projectile lisp-mnt evil-collection-grep grep ibuffer-vc ibuf-ext
evil-collection-ibuffer ibuffer ibuffer-loaddefs shr-color sort
gnus-cite smiley qp mm-archive mail-extr textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check
evil-collection-which-key which-key savehist better-jumper company-capf
company consult-vertico evil-collection-vertico vertico orderless
all-the-icons-completion marginalia evil-goggles pulse color
evil-easymotion evil-escape evil-snipe autorevert filenotify gcmh winner
smartparens-config smartparens-rst smartparens-markdown smartparens-text
smartparens ws-butler undo-fu-session undo-fu desktop frameset
evil-collection-consult consult compat-28 recentf tree-widget
evil-collection-mu4e mu4e mu4e-org org-element org-persist xdg org-id
org-refile avl-tree generator oc-natbib oc-csl citeproc
citeproc-itemgetters citeproc-biblatex citeproc-bibtex parsebib
ol-bibtex evil-collection-org smartparens-org org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete
org-list org-footnote org-faces org-entities noutline outline
ob-emacs-lisp org-table ol org-keys citeproc-cite citeproc-subbibs
citeproc-sort citeproc-name citeproc-formatters citeproc-number rst
citeproc-proc citeproc-disamb citeproc-itemdata
citeproc-generic-elements citeproc-macro citeproc-choose citeproc-date
citeproc-context citeproc-prange citeproc-style citeproc-locale
citeproc-term f f-shortdoc citeproc-rt citeproc-lib citeproc-s s queue
dash bibtex oc-biblatex oc org-loaddefs find-func mu4e-main mu4e-view
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum
gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
gnus-win evil-collection-gnus gnus nnheader range
evil-collection-calendar cal-menu calendar cal-loaddefs mu4e-headers
mu4e-compose mu4e-draft mu4e-actions smtpmail mu4e-search mu4e-lists
mu4e-bookmarks mu4e-mark mu4e-message shr pixel-fill kinsoku url-file
svg xml dom browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util url-parse
auth-source json map url-vars flow-fill mule-util hl-line mu4e-contacts
mu4e-update mu4e-folders mu4e-server mu4e-context mu4e-vars mu4e-helpers
mu4e-config ido message sendmail mailcap yank-media puny dirvish
transient eieio eieio-core evil-collection-dired dired dired-loaddefs
rfc822 mml mml-sec password-cache evil-collection-epa epa epg rfc6068
epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader server dtrt-indent doom-themes-ext-org
solaire-mode face-remap doom-earl-grey-theme doom-themes
doom-themes-base evil-collection-flymake flymake-proc flymake
evil-collection-compile compile html2text ob-core org-cycle org-fold
org-fold-core org-compat ob-eval org-version org-macs format-spec
ibuf-macs evil-collection-bookmark evil-collection-custom cus-edit
cus-load wid-edit evil-collection-comint evil-collection annalist evil
evil-integration evil-maps evil-commands reveal flyspell evil-jumps
evil-command-window evil-search shell pcomplete comint ansi-osc
ansi-color evil-types evil-macros evil-repeat evil-states evil-core comp
comp-cstr warnings icons advice evil-common windmove calc calc-loaddefs
calc-macs thingatpt rect evil-digraphs evil-vars ring workroom compat
compat-macs project byte-opt bookmark text-property-search all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons let-alist derived edmacro
kmacro use-package-bind-key bind-key rx doom-editor doom-projects
doom-ui easy-mmode doom-keybinds pp cl-extra help-mode use-package-core
bytecomp byte-compile general tex-site doom-start doom-modules cl-seq
doom doom-lib cl-macs cl-loaddefs cl-lib pcase gv jansson
dynamic-modules subr-x rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/pgtk-win
pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1014671 320177)
 (symbols 48 61381 35)
 (strings 32 396235 10485)
 (string-bytes 1 9425734)
 (vectors 16 116749)
 (vector-slots 8 3990496 136139)
 (floats 8 1721 1576)
 (intervals 56 9262 358)
 (buffers 984 40))

--- End Message ---
--- Begin Message --- Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Date: Sun, 5 Feb 2023 21:09:36 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 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
 (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)))
    ((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)

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]