GNU logs - #77876, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77876: 31.0.50; elec-pair --- `electric-pair-inhibit-predicate' ignored for `electric-pair-pairs'
Resent-From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 17 Apr 2025 20:23:05 +0000
Resent-Message-ID: <handler.77876.B.174492137825814 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 77876
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 77876 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.174492137825814
          (code B ref -1); Thu, 17 Apr 2025 20:23:05 +0000
Received: (at submit) by debbugs.gnu.org; 17 Apr 2025 20:22:58 +0000
Received: from localhost ([127.0.0.1]:48577 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u5Vl8-0006he-AV
	for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:22:57 -0400
Received: from lists.gnu.org ([2001:470:142::17]:55348)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <fernandodemorais.jf@HIDDEN>)
 id 1u5Vl3-0006ez-VD
 for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:22:51 -0400
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 <fernandodemorais.jf@HIDDEN>)
 id 1u5Vkt-00073v-OT
 for bug-gnu-emacs@HIDDEN; Thu, 17 Apr 2025 16:22:39 -0400
Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <fernandodemorais.jf@HIDDEN>)
 id 1u5Vkr-00017D-UO
 for bug-gnu-emacs@HIDDEN; Thu, 17 Apr 2025 16:22:39 -0400
Received: by mail-pf1-x42d.google.com with SMTP id
 d2e1a72fcca58-736c277331eso2297065b3a.1
 for <bug-gnu-emacs@HIDDEN>; Thu, 17 Apr 2025 13:22:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1744921354; x=1745526154; darn=gnu.org;
 h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
 :subject:date:message-id:reply-to;
 bh=sM+MlSrd/NLem4QpfXnNJGKu8Pn2ZXm7zZ3tF7Pnx4E=;
 b=jeltUcidbxOPPsn+YSrcwCyWmH/29l0rlAN0jTO2zam5f42aUGDnHQdXooGNN+tlrw
 /8bwBcMwfFyPzaxMz//xT2e/2fai4b/Aak7XPMe9up2LgkG75gX5OFHHor7u7TSQMo9p
 X8zCbr3rGGntKRH306VG6IK1/P1OdlM9AK5znd8wETJJMIN5cFDOvRvI2bUjFZv/2e+U
 IWvuu8CROHmaZ5KO19pMQGjGbIvH2aKcSV4k1NQV2BFwtEc3Zy67MXFjWvA9jrizpwgG
 I+BovitSn/yoRNgsbvVYMkMyhenGMX58qkWeT8j7l5YR3GZsEbT+g7qUlZcKa2E/6YBe
 ta2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1744921354; x=1745526154;
 h=mime-version:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=sM+MlSrd/NLem4QpfXnNJGKu8Pn2ZXm7zZ3tF7Pnx4E=;
 b=miDKX1zHwGYxvLZiQPHc7o76oa52yEomAA2iP9DomoP0vLopCAkuA9JHxEFre1vSl4
 7yJAANelyHrZ4h1G0T65akHE7bpc2ZhYtQL4pqcw7a5uVwmnoQZPr5f0LxBKH3c9NEHk
 2d15b1WQ12QNCZs7PgXukWo0D2BtXopRhn5UnB0KlKCJ7sC8/S8r/D/TmWvQA8nmZAts
 BjtD/LuH3ZYQBNbJQ8VPYGYEX3xkPMZt8+w/dpYjZxWuEylBgPdzrPEbpl4O1UOfhw/v
 c9J0J0GYrr80yTkiIqQ59o11nIPokJBDmZ6Hbc6EXoZ714INWaP6lzgfl0SlIfTxVWyJ
 oFvA==
X-Gm-Message-State: AOJu0YxgeeUffi428TPu3QtHr0nDl5QQa71KtBzSWz4bUktLp54f2q5I
 sTYB5DRdlQcURkTcuNOq4uKfVHNrnv6CGLp+hscFnrfE9qh7VSRCIL7LQw==
X-Gm-Gg: ASbGncvE/6zmy6kpwDqkCMm95tgqC17MRJl5SK18Kf+KJfbXzjS24PyGhk0v/aKG/lP
 KBepLeX4MOTapSigp8zZA8CoWWAf70gYX4lym8pgVDWA4xiThz1VyxVhnQNzndBGtIQo+v2REOA
 qjb9Xjri9S/BfxU/vvfbeL8yH2B77nNIADKZr1sy4cukEOEcel8AfATRRzet9VAnbN1IQaDTQ6S
 mUJda6m4jQnemIGKQRRRBkg5vzCRsBYlbfFw8C24/S1RGd+Xz6HMxGkp5uiE+/EJp+QoG9Yl91u
 CFRvHIR1NbvXGemJuMosDB9fY1TdBYCqbh4msvieaE/f
X-Google-Smtp-Source: AGHT+IEjZlYCOkRP4V+XWQaz0YggK5bDDH8QBiTDfsW3HExelR/dJRRhi5MltG5inxN9VsQ5FCkHZA==
X-Received: by 2002:a05:6a00:3995:b0:736:476b:fccc with SMTP id
 d2e1a72fcca58-73dc1b5a9fcmr195792b3a.8.1744921353737; 
 Thu, 17 Apr 2025 13:22:33 -0700 (PDT)
Received: from sekai ([187.64.57.179]) by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-73dbfa59f87sm293273b3a.91.2025.04.17.13.22.31
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 17 Apr 2025 13:22:32 -0700 (PDT)
From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Date: Thu, 17 Apr 2025 17:14:46 -0300
Message-ID: <87tt6meea1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::42d;
 envelope-from=fernandodemorais.jf@HIDDEN; helo=mail-pf1-x42d.google.com
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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain
Content-Disposition: inline

*Notice:* I don't believe this is a bug, but I would like to bring up a
discussion about the issue.

To illustrate the matter, using `emacs -Q', please evaluate the
following snippet:

#+begin_src emacs-lisp  
  (progn
    (elisp-enable-lexical-binding 'interactive)

    (defun org-electric-pair-inhibit (char)
      (let ((pairs '(?* ?/ ?_ ?= ?~ ?+)))
        (or (when (member char pairs)
  	    (not (region-active-p)))
  	  (electric-pair-default-inhibit char))))

    (autoload #'setq-mode-local "mode-local")
    (setopt electric-pair-mode t)
    (setq-mode-local org-mode
  		   electric-pair-pairs (append
  					electric-pair-pairs
  					'((?* . ?*) (?/ . ?/)
  					  (?_ . ?_) (?= . ?=)
  					  (?~ . ?~) (?+ . ?+)))
  		   electric-pair-inhibit-predicate #'org-electric-pair-inhibit)
    (find-file "temp.org"))
#+end_src

Results in:

- The `org-electric-pair-inhibit' function is ignored, and the
  characters that should only be inserted in pairs when the region is
  active are inserted in pairs regardless.

After a bit of investigation, I found that characters listed in
`electric-pair-pairs' are always inserted in pairs unconditionally.  The
function defined in `electric-pair-inhibit-predicate' is called only for
the pairs defined in the syntax table of the corresponding major mode.

Although I believe this was a design decision, in my view, the
`electric-pair-inhibit-predicate' function should also apply to
characters in the `electric-pair-pairs' list.

I'm not sure about the implications for other use cases, but a little
change made to the `electric-pair-post-self-insert-function' solves the
issue (diff attached).

Do you think a change like this could be considered?  Thanks in advance.

-- 
Regards,
Fernando de Morais.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=elec-pair.patch

diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index aa2577300fd..97aeca3f3b3 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -593,11 +593,10 @@ electric-pair-post-self-insert-function
         ;; Insert matching pair.
         ((and (memq syntax '(?\( ?\" ?\$))
               (not overwrite-mode)
-              (or unconditional
-                  (not (electric-pair--save-literal-point-excursion
-                         (goto-char pos)
-                         (funcall electric-pair-inhibit-predicate
-                                  last-command-event)))))
+              (not (electric-pair--save-literal-point-excursion
+                    (goto-char pos)
+                    (funcall electric-pair-inhibit-predicate
+                             last-command-event))))
          (save-excursion (electric-pair--insert pair num))))))))
 
 (defun electric-pair-open-newline-between-pairs-psif ()

--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>
Subject: bug#77876: Acknowledgement (31.0.50; elec-pair ---
 `electric-pair-inhibit-predicate' ignored for `electric-pair-pairs')
