From unknown Sat Aug 16 18:16:35 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#61098 <61098@debbugs.gnu.org> To: bug#61098 <61098@debbugs.gnu.org> Subject: Status: 29.0.60; Confusing behavior of show-paren-mode Reply-To: bug#61098 <61098@debbugs.gnu.org> Date: Sun, 17 Aug 2025 01:16:35 +0000 retitle 61098 29.0.60; Confusing behavior of show-paren-mode reassign 61098 emacs submitter 61098 Rah Guzar severity 61098 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 27 11:27:05 2023 Received: (at submit) by debbugs.gnu.org; 27 Jan 2023 16:27:05 +0000 Received: from localhost ([127.0.0.1]:38324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLRZA-00089C-M3 for submit@debbugs.gnu.org; Fri, 27 Jan 2023 11:27:05 -0500 Received: from lists.gnu.org ([209.51.188.17]:51386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLRZ7-00088l-4C for submit@debbugs.gnu.org; Fri, 27 Jan 2023 11:27:03 -0500 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 1pLRZ5-0006pD-2m for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2023 11:26:59 -0500 Received: from sender11-pp-o93.zoho.eu ([31.186.226.251]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLRZ2-000813-HK for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2023 11:26:58 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1674836812; cv=none; d=zohomail.eu; s=zohoarc; b=CDjjfeZpxO0MsbgJB8jygeTANUUDp0JUqF2nByykY59QTglvwS+1PrBJ+M9pt6GYbUlnEOovqV9d9QmzP6UeckFASfEVibAu6cfApbZKCYoxChNn8GiDqgzAQE1p6ZV79J7IAW4UbR5cTn9EHiimJgQyC5M/wXGCWtCMalVJEHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1674836812; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=0NPg/C/NnYx/H1RFHZLSre38htcU6/jP5UJ8uTea+YE=; b=CyFguq/5ksJRsyKtpxt4SDq/KAtbUHUiTGQGqifwsHjJEW14eQSxyxF/Ca7AISFon3hnYigW7IutoCoMXiTDK9jE6DR5hj9vbdMRaB9iCOMcCWKPoW2eV3CC9Jf78YmLkZLj0CaRghCS5woDZ2xH1N1jNCpD/Ubg/5oim1qTEp0= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=zohomail.eu; spf=pass smtp.mailfrom=rahguzar@zohomail.eu; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1674836812; s=zoho; d=zohomail.eu; i=rahguzar@zohomail.eu; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To:Cc; bh=0NPg/C/NnYx/H1RFHZLSre38htcU6/jP5UJ8uTea+YE=; b=ZV1qQ6FyGDrV8Alr93uti3v1xjpDCQfc85IHITkH0E+J5kK8vN3Xnl43jqDhIRCP JSp0gH91F986OA7cVjCccO35Afv105ZY8J++8bpW+Bxg6rGr2L/icLrr5map59TugbP cozHv044jzXOVGOvOSjVruOxhbi9m6gXlGl/C77w= Received: from localhost (emp-88-219.eduroam.uu.se [130.238.88.219]) by mx.zoho.eu with SMTPS id 167483680929928.05806516879727; Fri, 27 Jan 2023 17:26:49 +0100 (CET) User-agent: mu4e 1.8.13; emacs 29.0.60 From: Rah Guzar To: bug-gnu-emacs@gnu.org Subject: 29.0.60; Confusing behavior of show-paren-mode Date: Fri, 27 Jan 2023 17:03:14 +0100 Message-ID: <877cx8ose0.fsf@zohomail.eu> MIME-Version: 1.0 Content-Type: text/plain X-ZohoMailClient: External Received-SPF: pass client-ip=31.186.226.251; envelope-from=rahguzar@zohomail.eu; helo=sender11-pp-o93.zoho.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 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 --enable-locallisppath=/usr/share/emacs/29.0.60/site-lisp:/usr/share/emacs/site-lisp 'CFLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto' LDFLAGS=-Wl,-O2' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB 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: /home/azeem/.emacs.d/.local/straight/build-29.0.60/citar-embark/citar-embark hides /home/azeem/.emacs.d/.local/straight/build-29.0.60/citar/citar-embark Features: (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)) From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 28 07:20:26 2023 Received: (at 61098) by debbugs.gnu.org; 28 Jan 2023 12:20:26 +0000 Received: from localhost ([127.0.0.1]:39751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLkC1-0000pf-Pi for submit@debbugs.gnu.org; Sat, 28 Jan 2023 07:20:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLkC0-0000pT-3p for 61098@debbugs.gnu.org; Sat, 28 Jan 2023 07:20:24 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLkBu-0007rE-PM; Sat, 28 Jan 2023 07:20:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mUAkpHcvW7d69WzTT2O7/fxaX0ijM9kQLZfihRrM9JM=; b=DE7BCFfucot4 7KGr88PIcFVTZ/9pqfCNp37FXhkjy7ACMFQChsPvwLD/JCwiQNd+b4ZAE6SgzzeKnfPV2W6KWncbh 9svyydIr79LrquCGXs++1oOD12wr1wvCoExhFkkYjPWoBd5+3U5lO1QwJsh+Xxwg3Vd+DMFuILVuo VJot/GZYH0QiwCQ7cO+oByegvwCjQ0EqjYCt7ZVi7v+dPN+b7R6j6FQM4f+u7Fql9jjxA5lhJMG04 IHgtHwURTp8JP/CHw0yzlXb9Q95yFBiNuerCwQQVzu2k+dlWGDDKLy8QGx+6mQ9DEAX/rVzc2FU9+ yuY3Kk3bqy9vT2xeIPWa5g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLkBu-0006iU-6d; Sat, 28 Jan 2023 07:20:18 -0500 Date: Sat, 28 Jan 2023 14:20:05 +0200 Message-Id: <83o7qiam16.fsf@gnu.org> From: Eli Zaretskii To: Rah Guzar , Stefan Monnier In-Reply-To: <877cx8ose0.fsf@zohomail.eu> (bug-gnu-emacs@gnu.org) Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode References: <877cx8ose0.fsf@zohomail.eu> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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" > > > 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. ) From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 14:32:19 2023 Received: (at 61098) by debbugs.gnu.org; 30 Jan 2023 19:32:19 +0000 Received: from localhost ([127.0.0.1]:50625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMZt5-0004OW-Bk for submit@debbugs.gnu.org; Mon, 30 Jan 2023 14:32:19 -0500 Received: from sender11-pp-o91.zoho.eu ([31.186.226.249]:25236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMZt3-0004OO-Nz for 61098@debbugs.gnu.org; Mon, 30 Jan 2023 14:32:18 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1675107127; cv=none; d=zohomail.eu; s=zohoarc; b=dC0mehrpmmwjSJ8v8yT2ABrpYllyA0d/TrepkTho802m83u2B+e7i5oowMeNp/Mk645qhppsFyCc5XzCit2eyu6kYd67HtI6C1DNGzmX7blAqrbnBZEE0iswQcnMVE+XOucWlPcpL+qpJnIdZPFGEPnpIkV7Qnq10ksY2Uvk59M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1675107127; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7kJAUzAojrrV2uSCsFSdyo8quCEZlT6rDkjMXtq96iQ=; b=INQHa1LTimNtzFE7bxxP163MXwASd2khzYy4fLDMN+4lC3IT103gV/x/0voSxhretKR8bJlpuAtBW2sjootMc11wSWqOqB0D5/mtBJXcAWZXtH8NBhD0TKliLoxK7ArH9uTAggEvjEXzhumpqrH15JdkX5yxjSBl7Y2vVrPQsCs= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=zohomail.eu; spf=pass smtp.mailfrom=rahguzar@zohomail.eu; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1675107127; s=zoho; d=zohomail.eu; i=rahguzar@zohomail.eu; h=References:From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To; bh=7kJAUzAojrrV2uSCsFSdyo8quCEZlT6rDkjMXtq96iQ=; b=KMcXQNYZYvIRxe3neKeW7YOz3BEm4fanWqHZL/04nIwzss+OrOmjLeOSg18B9GJG doxoqTIif18586NOrux4EaX6gZIjmhgf9IhxHR81KWVL+ihCO4dVSsbyxtsR+2rnY+x hMGTWPlztdDIC5bUhZsZvOWjXQamB8ky/+DvI40o= Received: from localhost (81-231-79-170-no600.tbcn.telia.com [81.231.79.170]) by mx.zoho.eu with SMTPS id 1675107124528891.3523744217221; Mon, 30 Jan 2023 20:32:04 +0100 (CET) References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> User-agent: mu4e 1.8.13; emacs 29.0.60 From: Rah Guzar To: Eli Zaretskii Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Date: Mon, 30 Jan 2023 20:21:33 +0100 In-reply-to: <83o7qiam16.fsf@gnu.org> Message-ID: <87y1pjstse.fsf@zohomail.eu> MIME-Version: 1.0 Content-Type: text/plain X-ZohoMailClient: External X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, Thanks for the patch, it works as you described. However I have questions about the show-paren-predicate variable. When I see its default value (not (derived-mode . special-mode)) it makes me think there is some dsl involved. The customize interface mentions Lisp Expression as a possibility but the documentation doesn't explain what form this expression is supposed to take. This makes me think that the default is just a pseudo sentence intended to convey what it does and there are only three possibilities. If the latter is correct, I think a simpler way would be to disable the mode in the body of special-mode if the value of `show-paren-predicate` demands it. I think this will get rid of the problem that the mode is disabled the first time show-paren-local-mode is called. I am using the equivalent of this which adds a hook to special-mode-hook to achieve the outcome and I am pretty happy with it. Thanks again, Rahguzar Eli Zaretskii writes: >> 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" >> >> >> 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. > ) From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 21:38:00 2023 Received: (at 61098) by debbugs.gnu.org; 31 Jan 2023 02:38:00 +0000 Received: from localhost ([127.0.0.1]:51039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMgX2-0007EJ-9z for submit@debbugs.gnu.org; Mon, 30 Jan 2023 21:38:00 -0500 Received: from mail-ej1-f54.google.com ([209.85.218.54]:40870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMgWz-0007E4-Iq for 61098@debbugs.gnu.org; Mon, 30 Jan 2023 21:37:58 -0500 Received: by mail-ej1-f54.google.com with SMTP id me3so37653797ejb.7 for <61098@debbugs.gnu.org>; Mon, 30 Jan 2023 18:37:57 -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=EGF6+LvWa6irDcmH6HXb4o7yU/qF3MXyEdzz5hNH4Do=; b=GsEXVKYLTjjkrY/7OXL5Rz1u28qT5VhaOXA41C1qsngdApN5Pc5jSZSCspux/B+eGb 1A+MgUwDQ7+1AIUcJA60m/I+9DyR6C9TSvdTeoq8zcDdlf1o0KW4gSiPpf/TnFMhuH1A dUO1SkGLqTVq1Mhlbzw+SAD4haYJaBe0tG0/olW7pNdv63d/iOYwVG1Pj3aSlEgMOnkT iu4AHVP+Dtt7iwP+ZJdxYKzJne1gb+psHd7hiEhrZPnBLEuAhu/D/nNwJ7179nUVOSW8 BIM9S4rgomF96FbSKESFoO9Dtw3LK3VfAMa820KpceRw7CsDJfvkNIVT3AU0RPFv8Cda SFfQ== 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=EGF6+LvWa6irDcmH6HXb4o7yU/qF3MXyEdzz5hNH4Do=; b=fA3tFhZtb78hx9GEdCOcEyw5a2ZHSIJsSnj/lMXq0GPxJbi8zjx4sK+Dt83lxr1Kb9 o+5093hgucI13867SBkYJDvK/w+EUbXqnJMRw2WwvmVJVqjtOuqQSfRonDicfmtJ2B6r TwIDeaOgh8wcHCHFz8V+d+KjTVwnj64F6ZoJw0g5avSD0+IYWXAvzZ01m8azSYb5By/k AIOhRFC5AzuCiv42zarIdAmAxh54R2mxuivU6ntLAZTd8m4Etg0uSQKq9diXcFicgboc ihbYyrz8/C2htPQIEHfuJi6ac+ZOd0IeaihJLLP6GVq+Y005Oq2CIWxo519wPO3mAV79 sCoQ== X-Gm-Message-State: AO0yUKUMuEuvJNtym9FhHxI4IDU0Ho/fvpFMMhNjDyLwwh6Gkw/thhEo G0vxBqAF2JkzhcIax+OnjhI= X-Google-Smtp-Source: AK7set9p7y/TKNRNocW8EHODT/mzi0Dev+Nh4fr4RQ9jks+mrEDv/1r4+0RsswPBQvoA7T4hmOZJ6w== X-Received: by 2002:a17:906:18ea:b0:878:5c36:a14a with SMTP id e10-20020a17090618ea00b008785c36a14amr19035399ejf.23.1675132671554; Mon, 30 Jan 2023 18:37:51 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id c2-20020a170906762200b0087851a76573sm7849683ejn.74.2023.01.30.18.37.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Jan 2023 18:37:50 -0800 (PST) Message-ID: <868d11b4-1881-db52-4c54-ccb9833bcaf6@yandex.ru> Date: Tue, 31 Jan 2023 04:37:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Content-Language: en-US To: Eli Zaretskii , Rah Guzar , Stefan Monnier References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <83o7qiam16.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 28/01/2023 14:20, Eli Zaretskii wrote: > Here's the patch I promised above: Your patch modifies the part which called the show-paren-mode to set up the timer, but the timer is started unconditionally, so predicate check is inside the timer function. So it seems incorrect to me. I suggest trying the patch below. It makes sure the buffer-local value of show-paren-mode is kept buffer-local even if it matches the global one (while it's = t), so that the later check (or (local-variable-p 'show-paren-mode) ;; If not, check that the predicate matches. (buffer-match-p show-paren-predicate (current-buffer))) works correctly. diff --git a/lisp/paren.el b/lisp/paren.el index b2a79624c0f..437dc057c46 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -165,8 +165,8 @@ show-paren-local-mode (cond ((eq show-paren-mode (default-value 'show-paren-mode)) (unless show-paren-mode - (show-paren--delete-overlays)) - (kill-local-variable 'show-paren-mode)) + (show-paren--delete-overlays) + (kill-local-variable 'show-paren-mode))) ((not (default-value 'show-paren-mode)) ;; Locally enabled, but globally disabled. (show-paren-mode 1) ; Setup the timer. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 07:03:41 2023 Received: (at 61098) by debbugs.gnu.org; 31 Jan 2023 12:03:41 +0000 Received: from localhost ([127.0.0.1]:51773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMpMT-00007k-BQ for submit@debbugs.gnu.org; Tue, 31 Jan 2023 07:03:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMpMS-00007T-9j for 61098@debbugs.gnu.org; Tue, 31 Jan 2023 07:03:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMpMM-0005He-Hv; Tue, 31 Jan 2023 07:03:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UssjkxcRLbRtul3vxLQiLT5lmB+88CQxOU9EASa1DHY=; b=iTdhd8h0hNWS 0uRJBiQ/gd2mJvJ7g0MwDNcCs6P/WwKtG5pB4/PR4odV9xqnuKRbKo4XK71OEwZ/Qx4ceMiKYZE0S mlIAc4iBisg/UsAtmQBD9dY/yCV8LQYLrTcRIUj87Ams3sEL8RBiU2IQ4fFKKHCOoY0H74lY2/NSJ 6ybzIOhKe617akszMZn8UGPcyg7GvQ3PH2r6ptGCdk8Bi85iGSOZofMRyjpKo6eCAkd6jqNrLxCjs V8Hj7sl5aKqAJoBPw2W5yz6PXi38hBpWxe7pxgwt6bq1qpk+pv1qwOynI5X2xk/iz+eZCUaeS8+W0 9IXlR8I/H+LuLg9ggYrdIw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMpML-0004Jy-UJ; Tue, 31 Jan 2023 07:03:34 -0500 Date: Tue, 31 Jan 2023 14:03:28 +0200 Message-Id: <83r0va3o8f.fsf@gnu.org> From: Eli Zaretskii To: Rah Guzar , Stefan Monnier In-Reply-To: <87y1pjstse.fsf@zohomail.eu> (message from Rah Guzar on Mon, 30 Jan 2023 20:21:33 +0100) Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Rah Guzar > Cc: Stefan Monnier , 61098@debbugs.gnu.org > Date: Mon, 30 Jan 2023 20:21:33 +0100 > > Hi, > Thanks for the patch, it works as you described. Thanks for testing. I'm still waiting for Stefan to help me understand why after that patch "M-x show-paren-local-mode" _disables_ the mode rather than enabling it. Stefan, any wisdom? > However I have questions about the show-paren-predicate variable. > > When I see its default value (not (derived-mode . special-mode)) > it makes me think there is some dsl involved. The customize interface > mentions Lisp Expression as a possibility but the documentation doesn't > explain what form this expression is supposed to take. It should be an expression that yields a boolean value (that's why the variable is named "predicate"). I will improve the doc string when I install the final version of the changes. > This makes me think that the default is just a pseudo sentence > intended to convey what it does and there are only three > possibilities. No, it's a real expression in Lisp, just quoted. > If the latter is correct, I think a simpler way would be to disable > the mode in the body of special-mode if the value of `show-paren-predicate` > demands it. I think this will get rid of the problem that the mode is > disabled the first time show-paren-local-mode is called. > > I am using the equivalent of this which adds a hook to special-mode-hook > to achieve the outcome and I am pretty happy with it. I don't think I understand what you have in mind, but let's wait for Stefan to chime in. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 08:08:32 2023 Received: (at 61098) by debbugs.gnu.org; 31 Jan 2023 13:08:32 +0000 Received: from localhost ([127.0.0.1]:51832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMqNB-0006ds-4G for submit@debbugs.gnu.org; Tue, 31 Jan 2023 08:08:32 -0500 Received: from [31.186.226.249] (port=25242 helo=sender11-pp-o91.zoho.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMqN1-0006dN-DK for 61098@debbugs.gnu.org; Tue, 31 Jan 2023 08:08:28 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1675170463; cv=none; d=zohomail.eu; s=zohoarc; b=ZqeXRj35y9Tg92lhctxzCGuwOJ+VPoEwYdX84j26ACkPCs/rkp9wNIx285xobeZ4W45ShskINQy7ks2HPdF4g0WXzEOZJnQU/0bipkjyWTOrgSVyiPGO4vJ5PZy0jJnJUYrUxsDt/J06XaFGtTMCn2FA2rIS2RYTrcr6g323syc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1675170463; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=QQsROx6gFPwVHsxmbmOlOAYAcd3h5WefAMCE/+kHOfM=; b=Td5uutw8tlzSUaqeQ/n+H/5SE/nmdu1LguXHRaMAD2B7hXtFCcRgbYXiqGF9z9G71dbmPWHNJz1TNKchHBauFw6qGfTJb0/LEiMdTlatCpvtXwPOSJ8TKX+d7R8pGL2tFFb3q6/5MJTafwLMQY5msDdQjLupbvAXJtFZXmvgQqo= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=zohomail.eu; spf=pass smtp.mailfrom=rahguzar@zohomail.eu; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1675170463; s=zoho; d=zohomail.eu; i=rahguzar@zohomail.eu; h=References:From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To; bh=QQsROx6gFPwVHsxmbmOlOAYAcd3h5WefAMCE/+kHOfM=; b=o/1w7IfkmtbLk6NFeCOwfnDr3flrni08GOO0lEYosu7Fg044ZNNTsNl9tySxfpXX 6OxFPQ1jhIb9eP9BRWWc1NgTsnnZD4i4g5PR0ZkL7v537qNGqHjKTnWKrTGtauhqaB9 7YSB8iocJrtiZ9cxeaS4CARnVSfm8Nq6GASbh/UU= Received: from localhost (emp-183-180.eduroam.uu.se [130.238.183.180]) by mx.zoho.eu with SMTPS id 1675170460733495.2542677583922; Tue, 31 Jan 2023 14:07:40 +0100 (CET) References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> User-agent: mu4e 1.8.13; emacs 29.0.60 From: Rah Guzar To: Eli Zaretskii Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Date: Tue, 31 Jan 2023 14:03:20 +0100 In-reply-to: <83r0va3o8f.fsf@gnu.org> Message-ID: <87tu06svhg.fsf@zohomail.eu> MIME-Version: 1.0 Content-Type: text/plain X-ZohoMailClient: External X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Eli Zaretskii writes: > It should be an expression that yields a boolean value (that's why the > variable is named "predicate"). I will improve the doc string when I > install the final version of the changes. Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [31.186.226.249 listed in list.dnswl.org] 0.0 T_SPF_TEMPERROR SPF: test of record failed (temperror) 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) Eli Zaretskii writes: > It should be an expression that yields a boolean value (that's why the > variable is named "predicate"). I will improve the doc string when I > install the final version of the changes. What I had been missing was how is that expression supposed to yield a boolean value. I think I gleaned the answer from Dmitry Gutov's message which is that the expression corresponds to the "condition" argument of buffer-match-p. Rahguzar From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 09:14:02 2023 Received: (at 61098) by debbugs.gnu.org; 31 Jan 2023 14:14:02 +0000 Received: from localhost ([127.0.0.1]:51899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMrOc-0008II-DH for submit@debbugs.gnu.org; Tue, 31 Jan 2023 09:14:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMrOb-0008Hj-4N for 61098@debbugs.gnu.org; Tue, 31 Jan 2023 09:14:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMrOV-0005zC-Qa; Tue, 31 Jan 2023 09:13:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rqLXbOmKDNuskgxScI1qNAaryFGYll1p+yndx5hycRc=; b=c+bCkU0Wza8P D5R/6LmtrsHRuEFMvZcqE3mpF8SUaDprNuWAQIso7g8Btrz9hlFx+FcFaaLf6eNpxk6LpOvA7OWGH mWtVtBUVHzcFTEmGOOPEalpAEdBgNWv78GwSb7o1ig/3oL+w6WttNx5ChBvp+7t4vT0ae6cuTe9F5 K4VAREbFa2EQ3uxOYNDb03VYNCOmqQ5JcKBgqRN0jdu8pCVLmwCHjUTfHgz/kUp41md10QP9uWvnF tnx+amyVwXwIfdp/2FThvDzPVmQds+R3pVU3Ph+r6yjKO3+6p+n6kvzLq0PiZNLjfPCNEgeRllwb5 xQgf3FFsMvEZAMtcWxjhtw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMrOV-0001lK-AS; Tue, 31 Jan 2023 09:13:55 -0500 Date: Tue, 31 Jan 2023 16:13:52 +0200 Message-Id: <835ycm3i73.fsf@gnu.org> From: Eli Zaretskii To: Rah Guzar In-Reply-To: <87tu06svhg.fsf@zohomail.eu> (message from Rah Guzar on Tue, 31 Jan 2023 14:03:20 +0100) Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> <87tu06svhg.fsf@zohomail.eu> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Rah Guzar > Cc: Stefan Monnier , 61098@debbugs.gnu.org > Date: Tue, 31 Jan 2023 14:03:20 +0100 > > > Eli Zaretskii writes: > > > It should be an expression that yields a boolean value (that's why the > > variable is named "predicate"). I will improve the doc string when I > > install the final version of the changes. > > What I had been missing was how is that expression supposed to yield > a boolean value. The function 'not' returns a boolean value. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 09:41:58 2023 Received: (at 61098) by debbugs.gnu.org; 31 Jan 2023 14:41:58 +0000 Received: from localhost ([127.0.0.1]:52010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMrpd-0000eE-2G for submit@debbugs.gnu.org; Tue, 31 Jan 2023 09:41:58 -0500 Received: from mail-ej1-f50.google.com ([209.85.218.50]:46948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMrpX-0000dy-Uf for 61098@debbugs.gnu.org; Tue, 31 Jan 2023 09:41:55 -0500 Received: by mail-ej1-f50.google.com with SMTP id p26so31022693ejx.13 for <61098@debbugs.gnu.org>; Tue, 31 Jan 2023 06:41:51 -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=5C5vZqXQR1ayT+3I385r8ujdERk0cxh6urcls6en70g=; b=mlkwTY7jUDJz79RSP6x24rQI6fXXFXrvQ5KxOyaskZMjjUR5MJWkgzjQulLDLKS8Hl GLiYOdb5+AnLzRyy3TcAuLdtA4zSarDxYjKQ9W3idt+220zsKz7MHXJZsbjqBxvoeaNT a3+qHCFzVQ8GtQQr7YiVM45niHxUlFJKRaUB62l6gGjE4cg9xYzsZGGPdTiMA7gozoVx 65h56F1jpBcWu0jT2SjXY2Su1V8IRcMeGOR0yEtQZo3oS96sW5l1K07t66doxr2iyQJw 6cEEZizV0QJEBV02j1G2Y5eEoqlvMZqEd7oxd7UtStdWqCTorjqvk/MVyeP2yY8kzDQ+ 8Z/Q== 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=5C5vZqXQR1ayT+3I385r8ujdERk0cxh6urcls6en70g=; b=8R/E6OZLCnBOKi+MMi5NjfnaJ20mesFAQVrW2IoWh7aqhq0n++pHn3z6Xl711V5fTW LhaeZTPROCua2y2XgHbPDgMXcBMdf3sfNR8+WeFlLoq5jquwUd4+1cJnkiiochRnvaeT Qt4xQtiyyh7rqqWwTXJpB3U6tQWlwS7bhmP0CsCMX23+kWN5GswRLgxuyN09z12abZ/3 yRxFltW6iGXNbgYaoUDOOn4Yit2t1Q1SYLvdu0ZP6cYStHTxKoRKJUH3fLUVnWmDSEEH l479wImgz86AVWsuh/Lht+xc5zgG1LcgA9iLxnxfCtTeUQiGbKMqT1rjU6rrZDeALfvC VN1g== X-Gm-Message-State: AO0yUKWI6PVbRmOB0nOQ2tGfgolksJWY/+2+DOmX0qhIvS0gMDeD92+N 3kS5gQqSYqjlfMb+0URTqHA= X-Google-Smtp-Source: AK7set+NS9pcZl6GyIBe+TDniQs21/2ku1uENsxjoCJdaTUGy+3ApSN6/FO5dcs+MXt2nxBH1L2ujQ== X-Received: by 2002:a17:907:a641:b0:886:5a3d:661b with SMTP id vu1-20020a170907a64100b008865a3d661bmr11642973ejc.57.1675176105832; Tue, 31 Jan 2023 06:41:45 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id x10-20020a170906710a00b0088842b00241sm3477725ejj.114.2023.01.31.06.41.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Jan 2023 06:41:44 -0800 (PST) Message-ID: Date: Tue, 31 Jan 2023 16:41:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Content-Language: en-US To: Eli Zaretskii , Rah Guzar References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> <87tu06svhg.fsf@zohomail.eu> <835ycm3i73.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <835ycm3i73.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61098 Cc: 61098@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 31/01/2023 16:13, Eli Zaretskii wrote: >> From: Rah Guzar >> Cc: Stefan Monnier,61098@debbugs.gnu.org >> Date: Tue, 31 Jan 2023 14:03:20 +0100 >> >> >> Eli Zaretskii writes: >> >>> It should be an expression that yields a boolean value (that's why the >>> variable is named "predicate"). I will improve the doc string when I >>> install the final version of the changes. >> What I had been missing was how is that expression supposed to yield >> a boolean value. > The function 'not' returns a boolean value. 'not' is just a symbol in this case -- from a DSL. (buffer-match-p show-paren-predicate (current-buffer)) is supposed to return non-nil. See its docstring for the description of the DSL format. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 17:42:21 2023 Received: (at 61098) by debbugs.gnu.org; 31 Jan 2023 22:42:21 +0000 Received: from localhost ([127.0.0.1]:55269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMzKW-0008Gk-Tr for submit@debbugs.gnu.org; Tue, 31 Jan 2023 17:42:21 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59125) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMzKU-0008GX-C5 for 61098@debbugs.gnu.org; Tue, 31 Jan 2023 17:42:19 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F0DF78094B; Tue, 31 Jan 2023 17:42:12 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 323EA8089D; Tue, 31 Jan 2023 17:42:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675204931; bh=Jkxm30wRq8X2D4hAL2FYxXd5JJ5ksXCxZDx/V2nFvJ0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=nUP1MxldrGJabYGdLMyIzIBV2M0BQFbZsQ1TyvAtPmQrELtTGn6cFwMcUeU74VGCT i2271I59oktupTz9M+bgqhv9komVIJvY+/HmyoANG48NxxXNjTUHUhX+wbLAoEmCO4 ubcCgTLvTnPeMIiGjE93YpVFPbD0ArQkprDtYV6hUzvvBTMADMwGuta1Gb0QiMNIvp 0P+MXtRU/EOscgaOoh3f/7VZV0W8Gbc1pX6ioINEolBmVdpbkfgs9eVcWWQidMJ+dA kZwi16HOG5I6PGPloO8FK1v/lvOeS/QUrmgQZe/0yNIoziu/retWKnlqn8Myke7iJM jj4pg5sxUkA6w== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1C3C91212EC; Tue, 31 Jan 2023 17:42:11 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode In-Reply-To: <83r0va3o8f.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 31 Jan 2023 14:03:28 +0200") Message-ID: References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> Date: Tue, 31 Jan 2023 17:42:09 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.099 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: Rah Guzar , 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I'm still waiting for Stefan to help me understand why after that > patch "M-x show-paren-local-mode" _disables_ the mode rather than > enabling it. Stefan, any wisdom? Not sure. I don't quite understand how your patch intends to work. >From where I sit I get the impression that it will result in an inconsistent state in various "corner" cases. Dmitry's patch seems closer to my intuition (I might even suggest removing the `kill-local-variable` altogether). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 12:48:21 2023 Received: (at 61098) by debbugs.gnu.org; 1 Feb 2023 17:48:21 +0000 Received: from localhost ([127.0.0.1]:59784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNHDZ-0005ZX-6h for submit@debbugs.gnu.org; Wed, 01 Feb 2023 12:48:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNHDX-0005Yq-ES for 61098@debbugs.gnu.org; Wed, 01 Feb 2023 12:48:19 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNHDR-0003jx-QV; Wed, 01 Feb 2023 12:48:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=vqXwnsq6xOPuX0B0hq+R54hU/uLU06A2TFmS3gOX01A=; b=UBTEkRMQS19s h3/uO8P8n99PpE34tKubc+kLuYLntajbV7iIk8G8EZBTxkmiPyLQqiJVf3O43qnxLd6QXGR7m8AVg FstXhBYLeM7ri3LKOadHtHRT4msqvW9P9MC2kWOH18avvf+I7NTNKjVq7YqUwohSPYEst0r+WFDpx 4klvy64fMN6a7SAxhb6/Y7f1MYHFCGGaq4NRQlXuyLw4sU3znlr3pURZ/uh2jgUXDp81I4QeoLDHV WB/8XBOZE/QrK9doUVvL4wYPHczDQ+r+JuktQHgy6fScq5XCnhdYU8DiK5aWNBWrbwspJRxLrBqmd tLSSFmFedTR+e/DAjXdlzA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNHDR-0006Ib-6M; Wed, 01 Feb 2023 12:48:13 -0500 Date: Wed, 01 Feb 2023 19:48:11 +0200 Message-Id: <83k011z38k.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Tue, 31 Jan 2023 17:42:09 -0500) Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, dgutov@yandex.ru, 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Rah Guzar , 61098@debbugs.gnu.org > Date: Tue, 31 Jan 2023 17:42:09 -0500 > > > I'm still waiting for Stefan to help me understand why after that > > patch "M-x show-paren-local-mode" _disables_ the mode rather than > > enabling it. Stefan, any wisdom? > > Not sure. I don't quite understand how your patch intends to work. > >From where I sit I get the impression that it will result in an > inconsistent state in various "corner" cases. > > Dmitry's patch seems closer to my intuition (I might even suggest > removing the `kill-local-variable` altogether). I guess I don't understand what show-paren-local-mode does, then. Let me explain my line of reasoning: (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))) (cond ((eq show-paren-mode (default-value 'show-paren-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. (show-paren-mode 1) ; Setup the timer. (setq-default show-paren-mode nil) ; But keep it globally disabled. ) (t ;; Locally disabled only. (show-paren--delete-overlays)))) When I looked at the above function and stepped through it in the OP's scenario, what I saw was that the 2nd condition of 'cond' doesn't fire, because the default-value of show-paren-mode is t nowadays. So I concluded that this code relies on the mode being globally off by default, and attempted to fix the condition that turns the mode on locally even though it is on globally. The predicate used by the timer requires either a match of the buffer (which doesn't happen in this case) or that the local value of show-paren-mode is non-nil. Setting the local value non-nil is the job of the mode function, isn't it? So I tried to get the mode function do its job in this scenario. What Dmitry's patch does, and why it is supposed to fix this, I simply don't understand, perhaps for the same reason that I misinterpret what the mode function does. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 10:19:35 2023 Received: (at 61098) by debbugs.gnu.org; 5 Feb 2023 15:19:35 +0000 Received: from localhost ([127.0.0.1]:46288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgnn-0002w9-3L for submit@debbugs.gnu.org; Sun, 05 Feb 2023 10:19:35 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:16738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgnl-0002vw-FB for 61098@debbugs.gnu.org; Sun, 05 Feb 2023 10:19:33 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 177BA4407EE; Sun, 5 Feb 2023 10:19:28 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1A787440858; Sun, 5 Feb 2023 10:19:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675610366; bh=x6J3goP/gWEGjIzF5Zsgkat7x8ZRidzLW2eNIjObG1Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Z+JDZtmmZrkf0r2Pq2UlZyNshyedHt9dY76DI9r1NGhs+iP7JmyuzBb7my6m1+hbl Mh51MCGCVQk1hYjjVdw3ClplKUm+Ncqe5BYhLuUOMxOL/rZN3rC3ptvCu4+pUB7TpX b2P0JMVm7JdxK9gfDNsD0ZGtUOMMmNcijPf0gJoa7vUHAKCIIO8i98/BsIF3qVFBo+ vjkP0LV90EAaLUVmNjD6qblYaXFxmf87BNJZjuMHMy/RyEXFjScMynPO8xtz0Vdt6e LHHXxK+pzcqwHylDGUop5plYg3SFiCr5BFvkszMVqWY+NVp+AKJf21jWg2IOvAn1nZ 5iqPTw9yciwlQ== Received: from pastel (unknown [104.247.245.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BA05D122512; Sun, 5 Feb 2023 10:19:25 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode In-Reply-To: <83k011z38k.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 01 Feb 2023 19:48:11 +0200") Message-ID: References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> <83k011z38k.fsf@gnu.org> Date: Sun, 05 Feb 2023 10:19:24 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, dgutov@yandex.ru, 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I guess I don't understand what show-paren-local-mode does, then. Let > me explain my line of reasoning: > > (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))) > (cond > ((eq show-paren-mode (default-value 'show-paren-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. > (show-paren-mode 1) ; Setup the timer. > (setq-default show-paren-mode nil) ; But keep it globally disabled. > ) > (t ;; Locally disabled only. > (show-paren--delete-overlays)))) > > When I looked at the above function and stepped through it in the OP's > scenario, what I saw was that the 2nd condition of 'cond' doesn't > fire, because the default-value of show-paren-mode is t nowadays. So > I concluded that this code relies on the mode being globally off by > default, and attempted to fix the condition that turns the mode on > locally even though it is on globally. But if the mode is already globally enabled, the (setq-default show-paren-mode nil) will definitely not be right: you'd end up disabling it globally (while maybe keeping it enabled locally). > The predicate used by the timer requires either a match of the buffer > (which doesn't happen in this case) or that the local value of > show-paren-mode is non-nil. Setting the local value non-nil is the > job of the mode function, isn't it? Yes, but the first branch of the `cond` incorrectly does `kill-local-variable` under the assumption that the local value doesn't matter if it's the same as the global one, but that's not true here because (as a wise man said): The predicate used by the timer requires either a match of the buffer (which doesn't happen in this case) or that the local value of show-paren-mode is non-nil. -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 10:24:57 2023 Received: (at 61098) by debbugs.gnu.org; 5 Feb 2023 15:24:57 +0000 Received: from localhost ([127.0.0.1]:46293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgsy-00034a-Sg for submit@debbugs.gnu.org; Sun, 05 Feb 2023 10:24:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgsw-00034M-TT for 61098@debbugs.gnu.org; Sun, 05 Feb 2023 10:24:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOgsq-0001mu-Fr; Sun, 05 Feb 2023 10:24:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Q6TZmeMndIRbQSWC/gc4auX4lNnp5x1kEarE/KpMnhY=; b=UCJNZABDjCBK y/SLDWJFMIoyK53u/S5BOZ6ZVTf3uFRINmjwIzKLoLK0C42ABptztVDrGCZ4kyx6lONWRbJDyMg/6 XtvBQIcIEKfGUYMd3CI0Z/sbQNKGs7ruLj5Bg4Aak03Y+CzKgh9nQunxsm1iuQedc5OtrDsf9zUtJ Rnm+Nd8bxEOGB14ef4YmWoI+y47oPLafONOIcRpAMNWm9HEHf7udx3RnzPVgkxiTHckHVAQYXR0ar bjcfL3sS5Qc8Mu6t9TkKhQK/dft86mQezc1aopjBXLpqZcffZulrJrzRjLZHMTyiY4kKIZH5IYx+0 9hHOzPN9RfCU8KLP5mTRSg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOgsp-0002IF-Sy; Sun, 05 Feb 2023 10:24:48 -0500 Date: Sun, 05 Feb 2023 17:24:57 +0200 Message-Id: <83tu00qgmu.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Sun, 05 Feb 2023 10:19:24 -0500) Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode References: <877cx8ose0.fsf@zohomail.eu> <83o7qiam16.fsf@gnu.org> <87y1pjstse.fsf@zohomail.eu> <83r0va3o8f.fsf@gnu.org> <83k011z38k.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, dgutov@yandex.ru, 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: rahguzar@zohomail.eu, 61098@debbugs.gnu.org, dgutov@yandex.ru > Date: Sun, 05 Feb 2023 10:19:24 -0500 > > > I guess I don't understand what show-paren-local-mode does, then. Let > > me explain my line of reasoning: > > > > (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))) > > (cond > > ((eq show-paren-mode (default-value 'show-paren-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. > > (show-paren-mode 1) ; Setup the timer. > > (setq-default show-paren-mode nil) ; But keep it globally disabled. > > ) > > (t ;; Locally disabled only. > > (show-paren--delete-overlays)))) > > > > When I looked at the above function and stepped through it in the OP's > > scenario, what I saw was that the 2nd condition of 'cond' doesn't > > fire, because the default-value of show-paren-mode is t nowadays. So > > I concluded that this code relies on the mode being globally off by > > default, and attempted to fix the condition that turns the mode on > > locally even though it is on globally. > > But if the mode is already globally enabled, the (setq-default show-paren-mode nil) > will definitely not be right: you'd end up disabling it globally (while > maybe keeping it enabled locally). > > > The predicate used by the timer requires either a match of the buffer > > (which doesn't happen in this case) or that the local value of > > show-paren-mode is non-nil. Setting the local value non-nil is the > > job of the mode function, isn't it? > > Yes, but the first branch of the `cond` incorrectly does > `kill-local-variable` under the assumption that the local value doesn't > matter if it's the same as the global one, but that's not true here > because (as a wise man said): > > The predicate used by the timer requires either a match of the buffer > (which doesn't happen in this case) or that the local value of > show-paren-mode is non-nil. This answers only half of my questions, but if you and Dmitry think Dmitry's patch will solve this problem, then Dmitry, please install it and close this bug. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 12:21:40 2023 Received: (at 61098) by debbugs.gnu.org; 5 Feb 2023 17:21:40 +0000 Received: from localhost ([127.0.0.1]:46379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOihv-000649-Nh for submit@debbugs.gnu.org; Sun, 05 Feb 2023 12:21:40 -0500 Received: from mail-ej1-f49.google.com ([209.85.218.49]:46942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOihu-00063o-00 for 61098@debbugs.gnu.org; Sun, 05 Feb 2023 12:21:38 -0500 Received: by mail-ej1-f49.google.com with SMTP id p26so28080464ejx.13 for <61098@debbugs.gnu.org>; Sun, 05 Feb 2023 09:21:37 -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=8bJhpfQ4EhtfqNMy3N8f3D1LZaiVPmwuw4mgo0lhx/I=; b=ij6WrZJrnJK07PajT928jlsNJCAa/b5Ht6z2yOZXocImV78a6Ppi82IlI1JmbRoPw4 Y2V03SdNnuO3obkjrROPzcxgbBIQDSSU9Tphnyz+IiOFPbJdwxn8YNUFwKA9Ham6uRg5 dN57zhsq1hqFeCLezuKvaJUYAJNvSLHXtYiGz8jf712fQRtMgMGdOksxU4kHIQMU2Ztf EUQQFXDGIEpM/QDKtDJXNh3jfmY9ZwPVdiFxQbNJxZum1jnQ56ezUjNCE6EjaurysoDs L3RVD2BVY7nCSU0X35Mt2EUBtoXDD0wiUXrj627Ffx1i4rULgV68WdUJyy0KjF8Lj07M kyCw== 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=8bJhpfQ4EhtfqNMy3N8f3D1LZaiVPmwuw4mgo0lhx/I=; b=543oGd7nNUEhKUNyyGX8FS18vvrTh1gJIAX+5bV9Q77rJEjbmq0LRado1hfMFWghNM CNY21q6ctC5eGCJOy1tJ1dUzZW9CSiYPJDeFARNc3rMSf43zZeuug1M9MnkBoNUB5A8z Ysy6kE81rXO6MSdFt3g71I45c1BHXN+RiAcU5idFr6MhC7w06lk59uI59d9bQ//GwMzn b1MuURcyiA/OpVTgctxBJqDTyWgoobLHpsWBNbZbs9Lw+BwMhaW8ah3Dwo00nlKAnLKO osq44ddyXQtkVrYiscfmgOGPw3x6KNv3puRqPSIMDv35nnA1AmUe0lAWraSpBaXykOBO L50w== X-Gm-Message-State: AO0yUKVfvM1jX8QWGyV1eFrvRQbR5G+Hf7u5SqmTOHWpB3vaELn4/FcS MMC8+eaZKGvrbAL+dGm1z1Y= X-Google-Smtp-Source: AK7set/DjyaQrKOCUlsHCCg1Q4YI8ZExiPZ2pwndNCZzMbv36MqZNrSqvRhGvgckc3gmjT1pCzQq1g== X-Received: by 2002:a17:906:4f10:b0:87b:d4da:602f with SMTP id t16-20020a1709064f1000b0087bd4da602fmr16830263eju.51.1675617692036; Sun, 05 Feb 2023 09:21:32 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id v26-20020a17090690da00b0086ffe8a00fdsm4292122ejw.84.2023.02.05.09.21.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Feb 2023 09:21:31 -0800 (PST) Message-ID: <4731344a-7406-5cf0-43eb-c77520c2a2c1@yandex.ru> Date: Sun, 5 Feb 2023 19:21:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Content-Language: en-US To: Eli Zaretskii , Stefan Monnier 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> From: Dmitry Gutov In-Reply-To: <83tu00qgmu.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 05/02/2023 17:24, Eli Zaretskii wrote: >> From: Stefan Monnier >> Cc:rahguzar@zohomail.eu,61098@debbugs.gnu.org,dgutov@yandex.ru >> Date: Sun, 05 Feb 2023 10:19:24 -0500 >> >>> I guess I don't understand what show-paren-local-mode does, then. Let >>> me explain my line of reasoning: >>> >>> (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))) >>> (cond >>> ((eq show-paren-mode (default-value 'show-paren-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. >>> (show-paren-mode 1) ; Setup the timer. >>> (setq-default show-paren-mode nil) ; But keep it globally disabled. >>> ) >>> (t ;; Locally disabled only. >>> (show-paren--delete-overlays)))) >>> >>> When I looked at the above function and stepped through it in the OP's >>> scenario, what I saw was that the 2nd condition of 'cond' doesn't >>> fire, because the default-value of show-paren-mode is t nowadays. So >>> I concluded that this code relies on the mode being globally off by >>> default, and attempted to fix the condition that turns the mode on >>> locally even though it is on globally. >> But if the mode is already globally enabled, the (setq-default show-paren-mode nil) >> will definitely not be right: you'd end up disabling it globally (while >> maybe keeping it enabled locally). >> >>> The predicate used by the timer requires either a match of the buffer >>> (which doesn't happen in this case) or that the local value of >>> show-paren-mode is non-nil. Setting the local value non-nil is the >>> job of the mode function, isn't it? >> Yes, but the first branch of the `cond` incorrectly does >> `kill-local-variable` under the assumption that the local value doesn't >> matter if it's the same as the global one, but that's not true here >> because (as a wise man said): >> >> The predicate used by the timer requires either a match of the buffer >> (which doesn't happen in this case) or that the local value of >> show-paren-mode is non-nil. > This answers only half of my questions, but if you and Dmitry think > Dmitry's patch will solve this problem, then Dmitry, please install it > and close this bug. Installed. Some testing revealed a certain issue, which until now was not really a problem: The first time I 'M-x show-paren-local-mode' with show-paren-mode enabled globally, it _turns off_ the mode locally. Which kind of makes sense for a lot of cases, but not when the user's intention is to forcibly enable it. Evaluating (show-paren-local-mode 1) still does the intended thing, though. Just as well as (add-hook 'some-special-mode #'show-paren-local-mode). Toggling 'M-x show-paren-local-mdoe' twice also does that. If we do consider this a problem, a further fix could look like this: diff --git a/lisp/paren.el b/lisp/paren.el index 7ee4e9ae682..f2756db6cd9 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -161,7 +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 . + :variable ( (and show-paren-mode + (buffer-match-p show-paren-predicate (current-buffer))) + . (lambda (val) (setq-local show-paren-mode val))) (cond ((eq show-paren-mode (default-value 'show-paren-mode)) From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 13:29:30 2023 Received: (at 61098) by debbugs.gnu.org; 5 Feb 2023 18:29:30 +0000 Received: from localhost ([127.0.0.1]:46421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOjlZ-00081g-VY for submit@debbugs.gnu.org; Sun, 05 Feb 2023 13:29:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOjlY-00081U-1y for 61098@debbugs.gnu.org; Sun, 05 Feb 2023 13:29:28 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOjlO-00075g-N8; Sun, 05 Feb 2023 13:29:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6dAy/A7eRaulVWsRZoOWyabyy+dHy9cCpRm8CU1cxyA=; b=pNIxOEoIfBK1 XJcLVROFVO6E7E5rmnpz8I7RWsgPePk3TyzW66KvTl1a/4T+z0C8iz1okJPSOg6vSsJgGOCkvJwJ7 pKz7+JOuSNkwVsQkiPh+OBwa7Y9OF+W0lq0MN8Qh4zNCLPlsKnGtJce/jIdFx2SxAmTcpK7DVpoUT Cx8i9blY/1sCRc+k3zmjSWkAplTOPgDO9Qk1ZnDhgLo9AtVJ6a9Mm3Kk8VrtosdMelsSTGQQN04Ld 1OSb8DcKKPbtcXVkNpN7hTow9UsInYOzdeEox4dL0eHC8v+JzPdQpBcBPtj8MKuPmW24wwxn5G4/L gvRrJupCIBCaQrbaTqoh0w==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOjlN-0008Vp-VJ; Sun, 05 Feb 2023 13:29:18 -0500 Date: Sun, 05 Feb 2023 20:29:26 +0200 Message-Id: <83o7q8q83d.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: <4731344a-7406-5cf0-43eb-c77520c2a2c1@yandex.ru> (message from Dmitry Gutov on Sun, 5 Feb 2023 19:21:29 +0200) Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode 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> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, monnier@iro.umontreal.ca, 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sun, 5 Feb 2023 19:21:29 +0200 > Cc: rahguzar@zohomail.eu, 61098@debbugs.gnu.org > From: Dmitry Gutov > > Some testing revealed a certain issue, which until now was not really a > problem: > > The first time I 'M-x show-paren-local-mode' with show-paren-mode > enabled globally, it _turns off_ the mode locally. That's exactly what I asked about in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61098#8 > Which kind of makes sense for a lot of cases, but not when the > user's intention is to forcibly enable it. In a buffer where the mode is turned off, either effectively by virtue of the predicate, or explicitly via the local value of the variable, "M-x show-paren-local-mode" should turn the mode ON, not OFF. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 13:57:21 2023 Received: (at 61098) by debbugs.gnu.org; 5 Feb 2023 18:57:21 +0000 Received: from localhost ([127.0.0.1]:46457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkCX-00054x-AS for submit@debbugs.gnu.org; Sun, 05 Feb 2023 13:57:21 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkCV-00054m-QF for 61098@debbugs.gnu.org; Sun, 05 Feb 2023 13:57:20 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7E7A11000C7; Sun, 5 Feb 2023 13:57:14 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1DDFC100048; Sun, 5 Feb 2023 13:57:13 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675623433; bh=YB2cuIp+VptvskcuGtVhQrfVdwkV9MIteVdJCvZ4f5U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DqPUKEs7AkJAFZdY+dGEH+03cKfCxZ36b+oQ4PQ8aRLPFjcMH0kCMEMSSyioYk6JE uKtkablFB8eawOM/Z/CBByfdoE81SBXx8/dzhUfmGTl4lQh6W95GX+3cxhNaNIV8iI XrysSzYg9JPesRdZTv422O0tYe+OJIpG8Q+zOlzuYiLfOTGtTafv1T9mSkY+GS6bVN pNvSMkJJs2bTbzh6uKpyKTFqY2FzvqEXcXxhOmXd2kJbSC/S7shXSrG0ZwRpFfhrwP /J7OfCFpT36nTgz8exWG3vZ244Owlul7W7eP+svzPK8vQCAQoVNt5thh13NdPETVfH m3d98VydAQxgQ== Received: from ceviche (unknown [104.247.245.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B12A612252E; Sun, 5 Feb 2023 13:57:12 -0500 (EST) From: Stefan Monnier To: Dmitry Gutov Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode In-Reply-To: <4731344a-7406-5cf0-43eb-c77520c2a2c1@yandex.ru> (Dmitry Gutov's message of "Sun, 5 Feb 2023 19:21:29 +0200") Message-ID: 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> Date: Sun, 05 Feb 2023 13:57:06 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.172 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, Eli Zaretskii , 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > + :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. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 14:06:44 2023 Received: (at 61098) by debbugs.gnu.org; 5 Feb 2023 19:06:44 +0000 Received: from localhost ([127.0.0.1]:46466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkLb-0005Ke-Tg for submit@debbugs.gnu.org; Sun, 05 Feb 2023 14:06:44 -0500 Received: from mail-wm1-f41.google.com ([209.85.128.41]:39767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkLZ-0005KQ-Gt for 61098@debbugs.gnu.org; Sun, 05 Feb 2023 14:06:42 -0500 Received: by mail-wm1-f41.google.com with SMTP id hn2-20020a05600ca38200b003dc5cb96d46so9357291wmb.4 for <61098@debbugs.gnu.org>; Sun, 05 Feb 2023 11:06:41 -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=DhqjdQuuEuyOF+P6i+E94fl3V3XGQnTKux56TJUlsqI=; b=n44hBAafXL/7QtppfclQrBvm/NivDsuQ5v6WlZFpvvcImsORTiIHMLgOWP4SbwOE70 E0jyPru0K9hu+ugeoYtvQN7BYvtNXNc8zeR0BtCSwD8gidZ9r50O2bpERGS9QPHlyWA4 yU3tjhauqDemRjWJ6vZN0d4qms2N3PJWoWpX+5dnM/O7VfWKbpg+tw8mjP05ObVtJKDF 4TaedI9E4itnxlBe+Esv/4B/3v2V56SDSOEHQEvrObAJv/LOwNKq95NPUDH9BSFRlp7H VXdqDteOSpSSV8DHamCsIyUjq5EgVv4yjl525JentDogyzEGkhz8nhU5sxDjllXibvEY ITuQ== 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=DhqjdQuuEuyOF+P6i+E94fl3V3XGQnTKux56TJUlsqI=; b=Z3pKmf/Uldm7X9hSjzNKZUpovXlwsJaT8rsf93U28s+E/eaGR5yEQemCsU3Q1H6gyX eti20quNtDWeT8W8AqFpqM3sdn0+CzSrWrUGc79HRIsbrKCuMipC45uDcTqzeAV/U/s7 BsWzreaL3Hc2oc+L1sJLf1TVVO0pkRAngW3p88Kxkv7zn52XfWH1AH+ABIxc8QfFvy2U BlWK3JIB0C7kjKWh5UlHbPZp4zkUJwuhyp/HC65u8EqMLZzKrWmi7s2CQFOVtK0iT1U5 J/6K284T66kNY2oMgt9B8ATpKUEtsoa0zxNk/5DUqg0K13S+d+uHkNee6BQeC/b5mdJ4 c8Mg== X-Gm-Message-State: AO0yUKXT6eWQgFQ4rOGEbqFm76SU2KtwGUGaEQM0It3X7j5X1pI+2/BB Gin7QgMgDNprAu++XdNH7Mw= X-Google-Smtp-Source: AK7set8DmWLvx6j7dMP6++aEpfoAgBFTiDF3ec5An7uXGi/wHpIAnSBC6qdOdk1iyxc5kQ+7ILHdeQ== X-Received: by 2002:a05:600c:3b89:b0:3dc:19d1:3c13 with SMTP id n9-20020a05600c3b8900b003dc19d13c13mr16108728wms.12.1675623995339; Sun, 05 Feb 2023 11:06:35 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id q6-20020a05600c46c600b003dc54344764sm15016592wmo.48.2023.02.05.11.06.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Feb 2023 11:06:34 -0800 (PST) Message-ID: Date: Sun, 5 Feb 2023 21:06:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Content-Language: en-US To: Eli Zaretskii 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> <83o7q8q83d.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <83o7q8q83d.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61098 Cc: rahguzar@zohomail.eu, monnier@iro.umontreal.ca, 61098@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 05/02/2023 20:29, Eli Zaretskii wrote: >> Date: Sun, 5 Feb 2023 19:21:29 +0200 >> Cc:rahguzar@zohomail.eu,61098@debbugs.gnu.org >> From: Dmitry Gutov >> >> Some testing revealed a certain issue, which until now was not really a >> problem: >> >> The first time I 'M-x show-paren-local-mode' with show-paren-mode >> enabled globally, it_turns off_ the mode locally. > That's exactly what I asked about in > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61098#8 > >> Which kind of makes sense for a lot of cases, but not when the >> user's intention is to forcibly enable it. > In a buffer where the mode is turned off, either effectively by virtue > of the predicate, or explicitly via the local value of the variable, > "M-x show-paren-local-mode" should turn the mode ON, not OFF. All right. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 14:09:46 2023 Received: (at 61098-done) by debbugs.gnu.org; 5 Feb 2023 19:09:46 +0000 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 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 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) 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) Message-ID: <4063c95f-041e-4c12-52bc-20e63730b9ae@yandex.ru> Date: Sun, 5 Feb 2023 21:09:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61098: 29.0.60; Confusing behavior of show-paren-mode Content-Language: en-US To: Stefan Monnier 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> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61098-done Cc: rahguzar@zohomail.eu, Eli Zaretskii , 61098-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) 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 From unknown Sat Aug 16 18:16:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 06 Mar 2023 12:24:10 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator