From unknown Wed Sep 10 18:55:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#40231: sql.el: patch for syntax table propertizing escaped apostrophes in SQL strings as punctuation syntax class Resent-From: "Florian v. Savigny" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Mar 2020 21:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40231 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 40231@debbugs.gnu.org Cc: Michael Mauger X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Reply-To: "Florian v. Savigny" Received: via spool by submit@debbugs.gnu.org id=B.15851725993716 (code B ref -1); Wed, 25 Mar 2020 21:44:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Mar 2020 21:43:19 +0000 Received: from localhost ([127.0.0.1]:57909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHDnw-0000xp-1g for submit@debbugs.gnu.org; Wed, 25 Mar 2020 17:43:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:44230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jHDnu-0000xi-Dq for submit@debbugs.gnu.org; Wed, 25 Mar 2020 17:43:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49669) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHDns-0004ff-Mc for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 17:43:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHDnr-00059y-Al for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 17:43:12 -0400 Received: from mout-p-201.mailbox.org ([2001:67c:2050::465:201]:42998) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHDnq-000558-NL for bug-gnu-emacs@gnu.org; Wed, 25 Mar 2020 17:43:11 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 48nhS64wsNzQlKR; Wed, 25 Mar 2020 22:43:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-type:content-type:mime-version:subject:subject :message-id:reply-to:from:from:date:date:received; s= mail20150812; t=1585172578; bh=6k9wBg/BKJp1ab2pbPxdyfcex+We78yXh cmRGaPyZTw=; b=EO/vDaJDQ4TUXZCBHn1zU5Q5iLf0vN6ybGNGFCnZUwR0wzCRI cSQEhiHzI1qrEghVR0jaMkDV/3Tdj2SsNyelZsq2S8u5P1+z3oaabsEB0e/VE46A M2klWTc9/2yiSjeUBsAsqi4MPb/2aPj2CaD3kJhSd7zDfbrQb0NW8cm6HMNkD9ZE Q/USjNk/TEsxCoEe4YzAnc7s28mO8MZsi97JecXTas777Z9kTdt9ED1b+LfJlZDT 88z2D+LGrJqcachPnt0z3N2nM6CMwwH8jAKoqLqo1fzzANxnqcFO3Q1Q1VuiBlex B81oRU/3DXpSErLkZnLxzmqACd1bpG35SMbYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1585172580; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=csTUTEpjL44k52OXjvGxPOKHTzMLqAI2pAjuTvhxzvI=; b=UEwL6Am/phva7uY9hvOm4bpUKaGzo3EWaT+qh0eJhz2k0yBv9XZt+o51/JGn+Z9sCFE3le X6o9NSd9URXRYEoJAAZqyMFilNloWgLzxaqJotKO9xtjyK8R9Bojx1khOZRW+QmprUKLAT csQq1xPirbFoMNBrKx9QdBRvhOI8sILPHLazfkn98z0g4ncpo2Rx8Ums+a+lPs16BgKFXa cZYCXFTOWKFHqizVHl27KTRuwc70NlMB4ikxZzAHa8QlwQB22sxHZhdwDOT7cX+TbL2QZh 9XRx6sRnEzC2j8M4XLZyD3Ob2zmaR7TV9bCrItemfvJexCvE26+/O9JWNJbyJg== X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id txpnYVMwhOQW; Wed, 25 Mar 2020 22:42:58 +0100 (CET) Date: Wed, 25 Mar 2020 22:42:58 +0100 (CET) From: "Florian v. Savigny" Message-ID: <36733993.7486.1585172578563@office.mailbox.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_7485_888765726.1585172578513" X-Priority: 3 Importance: Normal X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:67c:2050::465:201 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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 the administrator of that system for details. Content preview: Dear Emacs folks, dear Michael, sql.el parses SQL strings containing escaped (double) apostrophes as separate strings (e.g. jumping right between the two apostrophes with forward-sexp) because it uses only parsing by syntax table, w [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: mauger.com] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [209.51.188.17 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 1.0 XPRIO Has X-Priority header 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.7 (/) ------=_Part_7485_888765726.1585172578513 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dear Emacs folks, dear Michael, sql.el parses SQL strings containing escaped (double) apostrophes as separa= te strings (e.g. jumping right between the two apostrophes with forward-sex= p) because it uses only parsing by syntax table, which cannot handle this c= onstruct. This should be an adequate description of the limitation/bug, but more deta= ils are available at:=20 https://emacs.stackexchange.com/questions/56352/can-syntax-parsing-recog= nize-the-sql-escape-apostrophe-single-quote-constru The attached is a diff against sql.el version 3.6 as shipped with Emacs 26.= 3. that implements propertizing such double apostrophes within strings with= a punctuation syntax table property. (I have posted the code with exhausti= ve comments, which I thought excessive for working code, at the above URL.)= My tests were movement commands across sexps, which crossed the whole stri= ng, and the return value of=20 (syntax-ppss (point)) which returned a list such as=20 (1 129 139 39 nil nil 0 nil 154 (129) nil) when between two such apostrophes, just like when elsewhere in a string. I = have done no further testing. I do hope this meets the standards for a patch, as I've never submitted one= before. Best regards to everybody, and stay well! Florian Florian v. Savigny=20 Siebenpfeiffer Str. 25=20 66482 Zweibr=C3=BCcken=20 Germany 0175 - 365 24 17 ------=_Part_7485_888765726.1585172578513 Content-Type: text/x-patch; charset=ISO-8859-1; name=sql.el-syntax-parsing-escaped-apostrophes.diff Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=sql.el-syntax-parsing-escaped-apostrophes.diff X-Part-Id: 8cae05822f7b4f6c9f5660935d99e67b LS0tIHNxbC1wcmVwYXRjaC5lbAkyMDIwLTAzLTI1IDIwOjE2OjQyLjE2MjU4OT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HRvIG1ha2Ugc3VyZSBpdCBpcyB1c2VkCiAgIDs7IFNldCBzeW50YXggYW5kIGZvbnQt ZmFjZSBoaWdobGlnaHRpbmcKICAgOzsgQ2F0Y2ggY2hhbmdlcyB0byBzcWwtcHJvZHVjdCBhbmQg aGlnaGxpZ2h0IGFjY29yZGluZ2x5CiAgIChzcWwtc2V0LXByb2R1Y3QgKG9yIHNxbC1wcm9kdWN0 ICdhbnNpKSkgOyBGaXhlcyBidWcjMTM1OTEK ------=_Part_7485_888765726.1585172578513-- From unknown Wed Sep 10 18:55:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#40231: sql.el: patch for syntax table propertizing escaped apostrophes in SQL strings as punctuation syntax class Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Aug 2020 13:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40231 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Florian v. Savigny" Cc: Michael Mauger , 40231@debbugs.gnu.org Received: via spool by 40231-submit@debbugs.gnu.org id=B40231.15968937387032 (code B ref 40231); Sat, 08 Aug 2020 13:36:02 +0000 Received: (at 40231) by debbugs.gnu.org; 8 Aug 2020 13:35:38 +0000 Received: from localhost ([127.0.0.1]:58523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4P0b-0001pM-R3 for submit@debbugs.gnu.org; Sat, 08 Aug 2020 09:35:38 -0400 Received: from quimby.gnus.org ([95.216.78.240]:51804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4P0Z-0001p3-9d for 40231@debbugs.gnu.org; Sat, 08 Aug 2020 09:35: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=WsYzyDIwDLMgv3Scq+8chaubw8hqfhAPEYkRMUvMk3A=; b=mxQt5siauT6VqMc5QKcTVnqzLW 0bMPWbVNCIA3nB5tf1Z09PyF/zQlJUkH4jKx+6Pd8rwa7yzIIgPJb8tDm4RF5Ck1nFDs9KGYuV5Is M4yfIUUKVxzIenYSTKjSS6EH7xM7KMwg363LoOPgdrCqpHZCyi/vRh5Qee2RV459GBOA=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4P0F-0004sX-AR; Sat, 08 Aug 2020 15:35:28 +0200 From: Lars Ingebrigtsen References: <36733993.7486.1585172578563@office.mailbox.org> Date: Sat, 08 Aug 2020 15:35:14 +0200 In-Reply-To: <36733993.7486.1585172578563@office.mailbox.org> (Florian v. Savigny's message of "Wed, 25 Mar 2020 22:42:58 +0100 (CET)") Message-ID: <87o8nlz2el.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: "Florian v. Savigny" writes: > The attached is a diff against sql.el version 3.6 as shipped with > Emacs 26.3. that implements propertizing such double apostrophes > within strings with a punctuation syntax table property. (I hav [...] 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: 0.0 (/) 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 (-) "Florian v. Savigny" writes: > The attached is a diff against sql.el version 3.6 as shipped with > Emacs 26.3. that implements propertizing such double apostrophes > within strings with a punctuation syntax table property. (I have > posted the code with exhaustive comments, which I thought excessive > for working code, at the above URL.) Thanks! I don't use sql-mode much, but I tested the patch, and it seems to fix the problem with strings 'like''this', so I've applied it to Emacs 28.1. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 08 09:35:42 2020 Received: (at control) by debbugs.gnu.org; 8 Aug 2020 13:35:42 +0000 Received: from localhost ([127.0.0.1]:58526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4P0g-0001pc-59 for submit@debbugs.gnu.org; Sat, 08 Aug 2020 09:35:42 -0400 Received: from quimby.gnus.org ([95.216.78.240]:51838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4P0f-0001pE-9p for control@debbugs.gnu.org; Sat, 08 Aug 2020 09:35:41 -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=YYDyDuzBqm/t1mZzUcTWRfLiwV2iTLqRSJaJb3wCCrg=; b=Qlw+sFlsftXLn0VMyoZIsuy52a QjdrTatI38Epj3QJEzlP3aEPdfw2hYqwHZEanalnZI0Ca1NhFdLyZg+Cwu1W8Y3T1M1O29KLr3KZT gT1qhAvzg/npBxJeEzAo5qzM4PeepvztYwXaVi7ZGE477gE1ob/O1N9bso5ypqpFP6go=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4P0X-0004sm-HD for control@debbugs.gnu.org; Sat, 08 Aug 2020 15:35:35 +0200 Date: Sat, 08 Aug 2020 15:35:32 +0200 Message-Id: <87mu35z2e3.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #40231 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: tags 40231 fixed close 40231 28.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: 0.0 (/) 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: -1.0 (-) tags 40231 fixed close 40231 28.1 quit