Message-ID: <handler.77876.B.174492137825814.ack <at> debbugs.gnu.org>
References: <87tt6meea1.fsf@HIDDEN>
X-Gnu-PR-Message: ack 77876
X-Gnu-PR-Package: emacs
Reply-To: 77876 <at> debbugs.gnu.org
Date: Thu, 17 Apr 2025 20:23:06 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 77876 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
77876: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77876
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77876: 31.0.50; elec-pair --- `electric-pair-inhibit-predicate' ignored for `electric-pair-pairs'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 12:29:02 +0000
Resent-Message-ID: <handler.77876.B77876.174567049030458 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77876
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Fernando de Morais <fernandodemorais.jf@HIDDEN>, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Cc: 77876 <at> debbugs.gnu.org
Received: via spool by 77876-submit <at> debbugs.gnu.org id=B77876.174567049030458
          (code B ref 77876); Sat, 26 Apr 2025 12:29:02 +0000
Received: (at 77876) by debbugs.gnu.org; 26 Apr 2025 12:28:10 +0000
Received: from localhost ([127.0.0.1]:59151 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8edd-0007v8-IG
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 08:28:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45740)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u8eda-0007uQ-24
 for 77876 <at> debbugs.gnu.org; Sat, 26 Apr 2025 08:28:06 -0400
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 <eliz@HIDDEN>)
 id 1u8edU-0006fA-HV; Sat, 26 Apr 2025 08:28:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=WJKL9fSl9Dj0soz9zOIPgVaROFmuciIIEVE+FFG1gy0=; b=bD7/e2HGjG+qbei0nwG5
 khnvYimPlzIDRZJ9u+Ao0DEl+qODMxAzpu5tsXZugQ4BUoQUUYscdb2xWIcjz/aqUBrcT9AKLXria
 MAojeX9VxZEF1qjXlKgJD9YWTAd0KeEhobirCEEzlVoodiKzSRI7Zrl5pX+NFVcxhxY5YxeKLWBGs
 VTG0ugH1WnrwcZXVB41PyFMSvdUylAwW5jXOFpGubDpwiAzbwSuVBeRkfBTtJGZdeODFgIKKQCsJI
 uLEmzMyvZmC1tX8GqdgjYT+xgbw3KCiIymfFbrni5NUT5k2h4YRAZmao7D+uucKKHGmqfxliRlvEB
 8r7wwL3xTg9JSg==;
Date: Sat, 26 Apr 2025 15:27:57 +0300
Message-Id: <86wmb7t8du.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87tt6meea1.fsf@HIDDEN> (message from Fernando de Morais on
 Thu, 17 Apr 2025 17:14:46 -0300)
