From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53661: 29.0.50; electric-pair-mode not respecting electric-pair-inhibit-predicate. Date: Mon, 31 Jan 2022 18:29:31 +0100 Message-ID: <20220131172931.fwqtax34h6a5v4o4@Ergus> References: <87fsp4eygw.fsf.ref@aol.com> <87fsp4eygw.fsf@aol.com> <83iltz97s8.fsf@gnu.org> Reply-To: Ergus Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33817"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53661@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 31 18:38:45 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEadW-0008dQ-UU for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Jan 2022 18:38:43 +0100 Original-Received: from localhost ([::1]:40236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEadV-0001gg-IX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Jan 2022 12:38:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEaWC-0008Bs-Le for bug-gnu-emacs@gnu.org; Mon, 31 Jan 2022 12:31:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nEaW6-0003C5-K6 for bug-gnu-emacs@gnu.org; Mon, 31 Jan 2022 12:31:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nEaW6-0008EG-Ch for bug-gnu-emacs@gnu.org; Mon, 31 Jan 2022 12:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Jan 2022 17:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53661 X-GNU-PR-Package: emacs Original-Received: via spool by 53661-submit@debbugs.gnu.org id=B53661.164365022329081 (code B ref 53661); Mon, 31 Jan 2022 17:31:02 +0000 Original-Received: (at 53661) by debbugs.gnu.org; 31 Jan 2022 17:30:23 +0000 Original-Received: from localhost ([127.0.0.1]:40637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEaVS-0007Ya-SO for submit@debbugs.gnu.org; Mon, 31 Jan 2022 12:30:23 -0500 Original-Received: from sonic301-3.consmr.mail.bf2.yahoo.com ([74.6.129.42]:43865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEaVQ-0007QZ-Mv for 53661@debbugs.gnu.org; Mon, 31 Jan 2022 12:30:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1643650213; bh=1kcR1ZolGagsaAznVDpWSh/CBBQbvqwXpSA59RIqEwQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=tiiR7SljKWkjvCw7TSHu5gEldY44cWnRYAzbTrG9L2f4wdjzj7QepPXinQjdvv8mlXhmywVQawIGqvDpWKTUFRZx9vkUXMc6f0yViBjimfDtAgSY/HMGTk5BS/Eol6f9DtqIRG8cJC3g73KPRl1qfMwHjzgWHUfrTJwvEvs/yZDGURkUMOJ/D4QFczANCmcbj2k02EA6ipE9i1Fac0RDXLEZgNDGJDJe+eIFZpB588Y/xgqSAvNZaRVa2KFq0hjM5arP1naNuBut5eoYji4oKwYGDsnlEKB3rFKE9//jK/F/wkcQBkQGIoNHurcja1zklMdPt1JaeJnKGGTbi28H6Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1643650213; bh=otbE65iNkG5NtkcXNaOa9RfHBMg5OzWBbE+39kaZu5e=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=tkG++oxxWfoKyh5lp8MI8xCprVZo3H5wljypSTfXVGewbLMeuYc/4DFJpy/w0EpqGXHiaU3scpUjll+Jgf+ircbnVne42oFpQcmAfpCWoC4119v4QyquSoWJCmFhx82WCw+BYZXSMVR8Vb+VyGkdHN3SAV8jHehnf8NhJOU++ZCLsV/97NXkkmDIY8W+XivVTgeV2DlEf6ns1lSZg8W+1MOIA6zC2/3hthbahgh073rt7ZmwMyfnnGDd9kd0OoBwm1LNpO2iIJaRPiSQLZKoTUL/f80ltqmrsXFIxMpskLB4IQV+zdRlPrn0mM/BVQIsCDpmphXgK+RDuAQUhoCrbw== X-YMail-OSG: cFVPGA0VM1np58YtKSC0hO0SMicW2EAV8yZkWYCJhAsbFRscfccHWRGF8aEH.xU GvnsO93el7fjOwPboGfX4zkYGV4NNNg98FS_I09M7yzq4lioBaZuZXIp_wsn34uaoYrlo._v34ZE Wk7_MjEJJN6y.lPPVzqLC4tegeKmEtkyb5a8wThCN8TI5DTqngB1LPaIROih96a9da_TBqvCP_yE nJFVH7W_4Zlo_dkLSkdEqGBqPRp_UTE_rt0XjdSSwS4VjJA2lWnptbVjYn54aZLstqhhW7RX2Iny u14giASkdF4KE9AnV7SBZ3vePOZCqMFn9JByxmpGP7sIConkVzFj6Brzh14MpDh8YZKUVCjHitSM Du1gtXqzn9VBJgWhNuSXgNUUG9baEopFeYlkQEjhtwDAsCamvEYdmew_YVIqgdG3rffRx6oc39kg j614AM6pmMDU82XBelLc6HHZNz720IZP5cluSLv1KAwpEM.NP0UnuQTJce_VZjOo07YC1KyTZnwU cU33cqmTDRtK4BjUDRtvIDZfTqlxgN4Vj5m_YTw_n8vv_HKwWwPt5qi_HCUqk.h6X_ruiCbhxYSV Snm8hN9TXiCse5wvqTXjqjT2QZYTjsDLG5L0ANSI5N.3weuFOK_RRSnfLkw7.xllYT2W7DNmIn2. koN3_JcLXfYzCYa.Za15VbRPk68FnU0nJjdFRcg7t4mcPCbdFUwzYZHjWfwuKJkYuW9dydjAIDxd ABkZGbRRc0VptAnUfwzdD5Psi85Q12yPJtHtqG1u9s8xqUZeLtxMdPgatQA8D4b79wvvZDN74r2p VwyTE96CKOSJrM.HcmlZr6mcZmvyA12b2.2FDCSIBD X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Mon, 31 Jan 2022 17:30:13 +0000 Original-Received: by kubenode503.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID b26f4ba8d947066bcd1d00d511d6bdac; Mon, 31 Jan 2022 17:30:11 +0000 (UTC) Content-Disposition: inline In-Reply-To: <83iltz97s8.fsf@gnu.org> X-Mailer: WebService/1.1.19615 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:225704 Archived-At: On Mon, Jan 31, 2022 at 06:41:59PM +0200, Eli Zaretskii wrote: >> Date: Mon, 31 Jan 2022 16:06:39 +0100 >> From: Ergus via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> When adding new pairs to `electric-pair-pairs' the >> `electric-pair-inhibit-predicate' variable is not respected. >> >> Looking at the elect-pair file it seems to be related with: >> `electric-pair-post-self-insert-function' that hard-coded the condition >> to call `electric-pair-inhibit-predicate' with: >> >> (memq syntax '(?\( ?\" ?\$)) >> >> So, for other pairs, the function electric-pair-inhibit-predicate is >> never called. > >The above condition looks at the _syntax_ of a character, not at the >character itself. So what do you find "hard-coded" there,and what >kind of pairs of characters did you want to add that don't have one of >those syntaxes? Hi Eli: I wanted to add "<>" so I added to my init: (add-to-list 'electric-pair-pairs '(?< . ?>)) But I wanted to restrict the electric-insertion only to when the region was active; else using `<` to compare may be wrong; so I thought that implementing my own `electric-pair-inhibit-predicate' in a simple way like more or less: (if (and (eq char ?<) (not (use-region-p))) t (electric-pair-default-inhibit)) could make the trick, but this doesn't work as I thought. I don't know if there is a better way to go around this.