GNU bug report logs - #36006
electric-pair-mode fails to balance in certain cases

Previous Next

Package: emacs;

Reported by: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>

Date: Thu, 30 May 2019 15:12:01 UTC

Severity: minor

Tags: confirmed

Found in version 27.0.50

Full log


Message #28 received at 36006 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <ghe <at> sdf.org>
To: 36006 <at> debbugs.gnu.org
Subject: Re: bug#36006: electric-pair-mode fails to balance in certain
 cases
Date: Thu, 27 Aug 2020 19:08:10 +0000
I don't know if the following information is useful, but on the "<div>" 
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.

----
<div>
(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




This bug report was last modified 3 years and 129 days ago.

Previous Next


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