References: <87tt6meea1.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> Date: Thu, 17 Apr 2025 17:14:46 -0300
> 
> *Notice:* I don't believe this is a bug, but I would like to bring up a
> discussion about the issue.
> 
> To illustrate the matter, using `emacs -Q', please evaluate the
> following snippet:
> 
> #+begin_src emacs-lisp  
>   (progn
>     (elisp-enable-lexical-binding 'interactive)
> 
>     (defun org-electric-pair-inhibit (char)
>       (let ((pairs '(?* ?/ ?_ ?= ?~ ?+)))
>         (or (when (member char pairs)
>   	    (not (region-active-p)))
>   	  (electric-pair-default-inhibit char))))
> 
>     (autoload #'setq-mode-local "mode-local")
>     (setopt electric-pair-mode t)
>     (setq-mode-local org-mode
>   		   electric-pair-pairs (append
>   					electric-pair-pairs
>   					'((?* . ?*) (?/ . ?/)
>   					  (?_ . ?_) (?= . ?=)
>   					  (?~ . ?~) (?+ . ?+)))
>   		   electric-pair-inhibit-predicate #'org-electric-pair-inhibit)
>     (find-file "temp.org"))
> #+end_src
> 
> Results in:
> 
> - The `org-electric-pair-inhibit' function is ignored, and the
>   characters that should only be inserted in pairs when the region is
>   active are inserted in pairs regardless.
> 
> After a bit of investigation, I found that characters listed in
> `electric-pair-pairs' are always inserted in pairs unconditionally.  The
> function defined in `electric-pair-inhibit-predicate' is called only for
> the pairs defined in the syntax table of the corresponding major mode.
> 
> Although I believe this was a design decision, in my view, the
> `electric-pair-inhibit-predicate' function should also apply to
> characters in the `electric-pair-pairs' list.
> 
> I'm not sure about the implications for other use cases, but a little
> change made to the `electric-pair-post-self-insert-function' solves the
> issue (diff attached).
> 
> Do you think a change like this could be considered?  Thanks in advance.
> 
> -- 
> Regards,
> Fernando de Morais.
> 
> diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
> index aa2577300fd..97aeca3f3b3 100644
> --- a/lisp/elec-pair.el
> +++ b/lisp/elec-pair.el
> @@ -593,11 +593,10 @@ electric-pair-post-self-insert-function
>          ;; Insert matching pair.
>          ((and (memq syntax '(?\( ?\" ?\$))
>                (not overwrite-mode)
> -              (or unconditional
> -                  (not (electric-pair--save-literal-point-excursion
> -                         (goto-char pos)
> -                         (funcall electric-pair-inhibit-predicate
> -                                  last-command-event)))))
> +              (not (electric-pair--save-literal-point-excursion
> +                    (goto-char pos)
> +                    (funcall electric-pair-inhibit-predicate
> +                             last-command-event))))
>           (save-excursion (electric-pair--insert pair num))))))))
>  
>  (defun electric-pair-open-newline-between-pairs-psif ()

João, any comments or suggestions?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77876: 31.0.50; elec-pair --- `electric-pair-inhibit-predicate' ignored for `electric-pair-pairs'
Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 26 Apr 2025 14:31:01 +0000
Resent-Message-ID: <handler.77876.B77876.174567781722153 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77876
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: Fernando de Morais <fernandodemorais.jf@HIDDEN>, 77876 <at> debbugs.gnu.org
Received: via spool by 77876-submit <at> debbugs.gnu.org id=B77876.174567781722153
          (code B ref 77876); Sat, 26 Apr 2025 14:31:01 +0000
Received: (at 77876) by debbugs.gnu.org; 26 Apr 2025 14:30:17 +0000
Received: from localhost ([127.0.0.1]:33847 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u8gXo-0005kn-Mk
	for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 10:30:17 -0400
Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]:43131)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>)
 id 1u8gXl-0005ea-LG
 for 77876 <at> debbugs.gnu.org; Sat, 26 Apr 2025 10:30:14 -0400
Received: by mail-oo1-xc2c.google.com with SMTP id
 006d021491bc7-601ad30bc0cso3065997eaf.0
 for <77876 <at> debbugs.gnu.org>; Sat, 26 Apr 2025 07:30:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1745677807; x=1746282607; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=z7XQWhuvp39rZKUX7nTiNCPbMUbqivIj84gkWHdSd1E=;
 b=FJtmyrpUEv6iHeDZQFsFhx+O3fQHpkJiDNXQ4iAOvvFjoCH1y5jlqzYfY9cmMjDDeZ
 M8VMkFb4CdbqwUxTlquN6SwBcCmIyuU76rCaQab9sBxIYHexjN9QQNYSn1dI486E0Y5z
 W0FPYqMK/r/MZy51bRlIm+HEOzVdc04PyPadm3BMmk7GKlXcxKbGmjDp9TCGs1AilhaW
 SmvfWRpmWwSYBWSE4xVWbxHqJA7Zma2ekSorEoZR8Oo5bDZJ/1mRb+w30JID0CSm94tB
 TrydkooA1Xg7u0pZ1FsDEUdwv11JNl9xXvao0RKwSLO3XGJAASmkhyW45x6QwFBzit+L
 20Jg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1745677807; x=1746282607;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=z7XQWhuvp39rZKUX7nTiNCPbMUbqivIj84gkWHdSd1E=;
 b=PnVa5vg9NGFDBa6AB2gOQ8dHshzBqdapKO/LZSpsPHnbOufsxRiOGl2BbaeZJB6/Dm
 Ze4iFEDHKE461C1GVX6JireLvz7xgYQNf7rs8GIfjHTNCaf4/CPQFZxIz3xCwoovZlMm
 jq6PPghvLRq/wzRqLuSn/yGa8/Cck/HWCC6dBLoL8cxYWf26pQurcCJd+mTKljbKFp8x
 3zjH7ZgxtvQsHJajcyg3u5vxHsKApSqAKS/b+aK91NouqnJd2ON98Me+/3cUWEVUeTwq
 NrQ2kJJo9ZzLK+TA/3YYNY+yJjgYPnOA+fYPVHHbtMxjuhqQY9H9YBCVhmRKgVO7Q6Cn
 vJTg==
