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


View this message in rfc822 format

From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 36006 <at> debbugs.gnu.org
Subject: bug#36006: electric-pair-mode fails to balance in certain cases
Date: Fri, 22 Nov 2019 13:28:48 +0100
[Message part 1 (text/plain, inline)]
(It’s been so long since I last looked into the bug...)

> It doesn't happen in emacs-26, which has the same
> electric-pair--with-uncached-syntax call, so it's not just that alone.
> I suspect this could be related to the recent changes to mark ">"
> outside of tags with punctuation syntax (technically, <foo>a > b</foo>
> is valid, only "<" needs to be escaped as &lt;).

You’re right.  The problem is that electric-pair--with-uncached-syntax
let-binds syntax-propertize-function to ignore, causing the syntax of
">" to not be updated.

Applying the attached patch fixes the issue.  However, in what cases
would we want syntax-propertize-function to be let-bound to ignore?

Best regards,
Dario

[0001-Leave-syntax-propertize-function-unchanged.patch (text/x-diff, inline)]
From 6de30e0cdc97475b3aac2a35bec1fcf1ac0af84f Mon Sep 17 00:00:00 2001
From: Dario Gjorgjevski <dario.gjorgjevski+git <at> gmail.com>
Date: Fri, 22 Nov 2019 13:19:39 +0100
Subject: [PATCH] Leave syntax-propertize-function unchanged

* lisp/elec-pair.el (electric-pair--with-uncached-syntax): Do not
let-bind syntax-propertize-function.
---
 lisp/elec-pair.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index f3cbee7048..6e528b2dfd 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -246,8 +246,7 @@ electric-pair--with-uncached-syntax
 cache is flushed from position START, defaulting to point."
   (declare (debug ((form &optional form) body)) (indent 1))
   (let ((start-var (make-symbol "start")))
-    `(let ((syntax-propertize-function #'ignore)
-           (,start-var ,(or start '(point))))
+    `(let ((,start-var ,(or start '(point))))
        (unwind-protect
            (with-syntax-table ,table
              ,@body)
-- 
2.17.1


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

Previous Next


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