From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#36006: electric-pair-mode fails to balance in certain cases Date: Thu, 27 Aug 2020 19:08:10 +0000 Message-ID: References: <87woi80yfw.fsf@gmail.com> Reply-To: Gregory Heytings Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3437"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.22 (NEB 394 2020-01-19) To: 36006@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 27 21:39:47 2020 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 1kBNkQ-0000ky-MM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 21:39:46 +0200 Original-Received: from localhost ([::1]:36380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBNkP-0000C0-FQ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 15:39:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBNby-0008K3-1N for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 15:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60796) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBNbx-0001Zd-NB for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 15:31:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kBNbx-0003pH-KJ for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2020 15:31:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87woi80yfw.fsf@gmail.com> Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Aug 2020 19:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36006 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 36006-submit@debbugs.gnu.org id=B36006.159855665214692 (code B ref 36006); Thu, 27 Aug 2020 19:31:01 +0000 Original-Received: (at 36006) by debbugs.gnu.org; 27 Aug 2020 19:30:52 +0000 Original-Received: from localhost ([127.0.0.1]:44109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBNbn-0003ot-UP for submit@debbugs.gnu.org; Thu, 27 Aug 2020 15:30:52 -0400 Original-Received: from mx.sdf.org ([205.166.94.24]:59835) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBNbk-0003oi-6a for 36006@debbugs.gnu.org; Thu, 27 Aug 2020 15:30:50 -0400 Original-Received: from sdf.org (IDENT:smmsp@faeroes.freeshell.org [205.166.94.9]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 07RJUkT6029169 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Thu, 27 Aug 2020 19:30:46 GMT Original-Received: (from ghe@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 07RJ8Ccc026588; Thu, 27 Aug 2020 19:08:12 GMT 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:186565 Archived-At: I don't know if the following information is useful, but on the "
" example given by the OP, the difference between Emacs 26 and 27 is that, in `electric-pair--balance-info', in the expression (eq (char-after pos) (electric-pair--with-uncached-syntax (table) (matching-paren (char-before (scan-sexps (point) 1))))) the second argument fails with "Unbalanced parentheses" in Emacs 27, which means that the whole expression fails, whereas in Emacs 26 both arguments evaluate to 60 and the expression returns t. Because of that `electric-pair--balance-info' returns ((nil . 60) nil . 60) in Emacs 27, instead of ((t . 60) t) in Emacs 26. Because of that `electric-pair-skip-if-helps-balance' and `electric-pair-default-skip-self' return nil in Emacs 27, instead of t in Emacs 26. Because of that `electric-pair-post-self-insert-function', called by `post-self-insert-hook', does not skip the insertion of the right angle bracket character. The following snippet evaluates to "60" on both Emacs 26 and 27, so I don't understand where the "Unbalanced parentheses" error could come from. ----
(progn (electric-pair-mode 1) (html-mode) (let ((table (syntax-table))) (electric-pair--with-uncached-syntax (table) (matching-paren (char-before (scan-sexps 0 1)))))) ---- Gregory