X-Forwarded-Encrypted: i=1;
 AJvYcCUKzWHApWJEmI9CuCPrnol7yFYWVb5hYzsAd2qbxReHqICacdMcwxouKraLztxbL/fTb+BKWg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwIy8S3nCzVpfgzWUqPpJWEKeX/Ms6FhI5CxITJ2uQQ7YboFeqb
 NdMOQORhDDZ4QUoEupI43Wflq2X+F1X3mwSfqTFsJQSpKekrfX+npjVnXPMvJ5ros+9pMd6tjP4
 97eYX6Kzhp56e9KP1fYChgOZHpZw=
X-Gm-Gg: ASbGncsML9ktY3k3wyhe4PT26RNAakKf4ZT5Qwj7UGPrSsOgEYsxVqyUJXtZkkYY4Uk
 RCwy2j5dVnMoh79/wV4CSty2md7Yq7PImlpciheyCw/GN/ragvfHqlsb/R+TBuFRPZ/8CEbyiJJ
 C3SyeBi6p4OA+WvupwYGcXvw==
X-Google-Smtp-Source: AGHT+IHoX5avaEdDrfTa6Q9VM0829JAoEnLCSEMAtDS1lSJrk1S/Ct+DaP5oTSu1gOxT8yk5j6ehMOvj0pai8R2ZXfY=
X-Received: by 2002:a05:6870:71cb:b0:2b7:5726:c931 with SMTP id
 586e51a60fabf-2d9a3264f44mr3281502fac.5.1745677807359; Sat, 26 Apr 2025
 07:30:07 -0700 (PDT)
MIME-Version: 1.0
References: <87tt6meea1.fsf@HIDDEN> <86wmb7t8du.fsf@HIDDEN>
In-Reply-To: <86wmb7t8du.fsf@HIDDEN>
From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Date: Sat, 26 Apr 2025 15:30:35 +0100
X-Gm-Features: ATxdqUFm6XvN9tOjXXlz3KcuUt38yJDtYSg-sJx-SFLhK27nEuIvmz-350H7hcY
Message-ID: <CALDnm53R4y1uiGYumUm7fcs-+xkw_9sRMDj=y6ziPzb00JVOow@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, Apr 26, 2025 at 1:28=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wrote:
>
> > From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> > Date: Thu, 17 Apr 2025 17:14:46 -0300
> >
> > *Notice:* I don't believe this is a bug, but I would like to bring up a
> > discussion about the issue.
> >
> > To illustrate the matter, using `emacs -Q', please evaluate the
> > following snippet:
> >
> > #+begin_src emacs-lisp
> >   (progn
> >     (elisp-enable-lexical-binding 'interactive)
> >
> >     (defun org-electric-pair-inhibit (char)
> >       (let ((pairs '(?* ?/ ?_ ?=3D ?~ ?+)))
> >         (or (when (member char pairs)
> >           (not (region-active-p)))
> >         (electric-pair-default-inhibit char))))
> >
> >     (autoload #'setq-mode-local "mode-local")
> >     (setopt electric-pair-mode t)
> >     (setq-mode-local org-mode
> >                  electric-pair-pairs (append
> >                                       electric-pair-pairs
> >                                       '((?* . ?*) (?/ . ?/)
> >                                         (?_ . ?_) (?=3D . ?=3D)
> >                                         (?~ . ?~) (?+ . ?+)))
> >                  electric-pair-inhibit-predicate #'org-electric-pair-in=
hibit)
> >     (find-file "temp.org"))
> > #+end_src
> >
> > Results in:
> >
> > - The `org-electric-pair-inhibit' function is ignored, and the
> >   characters that should only be inserted in pairs when the region is
> >   active are inserted in pairs regardless.
> >
> > After a bit of investigation, I found that characters listed in
> > `electric-pair-pairs' are always inserted in pairs unconditionally.  Th=
e
> > function defined in `electric-pair-inhibit-predicate' is called only fo=
r
> > the pairs defined in the syntax table of the corresponding major mode.
> >
> > Although I believe this was a design decision, in my view, the
> > `electric-pair-inhibit-predicate' function should also apply to
> > characters in the `electric-pair-pairs' list.
> >
> > I'm not sure about the implications for other use cases, but a little
> > change made to the `electric-pair-post-self-insert-function' solves the
> > issue (diff attached).
> >
> > Do you think a change like this could be considered?  Thanks in advance=
.
> >
> > --
> > Regards,
> > Fernando de Morais.
> >
> > diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
> > index aa2577300fd..97aeca3f3b3 100644
> > --- a/lisp/elec-pair.el
> > +++ b/lisp/elec-pair.el
> > @@ -593,11 +593,10 @@ electric-pair-post-self-insert-function
> >          ;; Insert matching pair.
> >          ((and (memq syntax '(?\( ?\" ?\$))
> >                (not overwrite-mode)
> > -              (or unconditional
> > -                  (not (electric-pair--save-literal-point-excursion
> > -                         (goto-char pos)
> > -                         (funcall electric-pair-inhibit-predicate
> > -                                  last-command-event)))))
> > +              (not (electric-pair--save-literal-point-excursion
> > +                    (goto-char pos)
> > +                    (funcall electric-pair-inhibit-predicate
> > +                             last-command-event))))
> >           (save-excursion (electric-pair--insert pair num))))))))
> >
> >  (defun electric-pair-open-newline-between-pairs-psif ()
>
> Jo=C3=A3o, any comments or suggestions?

I don't know, much of this is out of my mental cache.  But I would
start by checking
if it passes the unit tests for elec-pair.el (hoping that they haven't
been disabled
as as has happened in the past).  The tests have a pretty important say on
what the library is supposed to do, as they were carefully crafted from a g=
ood
number of edge cases and bug reports.

Jo=C3=A3o




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77876: 31.0.50; elec-pair --- `electric-pair-inhibit-predicate' ignored for `electric-pair-pairs'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 10 May 2025 09:33:02 +0000
Resent-Message-ID: <handler.77876.B77876.174686957721032 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77876
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: fernandodemorais.jf@HIDDEN, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Cc: 77876 <at> debbugs.gnu.org
Received: via spool by 77876-submit <at> debbugs.gnu.org id=B77876.174686957721032
          (code B ref 77876); Sat, 10 May 2025 09:33:02 +0000
