unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gregory Heytings via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 36006@debbugs.gnu.org
Subject: bug#36006: electric-pair-mode fails to balance in certain cases
Date: Thu, 27 Aug 2020 19:08:10 +0000	[thread overview]
Message-ID: <alpine.NEB.2.22.394.2008272047190453.21601@sdf.lonestar.org> (raw)
In-Reply-To: <87woi80yfw.fsf@gmail.com>


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





  parent reply	other threads:[~2020-08-27 19:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 15:11 bug#36006: electric-pair-mode fails to balance in certain cases Dario Gjorgjevski
2019-05-30 17:36 ` npostavs
2019-05-30 21:51   ` Dario Gjorgjevski
2019-06-06 23:39     ` Noam Postavsky
2019-11-22 12:28 ` Dario Gjorgjevski
2020-08-27 19:08 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-08-27 21:38   ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-28  8:00     ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10  7:50       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.NEB.2.22.394.2008272047190453.21601@sdf.lonestar.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=36006@debbugs.gnu.org \
    --cc=ghe@sdf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).