From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#53446: 29.0.50; Issues with awk-mode and electric-pair-mode Date: Fri, 23 Sep 2022 18:57:31 +0000 Message-ID: <87edw1or50.fsf@posteo.net> References: <875yqbdhvy.fsf@posteo.net> <87czbmv9hp.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37426"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53446@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 23 21:00:43 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obnul-0009cB-JL for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Sep 2022 21:00:43 +0200 Original-Received: from localhost ([::1]:40480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obnuk-0005vy-Kz for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 23 Sep 2022 15:00:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obnsA-0001wt-UB for bug-gnu-emacs@gnu.org; Fri, 23 Sep 2022 14:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obnsA-0003DY-6L for bug-gnu-emacs@gnu.org; Fri, 23 Sep 2022 14:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obnsA-0002d6-1d for bug-gnu-emacs@gnu.org; Fri, 23 Sep 2022 14:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Sep 2022 18:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53446 X-GNU-PR-Package: emacs Original-Received: via spool by 53446-submit@debbugs.gnu.org id=B53446.166395946610087 (code B ref 53446); Fri, 23 Sep 2022 18:58:02 +0000 Original-Received: (at 53446) by debbugs.gnu.org; 23 Sep 2022 18:57:46 +0000 Original-Received: from localhost ([127.0.0.1]:41782 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obnrt-0002cd-Pu for submit@debbugs.gnu.org; Fri, 23 Sep 2022 14:57:46 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:33631) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obnrr-0002cN-9p for 53446@debbugs.gnu.org; Fri, 23 Sep 2022 14:57:44 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 27692240103 for <53446@debbugs.gnu.org>; Fri, 23 Sep 2022 20:57:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1663959457; bh=Loxecf0TDZUGmsVc8j5qGkbdAK4YioIie9h5jfaE+X0=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=g5AnVcmuZ3DeV5wv3+Zh6q5rJNkt7Y0kt1LtJijGoVvhNWzkfvMlmVp2fSlzC2h8J pkpCWOrTlBFfUfTk1I8IPcFN5XRRCdZ1G/hbPq85JVn6YD4WLE1SDyGwnG3c/1963G +G/ZCCAroqmT8fK2zIQRK30+riqQBDplyOuVKzsnntzIZhvsdDJvQ/JsBvptmgI2Op Yg7w5ozCUjfEctUdRzXLjKsAtV2wmEs3TuYQitSaZu4AKwkyM/w/qy3t+UblsaK9e6 Rh7RyPF2Ke3klzBzLY6bMWTlb4Cp2dNkBzEqUWNrVAo3PDySZLLzP6JLZ1ISc1imVx 4+I4xW8b9R3kA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MZ1cF4q16z9rxD; Fri, 23 Sep 2022 20:57:32 +0200 (CEST) In-Reply-To: (Alan Mackenzie's message of "Fri, 23 Sep 2022 18:37:57 +0000") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:243496 Archived-At: Alan Mackenzie writes: > Hello, Philip. > > Sorry I missed this bug in January. No problem. > On Fri, Sep 23, 2022 at 07:24:34 +0000, Philip Kaludercic wrote: >> Philip Kaludercic writes: > >> > Open an AWK file, and ensure that electric-pair-mode is enabled. It >> > seems that some character pairs like braces or parentheses are >> > automatically paired, while others like apostrophes or double quotes are >> > not. > > The reason apostrophes don't work with electric-pair-mode is that they > are not quote characters in AWK. :-) > >> I have managed to narrow this bug to the function >> `c-electric-pair-inhibit-predicate' that is used as >> `electric-pair-inhibit-predicate' by cc-mode. Specifically this check > >> (not (equal (c-get-char-property last-quote 'c-fl-syn-tab) '(15))) > >> fails, because the macro > >> (c-get-char-property last-quote 'c-fl-syn-tab) > >> that expands to > >> (get-text-property last-quote 'c-fl-syn-tab) > >> where `last-quote' is the position of the last quotation mark in a >> "logical line", evaluates to nil, not (15). I do not understand why >> this happens, or what the text property `c-fl-syn-tab' is supposed to >> indicate. > > It happens because AWK Mode doesn't use the unterminated string > detection code the other CC Mode modes use. (It doesn't need to, being > simpler.) So, rather than temporarily storing its "working" > syntax-table text properties, AWK just lets them be. So, we can just > test the syntax-table text property for being '(15) (string fence) in > AWK Mode. > >> I have CC'ed Alan to see if he can help. > > Would you please try out the following patch, and let me know how it > goes. Thanks! Yes, this does the job. > > diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el > index 9309a546db..679690b33c 100644 > --- a/lisp/progmodes/cc-mode.el > +++ b/lisp/progmodes/cc-mode.el > @@ -2714,7 +2714,10 @@ c-electric-pair-inhibit-predicate > (save-excursion > (goto-char (c-point 'eoll)) > (search-backward "\""))))) > - (not (equal (c-get-char-property last-quote 'c-fl-syn-tab) '(15)))) > + (not (equal > + (or (c-get-char-property last-quote 'c-fl-syn-tab) > + (c-get-char-property last-quote 'syntax-table)) ; for AWK > + '(15)))) > (funcall (default-value 'electric-pair-inhibit-predicate) char))) > >