Received: (at 77876) by debbugs.gnu.org; 10 May 2025 09:32:57 +0000
Received: from localhost ([127.0.0.1]:43928 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uDgZk-0005T3-Kx
	for submit <at> debbugs.gnu.org; Sat, 10 May 2025 05:32:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54802)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uDgZi-0005Sn-5t
 for 77876 <at> debbugs.gnu.org; Sat, 10 May 2025 05:32:54 -0400
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 <eliz@HIDDEN>)
 id 1uDgZc-0001di-MP; Sat, 10 May 2025 05:32:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=ABr1H/jGApOSb8uEMv0J+/OHV8tZYQn0gwlrrZtpWYE=; b=hANaLy5qNYoOJ0r03A9t
 ksqBxgrBhtGZmA7RrCBGHUA679XuUe+LFkOA2eP3DvGWbfIQknXwkI2HEljEnQ5Zdpw4qvDMKnxOb
 B7UGpnrGR2tjlVu75cHIX1OrWFJ6AHEP4j/4jiE7AolGv2ou7jVHMcQ5PsZp2jucLaWhlaGcsZII2
 CkHNVHvVWiMv0hlhXkVyzGJBIDGvUgNNVvpwcsj8euIzqSHSiN59VcaIvDQ2iFl5aqR7SThRG1xPF
 8eOk+hsQpR8nYcOZw/oPnqPqR9PcxT7+NCrjktm1ameRJkxZCBpL+e250j99Xi1YF24sJAyYZZ1hz
 0f5Ulm/PyL2rrQ==;
Date: Sat, 10 May 2025 12:32:46 +0300
Message-Id: <864ixsbykh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <CALDnm53R4y1uiGYumUm7fcs-+xkw_9sRMDj=y6ziPzb00JVOow@HIDDEN>
 (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Sat, 26 Apr 2025 15:30:35
 +0100)
References: <87tt6meea1.fsf@HIDDEN> <86wmb7t8du.fsf@HIDDEN>
 <CALDnm53R4y1uiGYumUm7fcs-+xkw_9sRMDj=y6ziPzb00JVOow@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping! Any progress with this issue?

