From unknown Sat Sep 20 08:01:35 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50538 <50538@debbugs.gnu.org> To: bug#50538 <50538@debbugs.gnu.org> Subject: Status: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Reply-To: bug#50538 <50538@debbugs.gnu.org> Date: Sat, 20 Sep 2025 15:01:35 +0000 retitle 50538 [PATCH] 28.0.50; electric-pair-mode fails to pair double quot= es in some cases in CC mode reassign 50538 emacs submitter 50538 Jim Porter severity 50538 normal tag 50538 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 11 23:58:54 2021 Received: (at submit) by debbugs.gnu.org; 12 Sep 2021 03:58:54 +0000 Received: from localhost ([127.0.0.1]:41845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPGdq-0006wB-Ez for submit@debbugs.gnu.org; Sat, 11 Sep 2021 23:58:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:58774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPGdp-0006w4-9I for submit@debbugs.gnu.org; Sat, 11 Sep 2021 23:58:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPGdo-0004w9-Uh for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 23:58:52 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:45605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPGdm-0001fF-TO for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 23:58:52 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d17so3665870plr.12 for ; Sat, 11 Sep 2021 20:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:subject:to:message-id:date:mime-version:content-language; bh=meTzmysNbydRUqa2kUJfRR6+3A0Kqj+rVkVZZyDnf40=; b=WYbU1PIVGe++zu6fgUDakwXILOAREqyTtj57k8VQzL86zWTMILY0RugDtdX+Gh5DeF nKL/417Uv+W9EitC0xSop4vlL3YRrIkWPQNp+oivy/4PF39C91TvWQEYepUHktqLADsw pSpYT4L+vseilhWAfsapwkmiZ+lZhjFYlVDOy8TTaGKe6OHFizjRxUVOaiekiUkqAaEX lQJW4N+odKM6Gu4k9JQcoINlP97/1ABaiIH/nuuoS/lHblIwh/VtxAzlq5erwhIAu3/q 0WbrdqQWA8pd8WZLjaCC0bw+pTSauJpZObJ9XkcfC4q/NSiaRn3aPqZaJGaH+NQMS1ze VD6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:message-id:date:mime-version :content-language; bh=meTzmysNbydRUqa2kUJfRR6+3A0Kqj+rVkVZZyDnf40=; b=D18L63bNfuFPVoiyEQj1ja+EkCwNN+x7yelJ2RQdIVpYbZuWYgKrVBSsFpUlz76loM jeGNGv3lY4k7uULA8ZJoxfcsp9YD/o+Q9+643DjijJpdo7JOKf43VbF6Kg2xuNvhCxBS 2HojoQ/XZDe2hjwX6JIImvb1JKtRTIgxtpB/NlDBH/Yc8ZiCvsjqo7lZx+Kd2b7XevpS k26udDlevCpAp6n0QxF1jh3gXV31mL7L2e0Ecgdv973nFXW1hkdhxKJ1D/uyf3iHN1Qr s6G1KIkkQpjmKgYkcOYPIFiQM4gCVRBm1zUY+8Ym5Y2F77WEp+GMTj8wvwWEYU8iIZyK ZPBQ== X-Gm-Message-State: AOAM530CdbfaPYigtEg9PAUTp+TfCcbJbCj9Tix7vAAbqTVDcuwkyPZV SUmiY5PLFtbjKwGi25ssQykIYMHSeY4= X-Google-Smtp-Source: ABdhPJxBOppqlMSoCMDZJ+VHDRkuW9Ygf2oiMZ+KBJlUKdCKI4ySZkwL+yNUCVgx00vHARJdJabOIA== X-Received: by 2002:a17:90b:3a91:: with SMTP id om17mr5822266pjb.7.1631419128575; Sat, 11 Sep 2021 20:58:48 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id e16sm3186915pfj.90.2021.09.11.20.58.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Sep 2021 20:58:47 -0700 (PDT) From: Jim Porter Subject: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: bug-gnu-emacs@gnu.org Message-ID: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> Date: Sat, 11 Sep 2021 20:58:47 -0700 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------75E1D06C54734075675BA122" Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------75E1D06C54734075675BA122 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit (Note: I've just updated my copyright assignment information, but haven't received confirmation that everything is in order, so this might need to wait until that's done for it to merge.) There are a few related issues with pairing double quotes in CC mode while using `electric-pair-mode'. Hopefully the steps to reproduce below will explain the issues. In all the cases, I'd expect `electric-pair-mode' to insert a closing quote, but it doesn't. You can try similar steps in a `ruby-mode' buffer to see how it should work. ---------------------------------------- Common setup ------------ $ cat foo.c "foobar" $ emacs -Q foo.c M-x electric-pair-mode Note that | represents the point below. 1. Quote pairing in comments ---------------------------- C-o ;; to make a blank line // " ;; type this Expected: line 1 is // "|" Actual: line 1 is // "| 2. Inserting quote pairs before existing string ----------------------------------------------- " ;; type this (point is at beginning of buffer, before "foobar") Expected: line 1 is "|""foobar" Actual: line 1 is "|"foobar" 3. Splitting strings into two ----------------------------- "foo|bar" ;; move point here " ;; type this Expected: line 1 is "foo"|"bar" Actual: line 1 is "foo"|bar" ---------------------------------------- This is because the logic in the patch for bug#36474 isn't quite right. Currently, `c-electric-pair-inhibit-predicate' checks if the newly-inserted quotation mark has "a string fence syntax-table text property" (i.e. if it's the start of a string literal not terminated on that line[1]). However, this fails in all three cases above: in (1) because we're in a comment, not a string literal; and in (2) and (3) because it's the *last* quotation mark on the line that's unterminated, not the one before point. The attached patch fixes this by taking those cases into account. I also added `c-mode' to the list of modes to check in `test/lisp/electric-tests.el'. This required setting single-line comments as the default in those tests, since the tests expect single-line comments (I tried testing under `c++-mode', but the tests failed, I think due to <> being paren-like in C++). [1] I think this is what it means, at least (or close to it). --------------75E1D06C54734075675BA122 Content-Type: text/plain; charset=UTF-8; name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" RnJvbSBkOWM4ODc5YjMwODJhNDAzNzU1NTJkZGI2MjljODNhMGQ5NDFiZmY5IE1vbiBTZX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gMTAwNjQ0Ci0tLSBhL3Rlc3QvbGlzcC9lbGVjdHJpYy10ZXN0cy5lbAor KysgYi90ZXN0L2xpc3AvZWxlY3RyaWMtdGVzdHMuZWwKQEAgLTMyLDYgKzMyLDkgQEAKIChy ZXF1aXJlICdlbGVjLXBhaXIpCiAocmVxdWlyZSAnY2wtbGliKQogCis7OyBXaGVuIHJ1bm5p bmcgdGVzdHMgaW4gYy1tb2RlLCB1c2Ugc2luZ2xlLWxpbmUgY29tbWVudHMgKC8vKS4KKyhh ZGQtaG9vayAnYy1tb2RlLWhvb2sgKGxhbWJkYSAoKSAoYy10b2dnbGUtY29tbWVudC1zdHls ZSAtMSkpKQorCiAoZGVmdW4gY2FsbC13aXRoLXNhdmVkLWVsZWN0cmljLW1vZGVzIChmbikK ICAgKGxldCAoKHNhdmVkLWVsZWN0cmljIChpZiBlbGVjdHJpYy1wYWlyLW1vZGUgMSAtMSkp CiAgICAgICAgIChzYXZlZC1sYXlvdXQgKGlmIGVsZWN0cmljLWxheW91dC1tb2RlIDEgLTEp KQpAQCAtMTczLDcgKzE3Niw3IEBAIGRlZmluZS1lbGVjdHJpYy1wYWlyLXRlc3QKICAgICAg ICAgICBleHBlY3RlZC1zdHJpbmcKICAgICAgICAgICBleHBlY3RlZC1wb2ludAogICAgICAg ICAgIGJpbmRpbmdzCi0gICAgICAgICAgKG1vZGVzICcocXVvdGUgKHJ1YnktbW9kZSBqcy1t b2RlKSkpCisgICAgICAgICAgKG1vZGVzICcocXVvdGUgKHJ1YnktbW9kZSBqcy1tb2RlIGMt bW9kZSkpKQogICAgICAgICAgICh0ZXN0LWluLWNvbW1lbnRzIHQpCiAgICAgICAgICAgKHRl c3QtaW4tc3RyaW5ncyB0KQogICAgICAgICAgICh0ZXN0LWluLWNvZGUgdCkKLS0gCjIuMjUu MQoK --------------75E1D06C54734075675BA122-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 12 02:26:24 2021 Received: (at 50538) by debbugs.gnu.org; 12 Sep 2021 06:26:24 +0000 Received: from localhost ([127.0.0.1]:41887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPIwa-0002TZ-Db for submit@debbugs.gnu.org; Sun, 12 Sep 2021 02:26:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35332) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPIwZ-0002TN-3G for 50538@debbugs.gnu.org; Sun, 12 Sep 2021 02:26:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51830) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPIwT-0007T3-Nf; Sun, 12 Sep 2021 02:26:17 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1730 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPIwT-0002pK-Al; Sun, 12 Sep 2021 02:26:17 -0400 Date: Sun, 12 Sep 2021 09:26:05 +0300 Message-Id: <83r1dufgxu.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> (message from Jim Porter on Sat, 11 Sep 2021 20:58:47 -0700) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jim Porter > Date: Sat, 11 Sep 2021 20:58:47 -0700 > > There are a few related issues with pairing double quotes in CC mode > while using `electric-pair-mode'. Hopefully the steps to reproduce below > will explain the issues. In all the cases, I'd expect > `electric-pair-mode' to insert a closing quote, but it doesn't. Your expected results seem to expect Emacs to assume that a new string will be inserted, but is that an assumption that is always true? It could be that the user wants to modify the existing string instead, in which case your suggested patches will require the user to delete more quotes than previously. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 12 14:05:27 2021 Received: (at 50538) by debbugs.gnu.org; 12 Sep 2021 18:05:27 +0000 Received: from localhost ([127.0.0.1]:43536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPTr5-0004gw-4x for submit@debbugs.gnu.org; Sun, 12 Sep 2021 14:05:27 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:38844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPTr1-0004gb-Br for 50538@debbugs.gnu.org; Sun, 12 Sep 2021 14:05:25 -0400 Received: by mail-pj1-f42.google.com with SMTP id g13-20020a17090a3c8d00b00196286963b9so4986596pjc.3 for <50538@debbugs.gnu.org>; Sun, 12 Sep 2021 11:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language; bh=9MKAPc0YM8xaJ48ytt5QDNZ5k4SAfJJZbubQDNH1NKU=; b=iSk6Tyq6dtpODX6pQ1+vVjqd7Jcwxha7YAQhSJAnqMRWgTmJ35hzzfOp5de/EuJg1f C0wr26j9uD6LuONW34iVpj3Ph34QOXeabqwq3bgKD9LPW2zLaQJHa0U5j90oF22ARirx +aHcU99UAP/FLvX+V4Q4goQiRVRifCvaNU9SnjY/gLdlKQPLV/iuctyGjIB/KHno2ySt f0nEdz9h4VNXF5/Ov7EKFFMVJ4Ajrhdl9HcDsB+LLgfVnzh4J6WMPn2gcGlZqcOa90RF GE0uuHrb60prDYmfu+yWGxXk8QNBW0HW9ngZNDsT9XhR4RwnkKzNmJk3vXhBhkzs4Io1 JKiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language; bh=9MKAPc0YM8xaJ48ytt5QDNZ5k4SAfJJZbubQDNH1NKU=; b=DsWGTsM7hsN13frucIqAd7BUlbXgLvnALaZNTRqmWzV4wK9tn/LiNrK4HSFVeiD2ZZ miC2VZsKfV0izd3jO77cncWDsHn/pq//A44dOcla0qTbQnElTIkUCP1Xx+W6UnuZQD8Q e+RFq0LNKm2TV+8D1USPj//gWHVTFpuDDWKkw0UTSu/Gnic3jBlxqLnEW+0Sp//Apwt2 jvplGWjXlZ/3rkqqTu3WyMxzJFZeWeYO3zsMWiB2F2ecuUybmcnvfktNkLATtfNd/J+L rBwKHRFHrEdA1lqpWQJ5lkOshtiDjf8TDwg00Aqr12pTG52uoIhxk1A7sKAwo9wT+oGN keAA== X-Gm-Message-State: AOAM53312Ohi66BEYfgzF+ISZoDXnwWqSlDdEyyfV/vT8KStAZh4Bw98 HCHDaeQut7s28BI7vWfmLUZSwzyyZOg= X-Google-Smtp-Source: ABdhPJy+518/PLkibt5CI/+UQgTlKTIyQTFUNIL+1Vt8EPlTPp+5FD64MInUUctm+mabzRwuO6YA0w== X-Received: by 2002:a17:90b:a4a:: with SMTP id gw10mr8678291pjb.245.1631469917074; Sun, 12 Sep 2021 11:05:17 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id w8sm1179984pfc.93.2021.09.12.11.05.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Sep 2021 11:05:16 -0700 (PDT) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: Eli Zaretskii References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> From: Jim Porter Message-ID: <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> Date: Sun, 12 Sep 2021 11:05:17 -0700 MIME-Version: 1.0 In-Reply-To: <83r1dufgxu.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------BE38C65897CECAEF07E54E0E" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------BE38C65897CECAEF07E54E0E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/11/2021 11:26 PM, Eli Zaretskii wrote: >> From: Jim Porter >> Date: Sat, 11 Sep 2021 20:58:47 -0700 >> >> There are a few related issues with pairing double quotes in CC mode >> while using `electric-pair-mode'. Hopefully the steps to reproduce below >> will explain the issues. In all the cases, I'd expect >> `electric-pair-mode' to insert a closing quote, but it doesn't. > > Your expected results seem to expect Emacs to assume that a new string > will be inserted, but is that an assumption that is always true? In these cases, I believe that's true (with the default `electric-pair-mode' settings, that is). More broadly, the goal of the patch is to ensure that pairing of double quotes works the same in CC mode as it does in other modes (`ruby-mode', `python-mode', `js-mode', `emacs-lisp-mode', etc), which is why I added `c-mode' to the list of modes to test in `test/lisp/electric-tests.el'. That said, there's one potential case I didn't account for (mostly because it wasn't accounted for in the patch for bug#36474): if a user customizes `electric-pair-inhibit-predicate' to inhibit cases like (2) or (3) in my original message, that won't work right in CC modes, since the default value of `electric-pair-inhibit-predicate' (set by the user) won't be called. Attached is an updated patch that changes the logic of `c-electric-pair-inhibit-predicate' to either a) inhibit insertion of the closing quote, or b) call the default-value of `electric-pair-inhibit-predicate' to determine what to do. This should give users more consistent behavior when customizing `electric-pair-inhibit-predicate'. The tests still pass, although I wasn't able to figure out a good way to add a test for setting `electric-pair-inhibit-predicate' that works with how CC mode overrides it (using `:bindings' in `define-electric-pair-test' didn't work, since the binding is set too late). Hopefully that's ok; if not, I can try and see about making some more extensive changes to the tests to account for this. Note however that this solution isn't perfect: it means a user's custom `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's default behavior, not less. I think that's a reasonable compromise though, and users who want more direct control can set `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A "perfect" solution here would probably require adding new customization points to `electric-pair-mode' (e.g. a way for major modes to override how the syntax is analyzed), and I'm not sure the added complexity would be worth it, especially since this code is already a bit tricky. --------------BE38C65897CECAEF07E54E0E Content-Type: text/plain; charset=UTF-8; name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" RnJvbSAwYjAzOGVmODY4YThjNTU4ZTY2ZDQyMGI5MzgwYjc5MmI0MDllMzg4IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFN1biwgMTIgU2VwIDIwMjEgMTA6NDQ6NTUgLTA3MDAKU3ViamVjdDogW1BB VENIXSBJbXByb3ZlIGJlaGF2aW9yIG9mICdlbGVjdHJpYy1wYWlyLW1vZGUnIGluICdjYy1t b2RlJwoKVGhpcyBlbnN1cmVzIHRoYXQgcXVvdGVzIGFyZSBwYWlyZWQgY29ycmVjdGx5IHdp dGhpbiBjb21tZW50cywgYWxsb3dzIGZvcgppbnNlcnRpb24gb2YgcXVvdGUgcGFpcnMgaW1t ZWRpYXRlbHkgYmVmb3JlIGFub3RoZXIgcXVvdGUsIGFuZCBhbGxvd3MKaW5zZXJ0aW5nIHF1 b3RlIHBhaXJzIHdpdGhpbiBhIHN0cmluZyAodGh1cyBzcGxpdH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wtd2l0aC1zYXZlZC1lbGVjdHJpYy1tb2RlcyAoZm4pCiAgIChsZXQgKChz YXZlZC1lbGVjdHJpYyAoaWYgZWxlY3RyaWMtcGFpci1tb2RlIDEgLTEpKQogICAgICAgICAo c2F2ZWQtbGF5b3V0IChpZiBlbGVjdHJpYy1sYXlvdXQtbW9kZSAxIC0xKSkKQEAgLTE3Myw3 ICsxNzYsNyBAQCBkZWZpbmUtZWxlY3RyaWMtcGFpci10ZXN0CiAgICAgICAgICAgZXhwZWN0 ZWQtc3RyaW5nCiAgICAgICAgICAgZXhwZWN0ZWQtcG9pbnQKICAgICAgICAgICBiaW5kaW5n cwotICAgICAgICAgIChtb2RlcyAnKHF1b3RlIChydWJ5LW1vZGUganMtbW9kZSkpKQorICAg ICAgICAgIChtb2RlcyAnKHF1b3RlIChydWJ5LW1vZGUganMtbW9kZSBjLW1vZGUpKSkKICAg ICAgICAgICAodGVzdC1pbi1jb21tZW50cyB0KQogICAgICAgICAgICh0ZXN0LWluLXN0cmlu Z3MgdCkKICAgICAgICAgICAodGVzdC1pbi1jb2RlIHQpCi0tIAoyLjI1LjEKCg== --------------BE38C65897CECAEF07E54E0E-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 15 18:17:34 2021 Received: (at 50538) by debbugs.gnu.org; 15 Sep 2021 22:17:35 +0000 Received: from localhost ([127.0.0.1]:53429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQdDi-0003rd-M6 for submit@debbugs.gnu.org; Wed, 15 Sep 2021 18:17:34 -0400 Received: from mail-pj1-f46.google.com ([209.85.216.46]:37582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQdDf-0003rL-3m for 50538@debbugs.gnu.org; Wed, 15 Sep 2021 18:17:33 -0400 Received: by mail-pj1-f46.google.com with SMTP id me5-20020a17090b17c500b0019af76b7bb4so5361382pjb.2 for <50538@debbugs.gnu.org>; Wed, 15 Sep 2021 15:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=0NPzkMwgZ4SYmQk7gFUy/rRXYLLUNffBq3o25MaYRR4=; b=EPlQda/A+t3k6mYTtlAV0NNxZ6Zc9h3ku/OizRk4bOaAVGerwWacoHmWVWIe4wDcI9 qxsZMd/2hbBYSKApJr1/2JRq5FiL2hnMe4u48keMf/AEYw6pv9diSFJkEAZxXKWU+C8j Pu7cUuO+jiovgtjAdZCd7iBy7YEwMHOlE9QUEgi9Gmz7F/h2JzTbv27BUTkV20AffsVe 3pu2XmVPtbtxDy1re/D/sfnnf5QhxHAMXEIuIufeTc8C2OUZ0a9H8QbhblxLOaI+95SH uX6Q99Kua0WwxIoOg6TuYo+C5+jdnqzZr98BwrhRH6Qd5ZTHSMNh04LGnydPfTXhoNjt c16w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0NPzkMwgZ4SYmQk7gFUy/rRXYLLUNffBq3o25MaYRR4=; b=MrxdMO1U9JYTOcr/ABRDEZGmDO0gK7OvNWNMUBIK1lAuX07e6UcsgJ25H/dzLWkFN/ lehj+yDqUENawJobx1iJkyoke/tdI4VF/a4FUyQ7Sxbov1EZQyrvgiyAWdDQ5h8iXdQD 3f9VteFiS2qgD0rWjC+Lb2TP5qJ5RhbZJGPdHh41fn2l/dVUgb4a7JXop6mUEnUZ4OPA A5OYeDr8YSRY+on+B7qSkt4SqXrhGcsgqI1ZY3Pjf//shGQ1VZzJvlzV3/GEXGHKKCyi k4lbHuW0rWNoFxX4g9cpndOlrttDb0H1xcVVZl01EvQyK9aRSnw4uBgpNXAJxZ1bP9KW l+Bw== X-Gm-Message-State: AOAM53011MlSZ4t+ZZd2zihOseRfOaI/afZmJUT1fPyTwjLxvdRTLJQ5 ETMV7TZa/JX7wg7KC+MfvO+eEe9wbIk= X-Google-Smtp-Source: ABdhPJwrCJvwj0mT4TyfudPX2l/RvuoCyjihPNu7dpkDdfvetnTyH0UwAEzocK2TY0d4qrp8kyTuJQ== X-Received: by 2002:a17:902:c789:b0:13c:a112:6383 with SMTP id w9-20020a170902c78900b0013ca1126383mr538705pla.42.1631744245004; Wed, 15 Sep 2021 15:17:25 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id b16sm795649pfr.138.2021.09.15.15.17.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Sep 2021 15:17:24 -0700 (PDT) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode From: Jim Porter To: Eli Zaretskii References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> Message-ID: <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> Date: Wed, 15 Sep 2021 15:17:23 -0700 MIME-Version: 1.0 In-Reply-To: <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/11/2021 8:58 PM, Jim Porter wrote: > (Note: I've just updated my copyright assignment information, but > haven't received confirmation that everything is in order, so this might > need to wait until that's done for it to merge.) I've gotten confirmation that my copyright assignment info is all up-to-date, so once this patch passes muster, it should be ok to merge it. On 9/12/2021 11:05 AM, Jim Porter wrote: > Note however that this solution isn't perfect: it means a user's custom > `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's > default behavior, not less. I think that's a reasonable compromise > though, and users who want more direct control can set > `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A > "perfect" solution here would probably require adding new customization > points to `electric-pair-mode' (e.g. a way for major modes to override > how the syntax is analyzed), and I'm not sure the added complexity would > be worth it, especially since this code is already a bit tricky. I'm not sure if someone has a better idea for how to do things, but for my config[1], the patch works well and makes CC modes behave the same as other programming modes. In my opinion, the worst thing `electric-pair-mode' can do is to behave inconsistently, since that forces the user to pay close attention to something that should be almost invisible/automatic. [1] I customize `electric-pair-inhibit-predicate' to disable electric-pairing in strings/comments, and this patch interacts correctly with that customization. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 01:25:43 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 05:25:43 +0000 Received: from localhost ([127.0.0.1]:53598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQju3-0005vC-E5 for submit@debbugs.gnu.org; Thu, 16 Sep 2021 01:25:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQju0-0005uy-2v for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 01:25:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40044) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQjtt-0005Ly-Ad; Thu, 16 Sep 2021 01:25:34 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3821 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQjts-0001se-Ua; Thu, 16 Sep 2021 01:25:33 -0400 Date: Thu, 16 Sep 2021 08:25:33 +0300 Message-Id: <83k0jh9jn6.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter , Lars Ingebrigtsen , Alan Mackenzie In-Reply-To: <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> (message from Jim Porter on Wed, 15 Sep 2021 15:17:23 -0700) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jim Porter > Cc: 50538@debbugs.gnu.org > Date: Wed, 15 Sep 2021 15:17:23 -0700 > > On 9/11/2021 8:58 PM, Jim Porter wrote: > > (Note: I've just updated my copyright assignment information, but > > haven't received confirmation that everything is in order, so this might > > need to wait until that's done for it to merge.) > > I've gotten confirmation that my copyright assignment info is all > up-to-date, so once this patch passes muster, it should be ok to merge it. Your copyright assignment is on file, so we are good in that department. > On 9/12/2021 11:05 AM, Jim Porter wrote: > > Note however that this solution isn't perfect: it means a user's custom > > `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's > > default behavior, not less. I think that's a reasonable compromise > > though, and users who want more direct control can set > > `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A > > "perfect" solution here would probably require adding new customization > > points to `electric-pair-mode' (e.g. a way for major modes to override > > how the syntax is analyzed), and I'm not sure the added complexity would > > be worth it, especially since this code is already a bit tricky. > > I'm not sure if someone has a better idea for how to do things, but for > my config[1], the patch works well and makes CC modes behave the same as > other programming modes. In my opinion, the worst thing > `electric-pair-mode' can do is to behave inconsistently, since that > forces the user to pay close attention to something that should be > almost invisible/automatic. I don't use this minor mode, so I don't think my opinion on this matters much. I will defer to Lars and Alan here. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 08:40:54 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 12:40:54 +0000 Received: from localhost ([127.0.0.1]:54071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQqhB-0004rf-Qw for submit@debbugs.gnu.org; Thu, 16 Sep 2021 08:40:54 -0400 Received: from quimby.gnus.org ([95.216.78.240]:35340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQqh9-0004rR-KG for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 08:40:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UsBIt2ysL6sxCEXypOVgBS4EtuDzNagyU05UmmV1/Uc=; b=q77eQ8CcMmp+St3SFi698GycSA AMGgqqOWanSN5b4Aeqo5B4YCM7OrRZJ/zmgKRW/6p1F84RD7P7dRUMziMMwg8x7qRWt9BwN3KxADW 4YdSF1PXaUopzkzxXeFdXcwqxxbbZyKsaalS7q/EYikAuKBx3/ig4GWBzw2f65fl3j5Y=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQqgz-0002hE-EQ; Thu, 16 Sep 2021 14:40:44 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> Date: Thu, 16 Sep 2021 14:40:40 +0200 In-Reply-To: <83k0jh9jn6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Sep 2021 08:25:33 +0300") Message-ID: <87o88s3d87.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > I don't use this minor mode, so I don't think my opinion on this > matters much. I will defer to Lars and Alan here. I seldom use electric-pair-mode, and since this touches cc-mode, I'll defer to Alan. :-) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , 50538@debbugs.gnu.org, Alan Mackenzie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > I don't use this minor mode, so I don't think my opinion on this > matters much. I will defer to Lars and Alan here. I seldom use electric-pair-mode, and since this touches cc-mode, I'll defer to Alan. :-) Alan? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 08:59:26 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 12:59:27 +0000 Received: from localhost ([127.0.0.1]:54114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQqz8-0007XD-MD for submit@debbugs.gnu.org; Thu, 16 Sep 2021 08:59:26 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:51013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQqz3-0007Wx-Ff for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 08:59:26 -0400 Received: by mail-wm1-f50.google.com with SMTP id 140so4794467wma.0 for <50538@debbugs.gnu.org>; Thu, 16 Sep 2021 05:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dkTuLNkk4yvPuYJWSTXLwV4dlLKkF7e4AdoHFMJl8kY=; b=oxijiDmIhmU4aKeRK1JX9RMHGY5paJcCJA3OCEgyIpOyfU77URIu+QmCTrKq5RH66X gegoZLOOveQ/F/PCZUIE1gofFUwMtOu7a34E2uCFfKqQPlOX1GRY3Wad7KyrqHVQDqIB 3qrSSiy/4RmaLS5hVHMtkw8M1uV3fr6wlA3C2+2+y8BGGuLizffDO9FXYyB/htQIFMfI t9kyBz+ZbsZWk8vNZcODhGmFbfL6wuKrKcr/bHy2EJt9P4YndWs8rFRXrfTuGMYXfF49 PUT+jF6ge4ZtG4atXRLbdsOHC0HSQvM9MmiQP4qe0kggxAxCOGN/gAQG4LtdyYJU2EiV KnyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dkTuLNkk4yvPuYJWSTXLwV4dlLKkF7e4AdoHFMJl8kY=; b=TrIvO26hoY83DPg/CntglWEmzBsILoGqSV2v3NKB7FECG/38dRep8vhuJuDa6oiJPB G0Va1FC+PSXcQuMlIM1Rq9wt8r7ANBkHfqkqkDEQqEfoV1+a4WnAzMBi0pdQQJ1U7aJL heQik119WkgmQI/KoVH95gwgyGKQQeV6CzRR3RFToA08B/29MGIDDHPL+vDR78ReBD0/ 8ReQHuDE6fXzJo2ZM4Buh1y/qe3N3mTDJlyd2FK+3Ube2hVTtHLTdWOsclZ9yjNlCDqy Sa83mCfZyLFcatcaIGc64mVSwXNIBAKoqN6UKYP6hgqIRN7Z4dAwWs8dAyfhUEWYu12U njdg== X-Gm-Message-State: AOAM532ptMjA/3L9K5pJXpA64PyOaBp83zEIVo/EFofrapZ7PU3P3XAH sbQ2Ql78y88Mx2RU6ww8qg4= X-Google-Smtp-Source: ABdhPJxqFwqhGwx0zFsaYNF9mbnBg9M5OZHul4xZTe17JpwCJ8FS1J/myk8GYhDddsr6/vOf4YTokQ== X-Received: by 2002:a1c:ac07:: with SMTP id v7mr9528359wme.160.1631797155636; Thu, 16 Sep 2021 05:59:15 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id l26sm7386217wmi.25.2021.09.16.05.59.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 05:59:15 -0700 (PDT) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: Lars Ingebrigtsen , Eli Zaretskii References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> From: Dmitry Gutov Message-ID: Date: Thu, 16 Sep 2021 15:59:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87o88s3d87.fsf@gnus.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , 50538@debbugs.gnu.org, Alan Mackenzie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 16.09.2021 15:40, Lars Ingebrigtsen wrote: > Eli Zaretskii writes: > >> I don't use this minor mode, so I don't think my opinion on this >> matters much. I will defer to Lars and Alan here. > I seldom use electric-pair-mode, and since this touches cc-mode, I'll > defer to Alan.:-) > > Alan? At risk of reigniting an old disagreement, perhaps we should ask Joao? IIUC, Alan doesn't really use electric-pair-mode. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 09:17:41 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 13:17:41 +0000 Received: from localhost ([127.0.0.1]:54122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQrGn-0007yt-4g for submit@debbugs.gnu.org; Thu, 16 Sep 2021 09:17:41 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQrGk-0007yg-Cg for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 09:17:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ijj0muWjpKfMFpzIp3NVJ7rkaPU/lFqQb1E+b+JbRAw=; b=USs8TV1GJDqAMqzOtJcsogXjdg PBhiDJ1KowloRNq6DMCeu415FdGzEATKLt8K7U7knyRnJ8IduA2zGKFcsZR26UhwppgX4u7+oeqUQ Kbu15jQ/QbRihyNfd7R2lNasTNF97GULbq2LlYOeltHunDPyaJ6zKEgPoJsrhR+BFUOc=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQrGa-0003uw-Jd; Thu, 16 Sep 2021 15:17:31 +0200 From: Lars Ingebrigtsen To: Dmitry Gutov Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> Date: Thu, 16 Sep 2021 15:17:28 +0200 In-Reply-To: (Dmitry Gutov's message of "Thu, 16 Sep 2021 15:59:11 +0300") Message-ID: <871r5o3biv.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Dmitry Gutov writes: >>> I don't use this minor mode, so I don't think my opinion on this >>> matters much. I will defer to Lars and Alan here. >> I seldom use electric-pair-mode, and since this touches cc-mode, I'll >> d [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , Eli Zaretskii , =?utf-8?B?Sm/Do28g?= =?utf-8?B?VMOhdm9yYQ==?= , 50538@debbugs.gnu.org, Alan Mackenzie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Dmitry Gutov writes: >>> I don't use this minor mode, so I don't think my opinion on this >>> matters much. I will defer to Lars and Alan here. >> I seldom use electric-pair-mode, and since this touches cc-mode, I'll >> defer to Alan.:-) >> Alan? > > At risk of reigniting an old disagreement, perhaps we should ask Joao? Sure; added to the CCs. Jo=C3=A3o, do you have an opinion here? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 13:05:05 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:05:05 +0000 Received: from localhost ([127.0.0.1]:56442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQuor-00008W-Bj for submit@debbugs.gnu.org; Thu, 16 Sep 2021 13:05:05 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:33384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQuon-00007s-2r for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 13:05:04 -0400 Received: by mail-wr1-f51.google.com with SMTP id t18so10683562wrb.0 for <50538@debbugs.gnu.org>; Thu, 16 Sep 2021 10:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=gFletwjxuVROGSbGzV6dxZu7RNhAemLD/sBAnVs9FGs=; b=H5rQbLGbSo+NAv24OoNTVI29VAA8DAJR5CvL156RpsI4yVFVaehRs/MTV7HOlCZ4Gb 9cMU458uHUfzOFwOggjto6Jpnw9zzWRE7qoGeyko0W62DsZ51KpFFl4baU5ExgVwlSA1 UHCdsElZr8qS/W8htyW7Ez3yDBjnvGLEzB21Vtg7dtVsY8qBepZpQ7hIcIQLlDuvyrOB HYDYlJMzPMh5V5mTgscU3j7/lVCA2Xm669/fADTXmA4geCqAdHKNkqLfsFLmmXR+2xbQ KFJ5hi2o8LaGcwrr6GzQgAgPjsmvAb6CXN0ecBZPmweogmoavlgo3pUsSu7JBmVwn9FV +N7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=gFletwjxuVROGSbGzV6dxZu7RNhAemLD/sBAnVs9FGs=; b=XtHWaGn+RTxKZoTggoyd9j9R0mZ7WJ3MKlSPYJ+eeWwwTuqzOShTY2BLrXyxSDag7U xO6kN9AwSM705DfTxhbIpT/8SVFQmx6mJxL1UjqMozsIBn3nVPHt+sapRPe7PJfNsp9d GRV1UyWuDCB7jtZopKyfCeQ95+Lc9yEJeY6lC/0Px2/ylRACXJ+9yoA5V1AtWhq8eI9x 9OE3uzKIPEdjYTMCYVsvJtVTpIRMN/ZmCKI72DeyrJ3u1xyMlrFHwdyUHDIm4ibixYw3 bUCoB+2cXnSNqJ+qPAfOeL3whWDtBFeJRwJwIutw0E6V1GHDnt/h19wBqbj8QXjOlLxL pEYw== X-Gm-Message-State: AOAM530l1VQzx/nWHrI/OodzLPVwco32Jafhft6Kif0duDGm6vNF/KX9 qVi9Be7z3aLvLab710Qyoxo= X-Google-Smtp-Source: ABdhPJwhbXZeMhqMTTU6vWYSy0ClYTGTTfxDW8wx/ipqdRnAIn78H703orz/bJhA+qE3Sp0cE866yw== X-Received: by 2002:a05:6000:181:: with SMTP id p1mr7473117wrx.247.1631811895203; Thu, 16 Sep 2021 10:04:55 -0700 (PDT) Received: from krug ([62.48.174.238]) by smtp.gmail.com with ESMTPSA id q19sm8193343wmq.29.2021.09.16.10.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 10:04:54 -0700 (PDT) From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Lars Ingebrigtsen Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> Date: Thu, 16 Sep 2021 18:04:53 +0100 In-Reply-To: <871r5o3biv.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 16 Sep 2021 15:17:28 +0200") Message-ID: <87fsu4h2oa.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , Eli Zaretskii , Alan Mackenzie , 50538@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > Dmitry Gutov writes: > >>>> I don't use this minor mode, so I don't think my opinion on this >>>> matters much. I will defer to Lars and Alan here. >>> I seldom use electric-pair-mode, and since this touches cc-mode, I'll >>> defer to Alan.:-) >>> Alan? >> >> At risk of reigniting an old disagreement, perhaps we should ask Joao? > > Sure; added to the CCs. Jo=C3=A3o, do you have an opinion here? I couldn't understand the initial issue fully, but I can only confirm that the relationship between cc-mode and electric-pair-mode has been rocky. I think the situation is similar with electric-layout-mode and with electric-indent-mode, to a certain degree (though I am not sure for this last one). I don't think there are any easy technical solutions for it. I certainly cannot invest the effort in any of them right now. It wasn't like this from the beginning: when I first created electric-pair-mode it worked mostly if not fully fine with cc-mode, like one expects e-p-m to work in other modes (ruby, python, js, elisp, rust, perl, even non-programming modes). At times, compatibility deteriorated as cc-mode added mechanisms for solving electricity problems or related problems in an idiosyncratic way. Sometimes these changes broke e-p-m's tests and the solution was -- incorrectly in my view --to disable the tests "temporarily". I see that for one of them at least, the test has been re-instated. A good sign, maybe.=20=20 Regardless of history and current state of affairs, my personal solution to C in Emacs is to use a hand-rolled mode, a so-called plainer-cc-mode. The goal is to make it behave like most other modes w.r.t electric-pair-mode and keep the basic c syntax and indentation. I've used it reasonably successfully with C and C++. Here it is in its entirety. I think I use something similar for c++-mode. (define-derived-mode plainer-c-mode c-mode "pC" "A plainer C-mode with no internal electric machinery." (c-toggle-electric-state -1) (setq-local electric-indent-local-mode-hook nil) (setq-local electric-indent-mode-hook nil) (electric-indent-local-mode 1) (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\])) (local-set-key (vector key) 'self-insert-command))) Among other simpler things, this makes the major mode not bind special keys to special commands. They are all bound to `self-insert-command` like most major modes. This simplifies electric-pair-mode, as far as I remember. The above is a hack, but not very dirty one. The one below much more so. It's a brute-force hack for solving electricity problems. It simply disables some cc internal functions. May be out of date by now, YMMV,=20 warranty void, etc, as they say. (defun joaot/disable-some-cc-things () (interactive) (dolist (name '(c-restore-string-fences c-remove-string-fences c-before-change-check-unbalanced-strings c-after-change-mark-abnormal-strings c-after-change-escape-NL-in-string)) (advice-add name :override #'ignore '((name . joaot/remove-disable-s= ome-cc-things))) (add-hook 'c-mode-common-hook (lambda () (kill-local-variable 'electric-pair-inhibit-predicate)))= )) On the C++/C editing-front, I am eagerly waiting for Treesitter to arrive so that is it becomes possible to write a new major mode for c++ and c from scratch. Reusing solid and efficient parsing logic based on language grammars. Another more closely available option, is to simply use LSP for indentation and fontification. Though that is almost certainly slower and less confortable/portable/etc... Anyway, whatever the solution, I'm quite confident that such a mode won't have these characteristics that cc-mode has when used with `electric-pair-mode`. If you're writing C, and not C++, my also try Stefan Monnier's aptly named sm-c-mode, installable via M-x package-install RET sm-c-mode. Works fine with electric-pair-mode, but seems to indent very oddly for some reason. Hope this helps. I'm sorry I can't offer any better solutions. Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 13:11:58 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:11:58 +0000 Received: from localhost ([127.0.0.1]:56446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQuvW-0000Jw-Ax for submit@debbugs.gnu.org; Thu, 16 Sep 2021 13:11:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQuvT-0000Je-6w for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 13:11:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58552) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQuvM-0003hz-Sw; Thu, 16 Sep 2021 13:11:48 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3894 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQuvM-0007yb-F5; Thu, 16 Sep 2021 13:11:48 -0400 Date: Thu, 16 Sep 2021 20:11:41 +0300 Message-Id: <83wnng8mya.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= In-Reply-To: <87fsu4h2oa.fsf@gmail.com> (message from =?utf-8?B?Sm/Do28g?= =?utf-8?B?VMOhdm9yYQ==?= on Thu, 16 Sep 2021 18:04:53 +0100) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> <87fsu4h2oa.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50538 Cc: jporterbugs@gmail.com, larsi@gnus.org, acm@muc.de, 50538@debbugs.gnu.org, dgutov@yandex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: João Távora > Cc: Dmitry Gutov , Eli Zaretskii , Jim > Porter , 50538@debbugs.gnu.org, Alan Mackenzie > > Date: Thu, 16 Sep 2021 18:04:53 +0100 > > Hope this helps. I'm sorry I can't offer any better solutions. Thanks, but I'm not sure I understand what is your opinion about the proposed patch. Are you saying we shouldn't install it? From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 13:30:11 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:30:11 +0000 Received: from localhost ([127.0.0.1]:56471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQvCw-0000pm-Rd for submit@debbugs.gnu.org; Thu, 16 Sep 2021 13:30:11 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:42921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQvCv-0000pa-Dr for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 13:29:57 -0400 Received: by mail-pl1-f172.google.com with SMTP id n4so4316976plh.9 for <50538@debbugs.gnu.org>; Thu, 16 Sep 2021 10:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=aH2s5Qj8Uzmt3jvjtkGMDFigDw6RU5ABCrRvGsP4upU=; b=pAShIusJqnWWlZD2uC0ulYxyZpqhRhrthXZbrUzoh8vYCyXWlQKEZK6rNXAWN6tPOU RviMfOqkUK3qG8MWJWnLBti03byICWjSJAf5aLPKOJXU3Cqnls41OrUgTNO6zYCLcLiJ qDtu2z6gU+7/+vQwjYRXTWIPas5eV5yr/lm55LHuV8O7E2ZaluoqV11ERiuMC5Q+onJj IZl25+lMNMSKVfpzIsawpk8UL/8J+SSloSrv3Sgfs2aLOitkGh5g0iIMCfhj9aw4/Dw+ Fljp2FS1HOysT8et+LZv4mzNp74nY9F2i0K2IkML5hjadJbgpu9NfcTVvjQzV7VvEgpl kBKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aH2s5Qj8Uzmt3jvjtkGMDFigDw6RU5ABCrRvGsP4upU=; b=6hJ9rhp0eMlUlLfPKEbP6TURcyOuomH97gTF1dT232w5jBSXLLWPuWerleoKF1+cgR UMMP1mIbeXBdqrxfftKDfZKwlaJGTe8t4sYf5HTYZBqysoClHftffuEEYQ3jtoIyTlzk 3IWx38LUR7uBDltJVmvf5Ga4zFXa2ygLO9I2RF/ynB5ggQRmoApQYUuFr34dzSydElQN Za/Crk5inojN/rGp6OkZIjJ6sD+2P/Tm25VEvjSipmVnpUn+ScKwU5G0nLo3iNPkooFB oxR1ZOMQ0if48gt4wO78BPDc9WOugvd4Nc01JrevJX5IP5ogDc/wia3MieN8t2OfEBNE uEgA== X-Gm-Message-State: AOAM531tFskRDMMOac0BQ7KNNB3c1bH5Kn5PakjtIl3XzC4D3wV/6rMw ii8iAZPLhgjxalzOgHK0e0k= X-Google-Smtp-Source: ABdhPJwI6+XJMEplh1RIhf78y9mbqr5lkhal1H+L6xzYFhFan6E4cHABZxLIzO+3/4SCuEPeGs4m2Q== X-Received: by 2002:a17:90a:de0f:: with SMTP id m15mr7523589pjv.114.1631813386933; Thu, 16 Sep 2021 10:29:46 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id e16sm3679275pfc.214.2021.09.16.10.29.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 10:29:46 -0700 (PDT) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , Lars Ingebrigtsen References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> <87fsu4h2oa.fsf@gmail.com> From: Jim Porter Message-ID: <16202af0-9d66-1996-8756-b3d0ff28ac9a@gmail.com> Date: Thu, 16 Sep 2021 10:29:47 -0700 MIME-Version: 1.0 In-Reply-To: <87fsu4h2oa.fsf@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Alan Mackenzie , 50538@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/16/2021 10:04 AM, João Távora wrote: > > I couldn't understand the initial issue fully, but I can only confirm > that the relationship between cc-mode and electric-pair-mode has been > rocky. I think the situation is similar with electric-layout-mode and > with electric-indent-mode, to a certain degree (though I am not sure for > this last one). Hopefully the following summary will help. My patch is essentially an enhancement of the patch from bug#36474. In that bug, Alan Mackenzie describes the problem: > Diagnosis: electric-pair--unbalanced-strings-p works after the (single) > newly typed " has been stripped from the buffer. It attempts to > determine whether there are any open strings after the point of > insertion. It does this by using parse-partial-sexp, and checks (nth 3 > ) as evidence of an open string. > > This does not work in CC Mode, since although there is an open string > marker (with a string fence syntax-table property on it) this is > "closed" (from parse-partial-sexp's point of view) by the string fence > property on the newline at the end of the line. > electric-pair--unbalanced-strings-p thus returns the wrong result. The fix in that bug was to check if the just-inserted double-quote "is marked with a string fence syntax-table text property". That fixes the issue described in bug#36474, but it's not quite the right logic. CC Mode gives the *last* double-quote on a line the string fence property if a line has unbalanced quotes. Thus, the patch changes the behavior to check the last double-quote on the line, rather than the just-inserted double-quote. The patch makes one other improvement as well: it doesn't check for the string fence property on a double-quote inside a comment. CC Mode doesn't apply string fence properties there, since it's not necessary. Therefore, inside a comment, `c-electric-pair-inhibit-predicate' just defers to the default value of `electric-pair-inhibit-predicate'. As I mentioned earlier in the thread, this isn't quite perfect behavior, but it significantly improves the common case (`electric-pair-mode' with default or "default-like" settings). CC Mode's practice of closing strings at the end of a line - even without a closing quote - just doesn't play nicely with `electric-pair-mode', so barring some major changes to either CC Mode or `electric-pair-mode', I can't think of a way to improve this patch beyond where it's at now. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 13:33:45 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:33:45 +0000 Received: from localhost ([127.0.0.1]:56479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQvGW-0000xd-4w for submit@debbugs.gnu.org; Thu, 16 Sep 2021 13:33:44 -0400 Received: from mail-pj1-f48.google.com ([209.85.216.48]:51171) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQvGK-0000xC-Jh for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 13:33:38 -0400 Received: by mail-pj1-f48.google.com with SMTP id k23so5096734pji.0 for <50538@debbugs.gnu.org>; Thu, 16 Sep 2021 10:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tG2tePMmNduefnAziSSmvI1Rvq3RGtey3IRc275xPi4=; b=LIaNRd9fF6l7v85bZISUCbHlF8746o32SJYsspNcBqXgu2+LKLUUo91wZSGP/F4FFp oRsl1c3TDknId/dwEd9J0VulVRjCNME/YqaQE9gbiqsrkxO/BqaErKeewYQzfkscGjCB FvUFZ3s157+ovInyY24QokQbrL34TKGI/0HpeJAMp0OwePf5BxqPTLbEmT981RRS36Z0 nLZid3NtiNzjT7fESw+GooleDTlf6iW7s8CgyqYD/GPemi+1LkW+VqxBbBdb/etXFCT1 rbsC8Y56RgbsWaYGq67ohXxQ/QkHZHbB07yEN5ie7Gh8J5Zxxbv93k2XU4lz4ltGmsRL tveQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tG2tePMmNduefnAziSSmvI1Rvq3RGtey3IRc275xPi4=; b=GsI12G4G9LyKRRiw8Ro3AJObqbp2QbOlBoAt7gdLASF9zo7W5vueTB5ec4tbGUvIs7 1plZmvHw+sjRoyJVpz2yiTkJN0tpldGtBwF3e7gNmZqvGrhD1nUPDsgJtus7AZ75YEg0 coBpileVmU3Y/smcX3Chr196h/3jMijtVURc2zKm8mS5Uo9NfDyO9FiQG2olIAsWc+0U mZmr5SpozWV4TY5lgByqpnKYmFwQINPU3HZxDCdd9ZSPbMsQTt6ym7J0hApyZB864HH0 b3Pe+s3V5GUA1yDdAJNHZqqz6gZxCLxB5UDY4tP5lN68o+l0COsclExFlvCuWwClhf3p qLWw== X-Gm-Message-State: AOAM532nnykLoUt6J6dsW70TWOHxV7VQTHJUfchH7tHNM767KXXyhtH9 YLmb4fKAYNJ2RDHV9wgndG9iThN4/m4NfptkAe+yg30Q X-Google-Smtp-Source: ABdhPJzK9W4FzkpEytZXW3irJsbLn8BaBGrKp6gHhYtRJC5bzQwuplziSVgsB5v7Tt38j3umjZ6aj1NqEGqP42MYe3g= X-Received: by 2002:a17:90a:5a86:: with SMTP id n6mr7304040pji.3.1631813602821; Thu, 16 Sep 2021 10:33:22 -0700 (PDT) MIME-Version: 1.0 References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> <87fsu4h2oa.fsf@gmail.com> <83wnng8mya.fsf@gnu.org> In-Reply-To: <83wnng8mya.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Thu, 16 Sep 2021 18:33:12 +0100 Message-ID: Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , Lars Ingebrigtsen , Alan Mackenzie , 50538@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, Sep 16, 2021 at 6:11 PM Eli Zaretskii wrote: > > > From: Jo=C3=A3o T=C3=A1vora > > Cc: Dmitry Gutov , Eli Zaretskii , Ji= m > > Porter , 50538@debbugs.gnu.org, Alan Mackenzi= e > > > > Date: Thu, 16 Sep 2021 18:04:53 +0100 > > > > Hope this helps. I'm sorry I can't offer any better solutions. > > Thanks, but I'm not sure I understand what is your opinion about the > proposed patch. Are you saying we shouldn't install it? That patch targets mainly cc-mode.el. To have an opinion would require me to understand it, interpret its meaning. That has many implications... I can't do that right now. I can confirm that the small change to electric-tests.el (which activates many tests for c-mode) is indeed the way I wrote those tests originally. Maybe Jim has found a silver bullet? Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 14:26:47 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 18:26:48 +0000 Received: from localhost ([127.0.0.1]:56527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQw5v-0002XD-M7 for submit@debbugs.gnu.org; Thu, 16 Sep 2021 14:26:47 -0400 Received: from colin.muc.de ([193.149.48.1]:20187 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mQw5r-0002Wr-M7 for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 14:26:46 -0400 Received: (qmail 15368 invoked by uid 3782); 16 Sep 2021 18:26:36 -0000 Received: from acm.muc.de (p4fe15a47.dip0.t-ipconnect.de [79.225.90.71]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 16 Sep 2021 20:26:36 +0200 Received: (qmail 9483 invoked by uid 1000); 16 Sep 2021 18:26:36 -0000 Date: Thu, 16 Sep 2021 18:26:36 +0000 To: Eli Zaretskii Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Message-ID: References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83k0jh9jn6.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , Lars Ingebrigtsen , 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Thu, Sep 16, 2021 at 08:25:33 +0300, Eli Zaretskii wrote: > > From: Jim Porter > > Cc: 50538@debbugs.gnu.org > > Date: Wed, 15 Sep 2021 15:17:23 -0700 > > On 9/11/2021 8:58 PM, Jim Porter wrote: > > > (Note: I've just updated my copyright assignment information, but > > > haven't received confirmation that everything is in order, so this might > > > need to wait until that's done for it to merge.) > > I've gotten confirmation that my copyright assignment info is all > > up-to-date, so once this patch passes muster, it should be ok to merge it. > Your copyright assignment is on file, so we are good in that > department. > > On 9/12/2021 11:05 AM, Jim Porter wrote: > > > Note however that this solution isn't perfect: it means a user's custom > > > `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's > > > default behavior, not less. I think that's a reasonable compromise > > > though, and users who want more direct control can set > > > `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A > > > "perfect" solution here would probably require adding new customization > > > points to `electric-pair-mode' (e.g. a way for major modes to override > > > how the syntax is analyzed), and I'm not sure the added complexity would > > > be worth it, especially since this code is already a bit tricky. > > I'm not sure if someone has a better idea for how to do things, but for > > my config[1], the patch works well and makes CC modes behave the same as > > other programming modes. In my opinion, the worst thing > > `electric-pair-mode' can do is to behave inconsistently, since that > > forces the user to pay close attention to something that should be > > almost invisible/automatic. > I don't use this minor mode, so I don't think my opinion on this > matters much. I will defer to Lars and Alan here. Thanks, I've downloaded the bug thread from debbugs, and I'll look at it. I don't actually use the minor mode either, but the patch is to do with C++ Mode. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 15:06:08 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 19:06:08 +0000 Received: from localhost ([127.0.0.1]:56579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQwhz-0003lV-9S for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:06:08 -0400 Received: from colin.muc.de ([193.149.48.1]:21250 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mQwhu-0003ku-Kb for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 15:06:06 -0400 Received: (qmail 41644 invoked by uid 3782); 16 Sep 2021 19:05:56 -0000 Received: from acm.muc.de (p4fe15a47.dip0.t-ipconnect.de [79.225.90.71]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 16 Sep 2021 21:05:56 +0200 Received: (qmail 9504 invoked by uid 1000); 16 Sep 2021 19:05:56 -0000 Date: Thu, 16 Sep 2021 19:05:56 +0000 To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Message-ID: References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> <87fsu4h2oa.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87fsu4h2oa.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , Lars Ingebrigtsen , Eli Zaretskii , 50538@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, João. On Thu, Sep 16, 2021 at 18:04:53 +0100, João Távora wrote: > Lars Ingebrigtsen writes: > > Dmitry Gutov writes: > >>>> I don't use this minor mode, so I don't think my opinion on this > >>>> matters much. I will defer to Lars and Alan here. > >>> I seldom use electric-pair-mode, and since this touches cc-mode, I'll > >>> defer to Alan.:-) > >>> Alan? > >> At risk of reigniting an old disagreement, perhaps we should ask Joao? > > Sure; added to the CCs. João, do you have an opinion here? > I couldn't understand the initial issue fully, but I can only confirm > that the relationship between cc-mode and electric-pair-mode has been > rocky. I think the situation is similar with electric-layout-mode and > with electric-indent-mode, to a certain degree (though I am not sure for > this last one). I think it is up to both of us to make this relationship less rocky. > I don't think there are any easy technical solutions for it. I certainly > cannot invest the effort in any of them right now. > It wasn't like this from the beginning: when I first created > electric-pair-mode it worked mostly if not fully fine with cc-mode, like > one expects e-p-m to work in other modes (ruby, python, js, elisp, rust, > perl, even non-programming modes). > At times, compatibility deteriorated as cc-mode added mechanisms for > solving electricity problems or related problems in an idiosyncratic > way. Sometimes these changes broke e-p-m's tests and the solution was > -- incorrectly in my view --to disable the tests "temporarily". I see > that for one of them at least, the test has been re-instated. A good > sign, maybe. > Regardless of history and current state of affairs, my personal solution > to C in Emacs is to use a hand-rolled mode, a so-called plainer-cc-mode. > The goal is to make it behave like most other modes w.r.t > electric-pair-mode and keep the basic c syntax and indentation. I've > used it reasonably successfully with C and C++. Here it is in its > entirety. I think I use something similar for c++-mode. > (define-derived-mode plainer-c-mode c-mode "pC" > "A plainer C-mode with no internal electric machinery." > (c-toggle-electric-state -1) > (setq-local electric-indent-local-mode-hook nil) > (setq-local electric-indent-mode-hook nil) > (electric-indent-local-mode 1) > (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\])) > (local-set-key (vector key) 'self-insert-command))) > Among other simpler things, this makes the major mode not bind special > keys to special commands. They are all bound to `self-insert-command` > like most major modes. This simplifies electric-pair-mode, as far as I > remember. > The above is a hack, but not very dirty one. The one below much more so. > It's a brute-force hack for solving electricity problems. It simply > disables some cc internal functions. May be out of date by now, YMMV, > warranty void, etc, as they say. > (defun joaot/disable-some-cc-things () > (interactive) > (dolist (name '(c-restore-string-fences > c-remove-string-fences > c-before-change-check-unbalanced-strings > c-after-change-mark-abnormal-strings > c-after-change-escape-NL-in-string)) > (advice-add name :override #'ignore '((name . joaot/remove-disable-some-cc-things))) > (add-hook 'c-mode-common-hook > (lambda () > (kill-local-variable 'electric-pair-inhibit-predicate))))) Needless to say, my point of view with respect to the above is somewhat different. Succinctly put, the minor modes electric-.... are MINOR modes, and are quite new. They were implemented in a way which interfered with major modes, and I can't see there was any need for this. In particular, they interfered with CC Mode features which had existed for 20 years at the time. > On the C++/C editing-front, I am eagerly waiting for Treesitter to > arrive so that is it becomes possible to write a new major mode for c++ > and c from scratch. I am also looking forward to Treesitter, though I think starting a new C++ Mode from scratch would not be a good use of time, and would be needlessly disruptive for current CC Mode users. > Reusing solid and efficient parsing logic based on language grammars. > Another more closely available option, is to simply use LSP for > indentation and fontification. Though that is almost certainly slower > and less confortable/portable/etc... Anyway, whatever the solution, > I'm quite confident that such a mode won't have these characteristics > that cc-mode has when used with `electric-pair-mode`. > If you're writing C, and not C++, my also try Stefan Monnier's aptly > named sm-c-mode, installable via M-x package-install RET sm-c-mode. > Works fine with electric-pair-mode, but seems to indent very oddly for > some reason. I would rather suggest using straight C Mode, which works and works well. If there are incompatibilities between CC Mode and electric-pair-mode, and it seems there are, let's get these fixed. > Hope this helps. I'm sorry I can't offer any better solutions. Could you please express your expert view? In Jim's opening post he implies that: (i) electric-pair-mode should be active inside comments. (ii) In some circumstances at least, typing a " immediately in front of another " causes two "s to be inserted. Are these circumstances spelt out anywhere? (iii) Typing a " inside a string causes two "s to be inserted, leaving point between the two new adjacent strings formed. This feature is not intended to work in C++ raw strings, or other similar multi-line strings in other CC Mode modes. Are these three features all intended in electric-pair-mode? Thanks! > João -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 16:49:36 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 20:49:36 +0000 Received: from localhost ([127.0.0.1]:56713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQyK8-00071L-8t for submit@debbugs.gnu.org; Thu, 16 Sep 2021 16:49:36 -0400 Received: from colin.muc.de ([193.149.48.1]:23990 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mQyJz-00070s-QZ for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 16:49:34 -0400 Received: (qmail 9023 invoked by uid 3782); 16 Sep 2021 20:49:20 -0000 Received: from acm.muc.de (p4fe15a47.dip0.t-ipconnect.de [79.225.90.71]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 16 Sep 2021 22:49:20 +0200 Received: (qmail 9539 invoked by uid 1000); 16 Sep 2021 20:49:20 -0000 Date: Thu, 16 Sep 2021 20:49:20 +0000 To: Jim Porter Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Message-ID: References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: acm@muc.de, Eli Zaretskii , 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Jim. On Sun, Sep 12, 2021 at 11:05:17 -0700, Jim Porter wrote: > On 9/11/2021 11:26 PM, Eli Zaretskii wrote: > >> From: Jim Porter > >> Date: Sat, 11 Sep 2021 20:58:47 -0700 > >> There are a few related issues with pairing double quotes in CC mode > >> while using `electric-pair-mode'. Hopefully the steps to reproduce below > >> will explain the issues. In all the cases, I'd expect > >> `electric-pair-mode' to insert a closing quote, but it doesn't. OK. Just for context, I'm the maintainer of CC Mode, but I don't use electric-pair-mode in my day-to-day editing. > > Your expected results seem to expect Emacs to assume that a new string > > will be inserted, but is that an assumption that is always true? > In these cases, I believe that's true (with the default > `electric-pair-mode' settings, that is). More broadly, the goal of the > patch is to ensure that pairing of double quotes works the same in CC > mode as it does in other modes (`ruby-mode', `python-mode', `js-mode', > `emacs-lisp-mode', etc), which is why I added `c-mode' to the list of > modes to test in `test/lisp/electric-tests.el'. The goal should be to make all these modes work correctly with respect to e-p-m, for whatever value of correctly we decide upon. > That said, there's one potential case I didn't account for (mostly > because it wasn't accounted for in the patch for bug#36474): if a user > customizes `electric-pair-inhibit-predicate' to inhibit cases like (2) > or (3) in my original message, that won't work right in CC modes, since > the default value of `electric-pair-inhibit-predicate' (set by the user) > won't be called. > Attached is an updated patch that changes the logic of > `c-electric-pair-inhibit-predicate' to either a) inhibit insertion of > the closing quote, or b) call the default-value of > `electric-pair-inhibit-predicate' to determine what to do. This should > give users more consistent behavior when customizing > `electric-pair-inhibit-predicate'. There were two or three minor problems with the patch: 1-/. CC Mode doesn't use syntax-ppss at all. This was because way back when, syntax-ppss was buggy, and even now doesn't do the right thing for CC Mode in some edge cases (e.g. with the buffer narrowed and point-min inside a string or comment). Instead it uses its own internal syntactic cacheing, largely centred around the function c-semi-pp-to-literal. 2/- Rather than using get-text-property and friends directly, CC Mode uses the macros c-get-char-property, etc. This is (?was) to maintain compatibility with XEmacs. 3/- (A bit more serious) The patch looks for the last " in the current line without taking account of any escaped new lines. There is already a CC Mode macro which does all the work here, c-point, which can be given the argument 'eoll for "end of logical line". Incorporating all these points into the macro (which I admit I haven't tested) the function would look something like this: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Connection with Emacs's electric-pair-mode (defun c-electric-pair-inhibit-predicate (char) "Return t to inhibit the insertion of a second copy of CHAR. At the time of call, point is just after the newly inserted CHAR. When CHAR is \" and not within a comment, t will be returned if the quotes on the current line are already balanced (i.e. if the last \" is not marked with a string fence syntax-table text property). For other cases, the default value of `electric-pair-inhibit-predicate' is called and its value returned. This function is the appropriate value of `electric-pair-inhibit-predicate' for CC Mode modes, which mark invalid strings with such a syntax table text property on the opening \" and the next unescaped end of line." (or (and (eq char ?\") (not (memq (cadr (c-semi-pp-to-literal (1- (point)))) '(c c++))) (not (equal (c-get-char-property (c-point 'eoll) 'c-fl-syn-tab) '(15)))) (funcall (default-value 'electric-pair-inhibit-predicate) char))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > The tests still pass, although I wasn't able to figure out a good way to > add a test for setting `electric-pair-inhibit-predicate' that works with > how CC mode overrides it (using `:bindings' in > `define-electric-pair-test' didn't work, since the binding is set too > late). Hopefully that's ok; if not, I can try and see about making some > more extensive changes to the tests to account for this. > Note however that this solution isn't perfect: it means a user's custom > `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's > default behavior, not less. I think that's a reasonable compromise > though, and users who want more direct control can set > `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A > "perfect" solution here would probably require adding new customization > points to `electric-pair-mode' (e.g. a way for major modes to override > how the syntax is analyzed), and I'm not sure the added complexity would > be worth it, especially since this code is already a bit tricky. Indeed so. ;-) -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 16:51:25 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 20:51:25 +0000 Received: from localhost ([127.0.0.1]:56717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQyLs-00074z-SJ for submit@debbugs.gnu.org; Thu, 16 Sep 2021 16:51:25 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]:42989) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQyLq-00074h-My for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 16:51:23 -0400 Received: by mail-wm1-f48.google.com with SMTP id u19-20020a7bc053000000b002f8d045b2caso5466249wmc.1 for <50538@debbugs.gnu.org>; Thu, 16 Sep 2021 13:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=FtmTkl6EjiY8YyXCrD0hRCU7wOdw2Zj0cbggJeuvwkE=; b=MNUseeuD4vFvH8/0SbfXS8Ak4fdnEoKKv1UELhiA93z6Fc0edDEbrAYh0IReIBiSJE iqTmFzNF37L4SGdp1VoauERN8Jr/+kH4LMOACNP825nco2DsX7WFnqSq7u+UCOIm0naW 4+CTte/wARd9M9R6VC4X+3ERp6szIK6yqq7WqwUCSj4uzRwzRi4t91UwBpiew2gyEvsE 3Pb50Yx1Bh//2bJ39MfI46FaAs8bP8Zavmp/QmiEOwlan/3UOlpnHQcEQ+yUeFqgNIT9 lYN9X8OIIvl4+IwPZwEcoxmet3jXWkeoQI0Q886nP6bBZmM2IsYMJT1mOJmY8hvYNH2f AVGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=FtmTkl6EjiY8YyXCrD0hRCU7wOdw2Zj0cbggJeuvwkE=; b=doeI0lQnE6CQv4rgDs9c1fgU00ZrDIVxDIF/ckaTTq4ibTjLV5uR65lMBCgOoxgg4u EipUfHRFisIcv0vLj51z/k0E/Tjjbl5h+j00XTO71lszDs0vj3qNdfemAo7PvTnWDSBW 74jBiQGmK7QSul9Hl4JLRMhT6rlEfniGLFRIEjWurLmWkfSd15KRI6o4hdfTmIWGMsTx 1xqyCpNdQlccegDA5LIcIoLQV3ujp4uxenWWy1qEjooyJ/9aRJcgykaDPmLtusKtJYnC k6Pz0jGJh7V5Er+yIKK6hSqsq6jtGLpufgEVQ7aaP3+uZq1mxBGXa0sldoUnsMtQ3G/o F+WQ== X-Gm-Message-State: AOAM533FWRSg+KVc+v/XleMHt5tLfxGl2Vy1vOdHvmAp4oZbiyE/7wAL VdZ+6UXlqYMONbAKG34Sf0+H+04ud7A= X-Google-Smtp-Source: ABdhPJwsJSXofK3u21tQ3BG8NQZ6bmH1ZZub6QyuTaRHbuTrg7eK09ISo3hn8PQhw2+dKCVMT/YBJw== X-Received: by 2002:a1c:4d7:: with SMTP id 206mr11972269wme.158.1631825476241; Thu, 16 Sep 2021 13:51:16 -0700 (PDT) Received: from krug (a83-132-177-247.cpe.netcabo.pt. [83.132.177.247]) by smtp.gmail.com with ESMTPSA id r2sm4841063wrg.31.2021.09.16.13.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 13:51:15 -0700 (PDT) From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Alan Mackenzie Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> <87fsu4h2oa.fsf@gmail.com> Date: Thu, 16 Sep 2021 21:51:13 +0100 In-Reply-To: (Alan Mackenzie's message of "Thu, 16 Sep 2021 19:05:56 +0000") Message-ID: <87czp8fdmm.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , Lars Ingebrigtsen , Eli Zaretskii , 50538@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Alan, [I apologize in advance for any spelling mistakes, my spell checker has taken a vacation in this new operating system.] Alan Mackenzie writes: > I think it is up to both of us to make this relationship less rocky. Agreed. But I'm afraid I don't have much to add the discussion. I've made all my points. And so have you. I understand, though I respectfully disagree with your standpoint. And so do you, I hope. I have, in a way, given up on this integration. electric-pair-mode doesn't support cc-mode or any more directly derived from it "officially". That harmony ended in Emacs 25.x, I believe (might have been 26.x). After that, you may have some success with it, or you may not. >> (add-hook 'c-mode-common-hook >> (lambda () >> (kill-local-variable 'electric-pair-inhibit-predicate= ))))) > > Needless to say, my point of view with respect to the above is somewhat > different. Succinctly put, the minor modes electric-.... are MINOR > modes, and are quite new. > In particular, they interfered with CC Mode features which had existed > for 20 years at the time. My belief is that the term "minor" (which you so emphasize) in the name "minor-mode" doesn't mean "less important" in any way. In my view, it means merely "transversal". You've often pitched e-p-m and cc-mode against each other in terms of their relative ages, implying a hierarchy of importance, deference or prestige. My belief is that this is unproductive. Emacs minor modes, old or new, are not less or more important. All other things being equal, they don't deserve less or more care and attention than Major or "old" modes. The only criteria to motivate a change is technical. > modes, and are quite new. They were implemented in a way which > interfered with major modes, You mention "major modes" in the plural form, but it is fair for me to point out that only sub-modes of the cc-mode which you command entirely are in that set. If I'm forgetting any others, you're welcome to refresh my memory. > and I can't see there was any need for this. I hope you will first notice I didn't adjectify or make any value judgement on the motivation, necessity or pertinence of your work in CC mode. Therefore, I would appreciate if you could return the courtesy. If you can't personally "see" the need for my work or how it was performed, that's fine. I don't demand that you do, though I have gone to some lengths in the past to inform you of the motivation. But that isn't the same as there not being a such a need, or that I worked spuriously, gratutiously or recklessly or with the intent to interfere with anything. In fact, the Git log and users memory records clearly that when e-p-m was first introduced in Emacs, it worked harmoniously with cc-mode for a number of years until cc-mode was modified by you to change that harmony. Moreover, as far as I gather, electric-pair-mode is a fairly popular minor mode, so at least some significant group of people adhere to the same need that I saw. Even e-p-m's now abandoned predecessor, "autopair"[1], is still fairly popular today. Before archiving it some time ago, I was still seeing healthy download counts. See also [2] for some Emacswiki user's (not me) account of the history and relationship between autopair, e-p-m and other autopairing solutions for Emacs. Now, to practical matters: * If CC-mode users agree with you about the absence of a need for such a thing as e-p-m, they may simply not turn it on (same goes for electric-layout-mode and electric-foo-mode I suppose). I believe you yourself and Eli are in this group. * If CC-mode users disagree with you, they must find some alternative to CC-mode that lets them confortably turn on those modes there. My two self-described hacks are such alternatives. Not ideal ones, but reasonably workable. As a user, I chose the latter option. I look forward to a different Major mode for editing C/CC code. That is my personal ambition as a user. As a developer, changing electric-pair-mode's core principles that work harmoniously (if not downright flawlessly) for any other major mode not based on cc-mode is not on the table. >> On the C++/C editing-front, I am eagerly waiting for Treesitter to >> arrive so that is it becomes possible to write a new major mode for c++ >> and c from scratch. > > I am also looking forward to Treesitter, though I think starting a new > C++ Mode from scratch would not be a good use of time, and would be > needlessly disruptive for current CC Mode users. I certainly didn't want to imply it would be _your_ time. I believe what other people do with the time they generously offer us is their business. Certainly, I wouldn't dream of implying that the features you're adding to cc-mode's ever-growing code base are not a good use of your time. Furthermore, I think Emacs is fertile in alternative ways to solve similar problems. I know others disagree, but I think this is a quality. > Could you please express your expert view? In Jim's opening post he > implies that: > (i) electric-pair-mode should be active inside comments. > (ii) In some circumstances at least, typing a " immediately in front > of another " causes two "s to be inserted. Are these circumstances > spelt out anywhere? > (iii) Typing a " inside a string causes two "s to be inserted, leaving > point between the two new adjacent strings formed. This feature is > not intended to work in C++ raw strings, or other similar multi-line > strings in other CC Mode modes. > Are these three features all intended in electric-pair-mode? (i) Yes. Much as syntax tables and C-M-f , C-M-b, C-M-u, etc. navigation work is comments, so does e-p-m. (ii) As you well note, it depends on the circumstances. The circumstances are well spelt out in the tests. I can name one here. If you have the buffer with contents "hello" And you type a double quote at buffer ends, you get "hello""" This example was taken from one of the tests of the group 'pair-some-quotes-skip-others', found in electric-tests.el, as I think you know. As I think you also know, the principle of 'electric-pair-preserve-balance' stipulates that 'electric-pair-mode' will only make 'self-insert-command' do "suprising electric behaviour" -- insert two delimiters or skip one -- if that action helps keep or improve the balance of said delimiter in the buffer. Therefore, if you find a circumstance where e-p-m inserts two quotes and that happens to _worsen_ the balancing of the buffer (i.e. creates an unterminated string somewhere where previously there wasn't), then you have found a bug in e-p-m. In that case, please describe it clearly as a bug report. However, and very importantly, you must find this circumstance in any major mode _other_ than cc-mode. Because -- as I've tried to make clear -- "all bets are off in cc-mode", so to speak. So if you are finding this misbehaviour in e-p-m _in conjunction with cc-mode_, I wouldn't bother reporting it. We've established that the solution that I would propose to you is very likely not going to appeal to you. (iii) Yes. That is the way that e-p-m always worked. By behaving so, the balancing state of the buffer is preseved. Some packages, (like smartparens [3], I believe) will insert a single quote preceded by an escape character. That action also keeps the balance. Perhaps e-p-m could accomodate this behaviour from smartparens. If some users would like it, I think it can be easily done. Best regards, Jo=C3=A3o [1]: https://github.com/joaotavora/autopair/ [2]: https://www.emacswiki.org/emacs/AutoPairs [3]: https://github.com/Fuco1/smartparens From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 17:36:17 2021 Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 21:36:17 +0000 Received: from localhost ([127.0.0.1]:56746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQz3J-0008O0-7b for submit@debbugs.gnu.org; Thu, 16 Sep 2021 17:36:17 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:33298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQz3G-0008Nf-5t for 50538@debbugs.gnu.org; Thu, 16 Sep 2021 17:36:15 -0400 Received: by mail-pl1-f180.google.com with SMTP id t4so4824746plo.0 for <50538@debbugs.gnu.org>; Thu, 16 Sep 2021 14:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language; bh=GcXevKWji7YMKsLJUWZwOwiGgpQtNPT2iTGbbq6MGes=; b=HYdSDLyhb7bqSKYmj0BrB3uP2flag7eqPt78xodSpOzbPxSeuBc8ThTzeImYEAGNdT xOSU52UIdJopKFC610v2G2FNR9TtcuN6BNQwRXjBS4gvLIqQvF/XrdohI/YmLEBrAMWJ LShM+0+0yRBE+kwViqhLdGqsDdLHuDm0WTXZ85BT2zqsTs2w7vqSIOsI4wcV81d6qnuG VPrh1qeLWWW/Tlr8JWEK5MNYLu61K+yjzMZbc5/463QKkVfxvSPqO8Bjvjed1xlwAKyb znCeGAfmtoFKMZkGYFwvRVXfZsczZAK2JkMCkzWliCWEmI2c3DtfOkUxHqpmV7b1F0o9 QY8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language; bh=GcXevKWji7YMKsLJUWZwOwiGgpQtNPT2iTGbbq6MGes=; b=BmB99wX1AawebtRW0+58Ib0v7637y6a39Bgr94/Iu4Kk3ItpP0j8hpqUhUkxlD8NVo mqAOWS+Pik+MkjUjVowEzPUtGrJde6bwUyasbwn6WBWLpXHyFuYdF/js2LWt3PvXzFnV TZMoGxbipotA1jVqgdiHMXUFe0J+p7A/u33IV2GRKSYwaL+c3sSKS/wEutfj10vzAdVt OxRhOtAWX5wmWvgcq++RyraO/7Due2aIdXNWZynajxJS2EX9wQgh0GCd2oRoNy0bA+Hi B14F3S6FFT0FSDAuc35pFkdln0gDxUnHOwxJ50ECqVAO6WgHSk9tkjOZRBFf4d9ZTPNQ UqDw== X-Gm-Message-State: AOAM533m3CZcX/HTEpMEHUPmUO6wCGCabegKbTdgp72oz8Rkidf4UmSR ec1X2YTegT50j6vhKvbNWM4dL4AsKv4= X-Google-Smtp-Source: ABdhPJxvo5QOrdXoLvsqTc+whpBj/3HXyOMnw3jW/mBlOz+F6YCOnGmdml1KneVpZzIOGYPp0hYeGg== X-Received: by 2002:a17:902:8488:b029:129:97e8:16e7 with SMTP id c8-20020a1709028488b029012997e816e7mr6495109plo.39.1631828168108; Thu, 16 Sep 2021 14:36:08 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id u9sm4141015pgp.83.2021.09.16.14.36.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 14:36:07 -0700 (PDT) Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: Alan Mackenzie References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> From: Jim Porter Message-ID: <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> Date: Thu, 16 Sep 2021 14:36:06 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------2078361F0C2C0B09047F0A56" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------2078361F0C2C0B09047F0A56 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/16/2021 1:49 PM, Alan Mackenzie wrote: > There were two or three minor problems with the patch: > > 1-/. CC Mode doesn't use syntax-ppss at all. This was because way back > when, syntax-ppss was buggy, and even now doesn't do the right thing for > CC Mode in some edge cases (e.g. with the buffer narrowed and point-min > inside a string or comment). Instead it uses its own internal syntactic > cacheing, largely centred around the function c-semi-pp-to-literal. > > 2/- Rather than using get-text-property and friends directly, CC Mode > uses the macros c-get-char-property, etc. This is (?was) to maintain > compatibility with XEmacs. > > 3/- (A bit more serious) The patch looks for the last " in the current > line without taking account of any escaped new lines. There is already > a CC Mode macro which does all the work here, c-point, which can be given > the argument 'eoll for "end of logical line". Thanks, I've incorporated all these changes into the attached patch. The only difference between my patch and the version you provided was to keep the `(search-backward "\"")' portion from my patch, since the code needs to find the last double-quote, not the end of line. As an aside, it's probably worth explaining why my patch searches for the last double-quote in the first place. As far as I understand CC Mode, when there's an unterminated double-quote on a line, both the quote and the newline have a string fence property applied to them. This means we could check the newline for that property, *but* there's no guarantee a newline actually exists: `(c-point 'eoll)' could actually point to the end of the buffer. To get around that, we search backwards for the last double-quote of the (logical) line, since that's guaranteed to exist. If we wanted to, we could avoid searching backwards for the last double-quote when a newline exists, but I'm not sure the gain in performance (likely very small) is worth the extra code complexity. --------------2078361F0C2C0B09047F0A56 Content-Type: text/plain; charset=UTF-8; name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" RnJvbSA0NzU5ZWQwYzhmYTdmYThmYWZkNDdkMTY2YjNmMTI2ZTYwNmZmZTg0IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFRodSwgMTYgU2VwIDIwMjEgMTQ6MzI6MTcgLTA3MDAKU3ViamVjdDogW1BB VENIXSBJbXByb3ZlIGJlaGF2aW9yIG9mICdlbGVjdHJpYy1wYWlyLW1vZGUnIGluICdjYy1t b2RlJwoKVGhpcyBlbnN1cmVzIHRoYXQg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OSBAQAogKHJlcXVp cmUgJ2VsZWMtcGFpcikKIChyZXF1aXJlICdjbC1saWIpCiAKKzs7IFdoZW4gcnVubmluZyB0 ZXN0cyBpbiBjLW1vZGUsIHVzZSBzaW5nbGUtbGluZSBjb21tZW50cyAoLy8pLgorKGFkZC1o b29rICdjLW1vZGUtaG9vayAobGFtYmRhICgpIChjLXRvZ2dsZS1jb21tZW50LXN0eWxlIC0x KSkpCisKIChkZWZ1biBjYWxsLXdpdGgtc2F2ZWQtZWxlY3RyaWMtbW9kZXMgKGZuKQogICAo bGV0ICgoc2F2ZWQtZWxlY3RyaWMgKGlmIGVsZWN0cmljLXBhaXItbW9kZSAxIC0xKSkKICAg ICAgICAgKHNhdmVkLWxheW91dCAoaWYgZWxlY3RyaWMtbGF5b3V0LW1vZGUgMSAtMSkpCkBA IC0xNzMsNyArMTc2LDcgQEAgZGVmaW5lLWVsZWN0cmljLXBhaXItdGVzdAogICAgICAgICAg IGV4cGVjdGVkLXN0cmluZwogICAgICAgICAgIGV4cGVjdGVkLXBvaW50CiAgICAgICAgICAg YmluZGluZ3MKLSAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpzLW1vZGUp KSkKKyAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpzLW1vZGUgYy1tb2Rl KSkpCiAgICAgICAgICAgKHRlc3QtaW4tY29tbWVudHMgdCkKICAgICAgICAgICAodGVzdC1p bi1zdHJpbmdzIHQpCiAgICAgICAgICAgKHRlc3QtaW4tY29kZSB0KQotLSAKMi4yNS4xCgo= --------------2078361F0C2C0B09047F0A56-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 17 13:08:45 2021 Received: (at 50538) by debbugs.gnu.org; 17 Sep 2021 17:08:46 +0000 Received: from localhost ([127.0.0.1]:32907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRHLx-0005Y6-L5 for submit@debbugs.gnu.org; Fri, 17 Sep 2021 13:08:45 -0400 Received: from colin.muc.de ([193.149.48.1]:55456 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mRHLt-0005Xp-3s for 50538@debbugs.gnu.org; Fri, 17 Sep 2021 13:08:43 -0400 Received: (qmail 32555 invoked by uid 3782); 17 Sep 2021 17:08:34 -0000 Received: from acm.muc.de (p4fe159e7.dip0.t-ipconnect.de [79.225.89.231]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 17 Sep 2021 19:08:34 +0200 Received: (qmail 7811 invoked by uid 1000); 17 Sep 2021 17:08:33 -0000 Date: Fri, 17 Sep 2021 17:08:33 +0000 To: Jim Porter Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Message-ID: References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Jim. On Thu, Sep 16, 2021 at 14:36:06 -0700, Jim Porter wrote: > On 9/16/2021 1:49 PM, Alan Mackenzie wrote: > > There were two or three minor problems with the patch: > > 1-/. CC Mode doesn't use syntax-ppss at all. This was because way back > > when, syntax-ppss was buggy, and even now doesn't do the right thing for > > CC Mode in some edge cases (e.g. with the buffer narrowed and point-min > > inside a string or comment). Instead it uses its own internal syntactic > > cacheing, largely centred around the function c-semi-pp-to-literal. > > 2/- Rather than using get-text-property and friends directly, CC Mode > > uses the macros c-get-char-property, etc. This is (?was) to maintain > > compatibility with XEmacs. > > 3/- (A bit more serious) The patch looks for the last " in the current > > line without taking account of any escaped new lines. There is already > > a CC Mode macro which does all the work here, c-point, which can be given > > the argument 'eoll for "end of logical line". > Thanks, I've incorporated all these changes into the attached patch. The > only difference between my patch and the version you provided was to > keep the `(search-backward "\"")' portion from my patch, since the code > needs to find the last double-quote, not the end of line. Duh! Sorry about that, I clean forgot about it. I did say that I hadn't tested it, though. ;-) > As an aside, it's probably worth explaining why my patch searches for > the last double-quote in the first place. As far as I understand CC > Mode, when there's an unterminated double-quote on a line, both the > quote and the newline have a string fence property applied to them. Yes. > This means we could check the newline for that property, *but* there's > no guarantee a newline actually exists: `(c-point 'eoll)' could > actually point to the end of the buffer. To get around that, we search > backwards for the last double-quote of the (logical) line, since > that's guaranteed to exist. Yes. This is a very important case, the one that occurs when somebody's typing a new file, or at the end of an existing one. > If we wanted to, we could avoid searching backwards for the last > double-quote when a newline exists, but I'm not sure the gain in > performance (likely very small) is worth the extra code complexity. I'm fairly sure it wouldn't be. [ Patch snipped but read. ] -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 17 14:13:07 2021 Received: (at 50538) by debbugs.gnu.org; 17 Sep 2021 18:13:07 +0000 Received: from localhost ([127.0.0.1]:32969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRIMF-0000pH-1z for submit@debbugs.gnu.org; Fri, 17 Sep 2021 14:13:07 -0400 Received: from colin.muc.de ([193.149.48.1]:57243 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mRIMD-0000of-04 for 50538@debbugs.gnu.org; Fri, 17 Sep 2021 14:13:06 -0400 Received: (qmail 74909 invoked by uid 3782); 17 Sep 2021 18:12:58 -0000 Received: from acm.muc.de (p4fe159e7.dip0.t-ipconnect.de [79.225.89.231]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 17 Sep 2021 20:12:57 +0200 Received: (qmail 8001 invoked by uid 1000); 17 Sep 2021 18:12:57 -0000 Date: Fri, 17 Sep 2021 18:12:57 +0000 To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Message-ID: References: <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <716194ea-817f-eaad-f9ce-7d600ad359b1@gmail.com> <83k0jh9jn6.fsf@gnu.org> <87o88s3d87.fsf@gnus.org> <871r5o3biv.fsf@gnus.org> <87fsu4h2oa.fsf@gmail.com> <87czp8fdmm.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87czp8fdmm.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: Jim Porter , 50538@debbugs.gnu.org, Dmitry Gutov , acm@muc.de, Lars Ingebrigtsen , Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, João. On Thu, Sep 16, 2021 at 21:51:13 +0100, João Távora wrote: > Hello Alan, > [I apologize in advance for any spelling mistakes, my spell checker has > taken a vacation in this new operating system.] > Alan Mackenzie writes: > > I think it is up to both of us to make this relationship less rocky. > Agreed. But I'm afraid I don't have much to add the discussion. I've > made all my points. And so have you. I was thinking more along the lines of coding, not discussion. > I understand, though I respectfully disagree with your standpoint. > And so do you, I hope. I have, in a way, given up on this > integration. electric-pair-mode doesn't support cc-mode or any more > directly derived from it "officially". That harmony ended in Emacs > 25.x, I believe (might have been 26.x). After that, you may have some > success with it, or you may not. Why such a negative attitude? CC Mode is an important package, and so is electric-pair-mode. There doesn't seem to be any intrinsic reason why they shouldn't work together better. > >> (add-hook 'c-mode-common-hook > >> (lambda () > >> (kill-local-variable 'electric-pair-inhibit-predicate))))) > > Needless to say, my point of view with respect to the above is somewhat > > different. Succinctly put, the minor modes electric-.... are MINOR > > modes, and are quite new. > > In particular, they interfered with CC Mode features which had existed > > for 20 years at the time. > My belief is that the term "minor" (which you so emphasize) in the name > "minor-mode" doesn't mean "less important" in any way. No, that's not how I meant it. It's more that the layout of the text on the screen, and the process of changing it ARE the major mode. Any interference with the major mode in its primary role is a buggy situation needing fixing. > In my view, it means merely "transversal". You've often pitched e-p-m > and cc-mode against each other in terms of their relative ages, > implying a hierarchy of importance, deference or prestige. More a regret that when the electric-... modes were developed, they paid no attention to CC Mode, even when the feature originated there. This was bound to lead to conflict sooner or later, and that is where we are at now. > My belief is that this is unproductive. Emacs minor modes, old or > new, are not less or more important. All other things being equal, > they don't deserve less or more care and attention than Major or "old" > modes. The only criteria to motivate a change is technical. Right now, CC Mode binds post-self-insert-hook to nil when calling self-insert-function, so as to get it functioning predictably, then attempts to compensate later by calling e.g. electric-pair-post-self-insert-function directly. I think you'll agree with me this is suboptimal. I can't see any way of getting around it without amendments to electric-pair-mode. > > modes, and are quite new. They were implemented in a way which > > interfered with major modes, [ .... ] > > and I can't see there was any need for this. > I hope you will first notice I didn't adjectify or make any value > judgement on the motivation, necessity or pertinence of your work in CC > mode. You seem to me to be doing exactly this by declining to work to improve the interface between CC Mode and e-p-m. > Therefore, I would appreciate if you could return the courtesy. If > you can't personally "see" the need for my work or how it was > performed, that's fine. I can. I can also see problems with it, and regret your very negative attitude towards fixing problems in your own area of speciality. CC Mode has existed in one form or another for around 40 years. I think it would be reasonable for a new minor mode to take due account of it when being developed. As far as I can see, this didn't happen with electric-pair-mode to a sufficient degree. > I don't demand that you do, though I have gone to some lengths in the > past to inform you of the motivation. But that isn't the same as > there not being a such a need, or that I worked spuriously, > gratutiously or recklessly or with the intent to interfere with > anything. I am not implying such, and don't believe I ever have done. > In fact, the Git log and users memory records clearly that when e-p-m > was first introduced in Emacs, it worked harmoniously with cc-mode for > a number of years until cc-mode was modified by you to change that > harmony. The use of post-self-insert-hook to make buffer changes has never worked well with CC Mode. It cannot work in any major mode which uses self-insert-command as part of a mode command. You seem to be implying that my motivation in developing CC Mode was to damage the workings of e-p-m. I think that's somewhat uncalled for. CC Mode is under continual development, and has traditionally been at the forefront of new techniques. Electric indentation, subword mode, and the correct fontification of unterminated strings are just three examples of this. When you drew attention to problems, I put considerable effort into fixing and ameliorating these in CC Mode. > Moreover, as far as I gather, electric-pair-mode is a fairly popular > minor mode, so at least some significant group of people adhere to the > same need that I saw. Even e-p-m's now abandoned predecessor, > "autopair"[1], is still fairly popular today. Before archiving it some > time ago, I was still seeing healthy download counts. See also [2] for > some Emacswiki user's (not me) account of the history and relationship > between autopair, e-p-m and other autopairing solutions for Emacs. Yes, CC Mode and e-p-m are both popular and important. They don't work well enough together. > Now, to practical matters: > * If CC-mode users agree with you about the absence of a need for such a > thing as e-p-m, they may simply not turn it on (same goes for > electric-layout-mode and electric-foo-mode I suppose). I believe you > yourself and Eli are in this group. I'm not in such a group. I accept the need for e-p-m. I just don't want to use it myself. > * If CC-mode users disagree with you, they must find some alternative to > CC-mode that lets them confortably turn on those modes there. My two > self-described hacks are such alternatives. Not ideal ones, but > reasonably workable. Why don't you put some work in to make e-p-m work better with CC Mode? Maybe I'm misremembering here, but when the problems raised themselves I don't recall you making, or being prepared to make any amendments to electric-pair-mode. Why not? > As a user, I chose the latter option. I look forward to a different > Major mode for editing C/CC code. That is my personal ambition as a > user. You might have a long wait. And people who run from things because they don't like them often don't like what they find instead, either. Are you saying that your aim is to _prevent_ e-p-m working well with CC Mode? > As a developer, changing electric-pair-mode's core principles that work > harmoniously (if not downright flawlessly) for any other major mode not > based on cc-mode is not on the table. That's a bit callous, isn't it? CC Mode is a highly important part of Emacs, and you're deliberately not catering to it? Why? Why not amend e-p-m so that it will work harmoniously with _any_ major mode, not just the simple ones? Where's the difficulty? [ .... ] [ Details of particulars of electric-pair-mode operation read with thanks. ] > Best regards, > João -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 22:01:21 2021 Received: (at 50538) by debbugs.gnu.org; 23 Sep 2021 02:01:22 +0000 Received: from localhost ([127.0.0.1]:52275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTE37-0008Mr-Hu for submit@debbugs.gnu.org; Wed, 22 Sep 2021 22:01:21 -0400 Received: from mail-pj1-f44.google.com ([209.85.216.44]:55287) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTE34-0008MV-O5 for 50538@debbugs.gnu.org; Wed, 22 Sep 2021 22:01:20 -0400 Received: by mail-pj1-f44.google.com with SMTP id me1so3371769pjb.4 for <50538@debbugs.gnu.org>; Wed, 22 Sep 2021 19:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language; bh=v0SBj8Kd3PNlEPLsezsCpExlf7YCN5SeidW80aLmGNQ=; b=mGbeM+nTBdNpEBurBS2nmKGBAL8M7ATF9Rs5xwPIoqwho9G2SvJ81tgK31MEo+vIgf 0Y2P6fR8Vp14GCA6TMdcwg/yC8MvoZqLA1lhz6fuK3MRGZyqUYjlHTa7qpTVCPSLfQyH 3j3q3QfvVboyY2Yz08w3y3tsZNFl12WUkL3Nq4EAbnLSMpmq41588krhy8gMFM9IJXlZ iT5p4HmqTk8lbdbGvUCMWMXfKrAGLf800/F/nlVJRU5Srkq9mN0OmiNU/lCpyqx1YoXZ ACv3Ao8b7jLYMGm7AfLrrs+45neAHMIrGr+2gtRZ7cVstsdPCY0hDy9E4e2mQKzZvkvt B9+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language; bh=v0SBj8Kd3PNlEPLsezsCpExlf7YCN5SeidW80aLmGNQ=; b=ZU3MKbvMvcqugeQz8TSYY8h5YLqCH9JZcc5BUCz5KHRWBEzAatpvZW0skuiGBj+qqq rfVdzXXY0XIA+gjewcbOWEDNmWdg21Aos8+1fnwbwLswPHdI3o8Jzw8x3QxBly6F9TTf c6NRqqNsRTuY7yGFlXQcHc+REiV9gNGNt7EV1Z/cWFQiJBOWqWC3kK3WzG1fBeYS0Zib 9yYDNNc7A/Sd3sPlELltRA/mCpSAPtWlEe3mBB3ruVgLAdeFEFXNDjYk44AvEq9eTSag tfBmiMrp/02ApjDr6vqkYrZfTrGrJ8Rt0BdJmh8vvbHPE7ErxuLb5cpqoINPfLXL/9SS FCBA== X-Gm-Message-State: AOAM530DCL8hOijPNkQ4Tgv8nkZWuscm363AsF8cwEdzeVS0VzMY4Zvm cEfXZ2WCCshLnzXlKI1M/yPDjTsp8uc= X-Google-Smtp-Source: ABdhPJwVJ4CFn8skJcN7cruRLvvdJCjPIFuIllmB1wCVnHs/WGRawIUdK5GLaZ5ZEvBy14zmmUKCtg== X-Received: by 2002:a17:90a:718c:: with SMTP id i12mr14912424pjk.182.1632362472371; Wed, 22 Sep 2021 19:01:12 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id t13sm6154240pjj.1.2021.09.22.19.01.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Sep 2021 19:01:11 -0700 (PDT) Subject: Re: bug#50538: [PATCH v3] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: Alan Mackenzie References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> From: Jim Porter Message-ID: <543ebfcc-d032-f0cd-f605-3f0607fe1df1@gmail.com> Date: Wed, 22 Sep 2021 19:01:11 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------2B5B6D79F1130855D59AA036" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------2B5B6D79F1130855D59AA036 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Ok, I've attached an updated patch that should apply cleanly on top of the patches for bug#49518. The tests still pass locally for me. If there's anything else that needs fixed/adjusted, just let me know. --------------2B5B6D79F1130855D59AA036 Content-Type: text/plain; charset=UTF-8; name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" RnJvbSBjNGQwNjljMDEwZDVlNTI2ZmE4NWQ1ODAwZmY4ZGU1YmI2YTUyYjdlIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFRodSwgMTYgU2VwIDIwMj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Y2UzMC4uNGIz YTM5Yjg1ZiAxMDA2NDQKLS0tIGEvdGVzdC9saXNwL2VsZWN0cmljLXRlc3RzLmVsCisrKyBi L3Rlc3QvbGlzcC9lbGVjdHJpYy10ZXN0cy5lbApAQCAtMzIsNiArMzIsOSBAQAogKHJlcXVp cmUgJ2VsZWMtcGFpcikKIChyZXF1aXJlICdjbC1saWIpCiAKKzs7IFdoZW4gcnVubmluZyB0 ZXN0cyBpbiBjLW1vZGUsIHVzZSBzaW5nbGUtbGluZSBjb21tZW50cyAoLy8pLgorKGFkZC1o b29rICdjLW1vZGUtaG9vayAobGFtYmRhICgpIChjLXRvZ2dsZS1jb21tZW50LXN0eWxlIC0x KSkpCisKIChkZWZ1biBjYWxsLXdpdGgtc2F2ZWQtZWxlY3RyaWMtbW9kZXMgKGZuKQogICAo bGV0ICgoc2F2ZWQtZWxlY3RyaWMgKGlmIGVsZWN0cmljLXBhaXItbW9kZSAxIC0xKSkKICAg ICAgICAgKHNhdmVkLWxheW91dCAoaWYgZWxlY3RyaWMtbGF5b3V0LW1vZGUgMSAtMSkpCkBA IC0xNzQsNyArMTc3LDcgQEAgZGVmaW5lLWVsZWN0cmljLXBhaXItdGVzdAogICAgICAgICAg IGV4cGVjdGVkLXN0cmluZwogICAgICAgICAgIGV4cGVjdGVkLXBvaW50CiAgICAgICAgICAg YmluZGluZ3MKLSAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpzLW1vZGUg cHl0aG9uLW1vZGUpKSkKKyAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpz LW1vZGUgcHl0aG9uLW1vZGUgYy1tb2RlKSkpCiAgICAgICAgICAgKHRlc3QtaW4tY29tbWVu dHMgdCkKICAgICAgICAgICAodGVzdC1pbi1zdHJpbmdzIHQpCiAgICAgICAgICAgKHRlc3Qt aW4tY29kZSB0KQotLSAKMi4yNS4xCgo= --------------2B5B6D79F1130855D59AA036-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 26 16:58:47 2021 Received: (at 50538) by debbugs.gnu.org; 26 Sep 2021 20:58:47 +0000 Received: from localhost ([127.0.0.1]:38871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUbEV-0000oH-0b for submit@debbugs.gnu.org; Sun, 26 Sep 2021 16:58:47 -0400 Received: from colin.muc.de ([193.149.48.1]:59304 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mUbET-0000o4-9Y for 50538@debbugs.gnu.org; Sun, 26 Sep 2021 16:58:45 -0400 Received: (qmail 64010 invoked by uid 3782); 26 Sep 2021 20:58:38 -0000 Received: from acm.muc.de (p4fe150ab.dip0.t-ipconnect.de [79.225.80.171]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 26 Sep 2021 22:58:37 +0200 Received: (qmail 16077 invoked by uid 1000); 26 Sep 2021 20:58:36 -0000 Date: Sun, 26 Sep 2021 20:58:36 +0000 To: Jim Porter Subject: Re: bug#50538: [PATCH v3] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode Message-ID: References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> <543ebfcc-d032-f0cd-f605-3f0607fe1df1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <543ebfcc-d032-f0cd-f605-3f0607fe1df1@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Jim. There's one thing I'm a bit uncertain about in the patch for cc-mode.el. On Wed, Sep 22, 2021 at 19:01:11 -0700, Jim Porter wrote: > Ok, I've attached an updated patch that should apply cleanly on top of > the patches for bug#49518. The tests still pass locally for me. If > there's anything else that needs fixed/adjusted, just let me know. [ .... ] > diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el > index 8b30241449..80137590c7 100644 > --- a/lisp/progmodes/cc-mode.el > +++ b/lisp/progmodes/cc-mode.el > @@ -2549,18 +2549,26 @@ c-electric-pair-inhibit-predicate > At the time of call, point is just after the newly inserted CHAR. > -When CHAR is \", t will be returned unless the \" is marked with > -a string fence syntax-table text property. For other characters, > -the default value of `electric-pair-inhibit-predicate' is called > -and its value returned. > +When CHAR is \" and not within a comment, t will be returned if > +the quotes on the current line are already balanced (i.e. if the > +last \" is not marked with a string fence syntax-table text > +property). For other cases, the default value of > +`electric-pair-inhibit-predicate' is called and its value > +returned. > This function is the appropriate value of > `electric-pair-inhibit-predicate' for CC Mode modes, which mark > invalid strings with such a syntax table text property on the > opening \" and the next unescaped end of line." > - (if (eq char ?\") > - (not (equal (get-text-property (1- (point)) 'c-fl-syn-tab) '(15))) > - (funcall (default-value 'electric-pair-inhibit-predicate) char))) > + (or (and (eq char ?\") > + (not (memq (cadr (c-semi-pp-to-literal (1- (point)))) '(c c++))) > + (let ((last-quote (save-match-data > + (save-excursion > + (goto-char (c-point 'eoll)) > + (search-backward "\""))))) > + (not (equal (c-get-char-property last-quote 'c-fl-syn-tab) > + '(15))))) > + (funcall (default-value 'electric-pair-inhibit-predicate) char))) In the line starting (or (and (eq char ?\"), don't we still need an `if' form? I think that otherwise, if any of the sub-forms of the `and' return nil, we will call (default-value 'electric-pair-inhibit-predicate), which surely isn't what we want. If we have a ", we want the CC Mode function to do all the work, only delegating to the standard function when we don't have a ". Or have I missed something? [ .... ] -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 28 00:57:16 2021 Received: (at 50538) by debbugs.gnu.org; 28 Sep 2021 04:57:16 +0000 Received: from localhost ([127.0.0.1]:43377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mV5B6-0003fn-9f for submit@debbugs.gnu.org; Tue, 28 Sep 2021 00:57:16 -0400 Received: from mail-pj1-f48.google.com ([209.85.216.48]:36474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mV5B3-0003fX-Ok for 50538@debbugs.gnu.org; Tue, 28 Sep 2021 00:57:14 -0400 Received: by mail-pj1-f48.google.com with SMTP id u1-20020a17090ae00100b0019ec31d3ba2so835352pjy.1 for <50538@debbugs.gnu.org>; Mon, 27 Sep 2021 21:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language; bh=d7CT7BUZYDgesJdKdJGxiypm0Q+hwM/+6aIf3k4zytA=; b=PpLnJeShsGewD/A48dZZINMGZvtyXPpvQSYiW10sFQiAx475aWpO3spq7tFbBThMsR oWAGniufe4o0AeJ/xsxXkimtDCtULZ7wyll7asLtI0CGePbFc+Answ3ub+NPzV9weLnO 6yTmE5hXfcdxDDFM+P3EzXvL7jK5o+r/W5F8xftaC0LZKSrKh0pwN+AA0QNtLCZ0dNo6 T3Ef0qyjQ7dVBgDndLdirajjpl5+JSnlg4d+03Pflo7iCuSQfF+jZ20XwkAKHd1C7GKH dJX2NZSTA3hC9fmhDjgbihpNuFk0XeeMSRVNxtpt/o9Lp96Pt4EbnQpqdUsF6u/lg4Bl c7Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language; bh=d7CT7BUZYDgesJdKdJGxiypm0Q+hwM/+6aIf3k4zytA=; b=rDY4rOdpiLO87eKIoGAl91cn7+m+7LtCT+xyUjAeXdgtjuJehpDFrMJPWfsKzdKWbH VZqFkq+RGrFPzML52QD6bk7aPms1NfjLnSoCidbKCfkfSKqAhMNmbOFqC77MyhmJW0Do fyIiAO18a+dKbin7gXOM76JLhUbXDLEfp0ISmTEOAiC65b0Cxup+rmAUNyU99APgJmip KVYdLuZN/XAMnN8225XkEOsDhYptOJ4dnwBaOOfP1zzq3aHWX01yyn861TFtdgMTGLEd //BEPhCXVr7v682t/Eh6JER90E74KevGbwqITh9apR+nugyok4vqpLVEanawoJSliMzd 4JFw== X-Gm-Message-State: AOAM530vMoWfstVRBB3e4uV4TmdEMCtLWmp3ycVhzrWR3N8/WDaDJfG5 fxVA75nDoG1A1ZUQSSe4+RLkJnXGYec= X-Google-Smtp-Source: ABdhPJzCqwcAIaMg+76lJrdUcuA5PCmvwcFzNHNiBmdNUQOFcNpHXH8PbilfajUmnwMXy02M5U0ZgA== X-Received: by 2002:a17:90a:910:: with SMTP id n16mr3173570pjn.246.1632805027669; Mon, 27 Sep 2021 21:57:07 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id gk14sm710962pjb.35.2021.09.27.21.57.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 21:57:06 -0700 (PDT) Subject: Re: bug#50538: [PATCH v4] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode To: Alan Mackenzie References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> <543ebfcc-d032-f0cd-f605-3f0607fe1df1@gmail.com> From: Jim Porter Message-ID: <36deabe8-9b2b-2c04-5d99-2c0a4b03abde@gmail.com> Date: Mon, 27 Sep 2021 21:57:07 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------9BDCAD5E7620D2D638BF2968" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------9BDCAD5E7620D2D638BF2968 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/26/2021 1:58 PM, Alan Mackenzie wrote: > > There's one thing I'm a bit uncertain about in the patch for cc-mode.el. > > On Wed, Sep 22, 2021 at 19:01:11 -0700, Jim Porter wrote: [snip] >> - (if (eq char ?\") >> - (not (equal (get-text-property (1- (point)) 'c-fl-syn-tab) '(15))) >> - (funcall (default-value 'electric-pair-inhibit-predicate) char))) >> + (or (and (eq char ?\") >> + (not (memq (cadr (c-semi-pp-to-literal (1- (point)))) '(c c++))) >> + (let ((last-quote (save-match-data >> + (save-excursion >> + (goto-char (c-point 'eoll)) >> + (search-backward "\""))))) >> + (not (equal (c-get-char-property last-quote 'c-fl-syn-tab) >> + '(15))))) >> + (funcall (default-value 'electric-pair-inhibit-predicate) char))) > > In the line starting (or (and (eq char ?\"), don't we still need an `if' > form? I think that otherwise, if any of the sub-forms of the `and' > return nil, we will call (default-value > 'electric-pair-inhibit-predicate), which surely isn't what we want. If > we have a ", we want the CC Mode function to do all the work, only > delegating to the standard function when we don't have a ". > > Or have I missed something? I don't have a strong opinion on this either way, so here's a patch that uses an `if' form as you suggest. However, I introduced the `or' form in response to Eli's concern[1]: On 9/11/2021 11:26 PM, Eli Zaretskii wrote: > Your expected results seem to expect Emacs to assume that a new > string will be inserted, but is that an assumption that is always > true? It could be that the user wants to modify the existing string > instead, in which case your suggested patches will require the user > to delete more quotes than previously. I discussed the pros and cons in my followup[2]: > Note however that this solution isn't perfect: it means a user's > custom `electric-pair-inhibit-predicate' can only inhibit *more* > than CC mode's default behavior, not less. I think that's a > reasonable compromise though, and users who want more direct control > can [override `c-electric-pair-inhibit-predicate'].[3] Personally, I'm fine with letting CC Mode do all the work here, and requiring users to advise this function if they want a different behavior. It's probably easier to be sure that things don't break by using the `if' form patch, though I think the previous `or' form patch should be pretty robust too. [1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-09/msg00976.html [2] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-09/msg01014.html [3] My explanation in the original message was incorrect, so I've fixed it here. --------------9BDCAD5E7620D2D638BF2968 Content-Type: text/plain; charset=UTF-8; name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" RnJvbSA1YzEyZmUwOWY3YWM3MTBiMmMyZjI3OWUwZmFhMDRiZTg2NTJkYjBmIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFRodSwgMTYgU2VwIDIwMjEgMTQ6MzI6MTcgLTA3MDAKU3ViamVjdDogW1BB VENIXSBJbXByb3ZlIGJlaGF2aW9yIG9mICdlbGVjdHJpYy1wYWlyLW1vZGUnIGluICdjYy1t b2RlJwoKVGhpcyBlbnN1cmVzIHRoYXQgcXVvdGVzIGFyZSBwYWlyZWQgY29ycmVjdGx5IHdp dGhpbiBjb21tZW50cywgYWxsb3dzIGZvcgppbnNlcnRpb24gb2YgcXVvdGUgcGFpcnMgaW1t ZWRpYXRlbHkgYmVmb3JlIGFub3RoZXIgcXVvdGUsIGFuZCBhbGxvd3MKaW5zZXJ0aW5nI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YmRhICgpIChjLXRvZ2dsZS1jb21tZW50LXN0eWxlIC0x KSkpCisKIChkZWZ1biBjYWxsLXdpdGgtc2F2ZWQtZWxlY3RyaWMtbW9kZXMgKGZuKQogICAo bGV0ICgoc2F2ZWQtZWxlY3RyaWMgKGlmIGVsZWN0cmljLXBhaXItbW9kZSAxIC0xKSkKICAg ICAgICAgKHNhdmVkLWxheW91dCAoaWYgZWxlY3RyaWMtbGF5b3V0LW1vZGUgMSAtMSkpCkBA IC0xNzQsNyArMTc3LDcgQEAgZGVmaW5lLWVsZWN0cmljLXBhaXItdGVzdAogICAgICAgICAg IGV4cGVjdGVkLXN0cmluZwogICAgICAgICAgIGV4cGVjdGVkLXBvaW50CiAgICAgICAgICAg YmluZGluZ3MKLSAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpzLW1vZGUg cHl0aG9uLW1vZGUpKSkKKyAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpz LW1vZGUgcHl0aG9uLW1vZGUgYy1tb2RlKSkpCiAgICAgICAgICAgKHRlc3QtaW4tY29tbWVu dHMgdCkKICAgICAgICAgICAodGVzdC1pbi1zdHJpbmdzIHQpCiAgICAgICAgICAgKHRlc3Qt aW4tY29kZSB0KQotLSAKMi4yNS4xCgo= --------------9BDCAD5E7620D2D638BF2968-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 03 13:58:24 2021 Received: (at 50538) by debbugs.gnu.org; 3 Oct 2021 17:58:24 +0000 Received: from localhost ([127.0.0.1]:34896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mX5km-0006X3-Cz for submit@debbugs.gnu.org; Sun, 03 Oct 2021 13:58:24 -0400 Received: from mail-pf1-f175.google.com ([209.85.210.175]:35831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mX5kj-0006Wp-O4 for 50538@debbugs.gnu.org; Sun, 03 Oct 2021 13:58:23 -0400 Received: by mail-pf1-f175.google.com with SMTP id c29so2182181pfp.2 for <50538@debbugs.gnu.org>; Sun, 03 Oct 2021 10:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-language; bh=wdQXWZ3Iej8dhvpkcJr3XZbujZOuuEYBYeUcx9cCpUw=; b=M2dEilGJay8cVJWiii97Je4CTHcH2rO9OU0QSRT/NRkpvHL8tsZ6xZYc5V9hKVLIwM uq6+hN3ObJflXA6dCDxWVoxKxcqfqcEPsLjUk1ujI00C2l1fODC8MQEjsRCiyGlBhXdm g8f2+XRO/nHkEadqK53qRFuK4Kl3kccOav3XVrvTyXFyauwYN0ZD+C2inQdgIBv5P2Sx 56wu/g9rf0HIHG55XLcV9BNHkwd5TybNnyaNkvuNsRe3JramYvsIb513kf7GM4a1ucvr UY3AQFlChwGFdVnY3wvamR6UBwVYrfWdXs0kJjagv3fmzD9fPqD+cBRpRnumbucnluXi XI2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :mime-version:in-reply-to:content-language; bh=wdQXWZ3Iej8dhvpkcJr3XZbujZOuuEYBYeUcx9cCpUw=; b=54bmGH1w+xdLQdaYr6Rvhl4KzpOTyIDxiq1cqWjBMjMtFRnxMZhihrpwj+S0+/VHiW ZCmiSppdWEsmPdw/vOHXe+lRWpXp4p5O5seriaPhNWhax9wlEfU4OYBTKdEU80Yd1z9J 1DNWJy2ZTd3obbuaoino+uzWLbp5rdOBaF2/MWhMJtPArE/dSzsjjv49owpM0XbAXw6D vm6QiOAc2i3Qiz2hBw82LgNGHKh7rm7cWg30yfmK4HmcOnTi0j31/80tKZSjpyGh038P 1UsBOLIYGdzar9U2Pyuw9AAoSt7b99rhipFhGda0eUB2Wkl2BHqYbbvhwGTOY62K56eA UKgg== X-Gm-Message-State: AOAM531SD+SWLEbAi8V85GYTXYl34gFz6R1s1WsvqKeh1t9AEv0Jv3KC X9/tSsy0oqimYZlz8s0HPrUcQbSjHRg= X-Google-Smtp-Source: ABdhPJw7VQLWuyUnwQ2n/AC964T9rIoZjqXLRpiyY1YXtHLCHk0AD2LFCdDqbDNjhKfMH4CtmJIVhA== X-Received: by 2002:a63:4d20:: with SMTP id a32mr7483823pgb.247.1633283895763; Sun, 03 Oct 2021 10:58:15 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id s3sm13521642pjr.1.2021.10.03.10.58.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Oct 2021 10:58:15 -0700 (PDT) Subject: Re: bug#50538: [PATCH v5] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode From: Jim Porter To: Alan Mackenzie References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> <543ebfcc-d032-f0cd-f605-3f0607fe1df1@gmail.com> <36deabe8-9b2b-2c04-5d99-2c0a4b03abde@gmail.com> Message-ID: <226f9647-8932-5377-9a24-1edd160d32e4@gmail.com> Date: Sun, 3 Oct 2021 10:58:15 -0700 MIME-Version: 1.0 In-Reply-To: <36deabe8-9b2b-2c04-5d99-2c0a4b03abde@gmail.com> Content-Type: multipart/mixed; boundary="------------55BB4DAAC4D852E4E72CD576" Content-Language: en-US X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50538 Cc: 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------55BB4DAAC4D852E4E72CD576 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/27/2021 9:57 PM, Jim Porter wrote: > I don't have a strong opinion on this either way, so here's a patch that > uses an `if' form as you suggest. Oops, I was looking over this patch again and realized that I simply re-attached the old patch. Sorry about that. Here's the version that *really* uses the `if' form. Like I said in my previous message, I don't have a strong opinion on whether to use the `if' form or the `or' form; either works fine for me. --------------55BB4DAAC4D852E4E72CD576 Content-Type: text/plain; charset=UTF-8; name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch" RnJvbSA5OWQyZTdlZmEwOGU5MDZhMjFiMDUxMjhlMDJlOGFkOTY3MjE5ZDBiIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IFN1biwgMyBPY3QgMjAyMSAxMDo0NjowMSAtMDcwMApTdWJqZWN0OiBbUEFU Q0hdIEltcHJvdmUgYmVoYXZpb3Igb2YgJ2VsZWN0cmljLXBhaXItbW9kZScgaW4gJ2NjLW1v ZGUnCgpUaGlzIGVuc3VyZXMgdGhhdCBxdW90ZXMgYXJlIHBhaXJlZCBjb3JyZWN0bHkgd2l0 aGluIGNvbW1lbnRzLCBhbGxvd3MgZm9yCmluc2VydGlvbiBvZiBxdW90ZSBwYWlycyBpbW1l ZGlhdGVseSBiZWZvcmUgYW5vdGhlciBxdW90ZSwgYW5kIGFsbG93cwppbnNlcnRpbmcgcXVv dGUgcGFpcnMgd2l0aGluIGEgc3RyaW5nICh0aHVzIHNwbGl0dGluZyB0aGUgc3RyaW5nIGlu IHR3bykuCgoqIGxpc3AvcHJvZ21vZGVzL2NjLW1vZGUuZWwgKGMtZWxlY3R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0LDcgKzE3Nyw3IEBAIGRlZmluZS1lbGVjdHJpYy1wYWlyLXRlc3QKICAgICAg ICAgICBleHBlY3RlZC1zdHJpbmcKICAgICAgICAgICBleHBlY3RlZC1wb2ludAogICAgICAg ICAgIGJpbmRpbmdzCi0gICAgICAgICAgKG1vZGVzICcocXVvdGUgKHJ1YnktbW9kZSBqcy1t b2RlIHB5dGhvbi1tb2RlKSkpCisgICAgICAgICAgKG1vZGVzICcocXVvdGUgKHJ1YnktbW9k ZSBqcy1tb2RlIHB5dGhvbi1tb2RlIGMtbW9kZSkpKQogICAgICAgICAgICh0ZXN0LWluLWNv bW1lbnRzIHQpCiAgICAgICAgICAgKHRlc3QtaW4tc3RyaW5ncyB0KQogICAgICAgICAgICh0 ZXN0LWluLWNvZGUgdCkKLS0gCjIuMjUuMQoK --------------55BB4DAAC4D852E4E72CD576-- From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 05 20:22:37 2021 Received: (at 50538) by debbugs.gnu.org; 6 Nov 2021 00:22:38 +0000 Received: from localhost ([127.0.0.1]:47707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mj9Th-0004cO-ON for submit@debbugs.gnu.org; Fri, 05 Nov 2021 20:22:37 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mj9Tf-0004cA-M9 for 50538@debbugs.gnu.org; Fri, 05 Nov 2021 20:22:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kybORDuNaoSLlEmdk7899HT9dXsdvkBvVzYFBIZ0ZAk=; b=eePVBWbVo3FF1hzh2yvKM86K09 JiLeZnuh2zRySA+F9xjxqnh19I8Zhab8fPjrNPUvrBOEtwIVcNo/rBBYJR0Ej6J+6eNzsvbcHByuz EG9gvmO5kyQbuvWzxLHFkStnAAPKb8BM+mgKyfS7Ua8RXkw82wQnhnnbCGZMb/YG2l/Q=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mj9TX-00017O-7A; Sat, 06 Nov 2021 01:22:29 +0100 From: Lars Ingebrigtsen To: Jim Porter Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode References: <021853bf-0169-c158-ab3d-296b6c144e08@gmail.com> <83r1dufgxu.fsf@gnu.org> <94c7b4ec-813b-515f-d947-116c294dd74b@gmail.com> <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@gmail.com> <543ebfcc-d032-f0cd-f605-3f0607fe1df1@gmail.com> <36deabe8-9b2b-2c04-5d99-2c0a4b03abde@gmail.com> <226f9647-8932-5377-9a24-1edd160d32e4@gmail.com> X-Now-Playing: Fire!'s _Defeat_: "Defeat (only further apart)" Date: Sat, 06 Nov 2021 01:22:26 +0100 In-Reply-To: <226f9647-8932-5377-9a24-1edd160d32e4@gmail.com> (Jim Porter's message of "Sun, 3 Oct 2021 10:58:15 -0700") Message-ID: <8735oaf7zx.fsf_-_@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Jim Porter writes: > Oops, I was looking over this patch again and realized that I simply > re-attached the old patch. Sorry about that. Here's the version that > *really* uses the `if' form. Like I said in my previous [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50538 Cc: Alan Mackenzie , 50538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Jim Porter writes: > Oops, I was looking over this patch again and realized that I simply > re-attached the old patch. Sorry about that. Here's the version that > *really* uses the `if' form. Like I said in my previous message, I > don't have a strong opinion on whether to use the `if' form or the > `or' form; either works fine for me. Skimming this thread, it seems that everybody was OK with this patch, but it wasn't applied. So I've now done so (but in Emacs 29). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 05 20:22:46 2021 Received: (at control) by debbugs.gnu.org; 6 Nov 2021 00:22:46 +0000 Received: from localhost ([127.0.0.1]:47710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mj9Tp-0004cp-Uv for submit@debbugs.gnu.org; Fri, 05 Nov 2021 20:22:46 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mj9To-0004cZ-Of for control@debbugs.gnu.org; Fri, 05 Nov 2021 20:22:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qkLns3KsyU74rJRIhbpB+trw9OHYOqw/bWO7h9K8Igg=; b=RlInR89MfXV4w2GM3gqfwCTQDl 3kacK0srPkXVJKsgS50YfNOxGwM6EWf8H8W8FFs6PWw2+k+TMOyEKYoPDRWh6ZOa+7zM6ca3UBCdd ZLjl/OWBrml0BBMlIGp4PwnuP2kGPElC8dwR8bAu0x7JGdyfCS1ibOFVTDZJl0vH5qG8=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mj9Tg-00017W-LX for control@debbugs.gnu.org; Sat, 06 Nov 2021 01:22:39 +0100 Date: Sat, 06 Nov 2021 01:22:36 +0100 Message-Id: <871r3uf7zn.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #50538 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 50538 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 50538 29.1 quit From unknown Sat Sep 20 08:01:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 04 Dec 2021 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator