From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in HTML file Date: Sun, 26 Jun 2022 08:17:43 -0400 Message-ID: References: <801r7vgoxm.fsf@felesatra.moe> <87im11gbxf.fsf_-_@gnus.org> <8735rybg2f.fsf@gnus.org> <87tuk978gm.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21108"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , 49629@debbugs.gnu.org, Noam Postavsky To: Allen Li Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 26 14:18:10 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 1o5RDO-0005FS-1X for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Jun 2022 14:18:10 +0200 Original-Received: from localhost ([::1]:37914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5RDM-00050U-VJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Jun 2022 08:18:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5RDG-000500-Fc for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2022 08:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5RDG-0001Y8-77 for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2022 08:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5RDG-0005nb-3z for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2022 08:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Jun 2022 12:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49629 X-GNU-PR-Package: emacs Original-Received: via spool by 49629-submit@debbugs.gnu.org id=B49629.165624587622280 (code B ref 49629); Sun, 26 Jun 2022 12:18:02 +0000 Original-Received: (at 49629) by debbugs.gnu.org; 26 Jun 2022 12:17:56 +0000 Original-Received: from localhost ([127.0.0.1]:46880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5RD9-0005nI-ST for submit@debbugs.gnu.org; Sun, 26 Jun 2022 08:17:56 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:35683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5RD7-0005n4-RA for 49629@debbugs.gnu.org; Sun, 26 Jun 2022 08:17:54 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E10A6440B72; Sun, 26 Jun 2022 08:17:47 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9955B440984; Sun, 26 Jun 2022 08:17:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1656245866; bh=cbNka9Qpgc7aBemEbRC5HV1nbW5zzNVaY5Y7GZ+3tRM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=SAXlZqG5Wtd6Wl8QLbUEspB1BUMs35hSbtQY3uxnRq8rP3JH3gdqqz+9/3DJtuYYm mFE/zO1oMWX+m7cTu2jCJDMd8rUwBbOQ2/f9FHTW5dX0tQnsxyjH+oLstpUowd9RLT l77vxdmrxuYO0SFAkiTk8Edk12yqvvPeSYAliuvrTtybOmfzTZLztFmBNemyzik2AD K8ua1LTedKYSnyEAlqV07ZQQmK7HCb+1+ZOIyxool3DOfQB4oj8fhR3tYmILivOcZ5 uKXEYEW+B0xr5+XmqpfATGw5joXYeXl74EcS57l7yYmKHI8z0PQGHhDlC+irIX3vXI BnexP/NrjwzzA== Original-Received: from alfajor (165.63.10.93.rev.sfr.net [93.10.63.165]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CB193120317; Sun, 26 Jun 2022 08:17:45 -0400 (EDT) In-Reply-To: (Allen Li's message of "Sun, 26 Jun 2022 02:38:28 -0700") 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:235321 Archived-At: > I *think* I've fixed this, but it's complicated. Also I could be > completely wrong. For what it's worth, I can reproduce the bug without the > patch and cannot with the patch, which see attached. AFAICT you've indeed found the origin of the problem. > If this sounds sensible, then a slightly different patch is needed, because > `electric-pair--with-uncached-syntax` is used in some contexts where hiding > `syntax-propertize-function` is the correct behavior. I think the code deserves a comment when/where it overrides `syntax-propertize-function` to explain why it's needed. AFAICT it was introduced in commit 89cfdbf729bc731331358e0efc69547547aa3ca2 but that commit doesn't explain why it bound it to nil (which I later changed to `ignore`). Furthermore, the cache could be filled with entries before `start` while the syntax-table (and/or `syntax-propertize-function`) is temporarily changed, so the flush doesn't seem sufficient. [ It's unlikely, because usually the cache will have been pre-filled via font-lock and friends, but it can still occur in corner cases. ] IIUC we use `with-syntax-table` there specifically when we want to provide text-mode style paren matching within comments and strings. Maybe a good way to avoid problem with syntax-ppss/properties is to narrow the buffer to the comment/string at the same time as we `with-syntax-table` and let-bind `syntax-propertize-function`. Stefan