> From: João Távora <joaotavora@HIDDEN>
> Date: Sat, 26 Apr 2025 15:30:35 +0100
> Cc: Fernando de Morais <fernandodemorais.jf@HIDDEN>, 77876 <at> debbugs.gnu.org
> 
> On Sat, Apr 26, 2025 at 1:28 PM Eli Zaretskii <eliz@HIDDEN> wrote:
> >
> > > From: Fernando de Morais <fernandodemorais.jf@HIDDEN>
> > > Date: Thu, 17 Apr 2025 17:14:46 -0300
> > >
> > > *Notice:* I don't believe this is a bug, but I would like to bring up a
> > > discussion about the issue.
> > >
> > > To illustrate the matter, using `emacs -Q', please evaluate the
> > > following snippet:
> > >
> > > #+begin_src emacs-lisp
> > >   (progn
> > >     (elisp-enable-lexical-binding 'interactive)
> > >
> > >     (defun org-electric-pair-inhibit (char)
> > >       (let ((pairs '(?* ?/ ?_ ?= ?~ ?+)))
> > >         (or (when (member char pairs)
> > >           (not (region-active-p)))
> > >         (electric-pair-default-inhibit char))))
> > >
> > >     (autoload #'setq-mode-local "mode-local")
> > >     (setopt electric-pair-mode t)
> > >     (setq-mode-local org-mode
> > >                  electric-pair-pairs (append
> > >                                       electric-pair-pairs
> > >                                       '((?* . ?*) (?/ . ?/)
> > >                                         (?_ . ?_) (?= . ?=)
> > >                                         (?~ . ?~) (?+ . ?+)))
> > >                  electric-pair-inhibit-predicate #'org-electric-pair-inhibit)
> > >     (find-file "temp.org"))
> > > #+end_src
> > >
> > > Results in:
> > >
> > > - The `org-electric-pair-inhibit' function is ignored, and the
> > >   characters that should only be inserted in pairs when the region is
> > >   active are inserted in pairs regardless.
> > >
> > > After a bit of investigation, I found that characters listed in
> > > `electric-pair-pairs' are always inserted in pairs unconditionally.  The
> > > function defined in `electric-pair-inhibit-predicate' is called only for
> > > the pairs defined in the syntax table of the corresponding major mode.
> > >
> > > Although I believe this was a design decision, in my view, the
> > > `electric-pair-inhibit-predicate' function should also apply to
> > > characters in the `electric-pair-pairs' list.
> > >
> > > I'm not sure about the implications for other use cases, but a little
> > > change made to the `electric-pair-post-self-insert-function' solves the
> > > issue (diff attached).
> > >
> > > Do you think a change like this could be considered?  Thanks in advance.
> > >
> > > --
> > > Regards,
> > > Fernando de Morais.
> > >
> > > diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
> > > index aa2577300fd..97aeca3f3b3 100644
> > > --- a/lisp/elec-pair.el
> > > +++ b/lisp/elec-pair.el
> > > @@ -593,11 +593,10 @@ electric-pair-post-self-insert-function
> > >          ;; Insert matching pair.
> > >          ((and (memq syntax '(?\( ?\" ?\$))
> > >                (not overwrite-mode)
> > > -              (or unconditional
> > > -                  (not (electric-pair--save-literal-point-excursion
> > > -                         (goto-char pos)
> > > -                         (funcall electric-pair-inhibit-predicate
> > > -                                  last-command-event)))))
> > > +              (not (electric-pair--save-literal-point-excursion
> > > +                    (goto-char pos)
> > > +                    (funcall electric-pair-inhibit-predicate
> > > +                             last-command-event))))
> > >           (save-excursion (electric-pair--insert pair num))))))))
> > >
> > >  (defun electric-pair-open-newline-between-pairs-psif ()
> >
> > João, any comments or suggestions?
> 
> I don't know, much of this is out of my mental cache.  But I would
> start by checking
> if it passes the unit tests for elec-pair.el (hoping that they haven't
> been disabled
> as as has happened in the past).  The tests have a pretty important say on
> what the library is supposed to do, as they were carefully crafted from a good
> number of edge cases and bug reports.
> 
> João
> 





Last modified: Sat, 10 May 2025 09:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.