GNU bug report logs - #40231
sql.el: patch for syntax table propertizing escaped apostrophes in SQL strings as punctuation syntax class

Previous Next

Package: emacs;

Reported by: "Florian v. Savigny" <f.savigny <at> mailbox.org>

Date: Wed, 25 Mar 2020 21:44:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 40231 in the body.
You can then email your comments to 40231 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#40231; Package emacs. (Wed, 25 Mar 2020 21:44:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Florian v. Savigny" <f.savigny <at> mailbox.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 25 Mar 2020 21:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Florian v. Savigny" <f.savigny <at> mailbox.org>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Cc: Michael Mauger <michael <at> mauger.com>
Subject: sql.el: patch for syntax table propertizing escaped apostrophes in
 SQL strings as punctuation syntax class
Date: Wed, 25 Mar 2020 22:42:58 +0100 (CET)
[Message part 1 (text/plain, inline)]
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, which cannot handle this construct.

This should be an adequate description of the limitation/bug, but more details are available at: 

   https://emacs.stackexchange.com/questions/56352/can-syntax-parsing-recognize-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 exhaustive comments, which I thought excessive for working code, at the above URL.) My tests were movement commands across sexps, which crossed the whole string, and the return value of 

  (syntax-ppss (point))

which returned a list such as 

  (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 
Siebenpfeiffer Str. 25 
66482 Zweibrücken 
Germany

0175 - 365 24 17
[sql.el-syntax-parsing-escaped-apostrophes.diff (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40231; Package emacs. (Sat, 08 Aug 2020 13:36:02 GMT) Full text and rfc822 format available.

Message #8 received at 40231 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Florian v. Savigny" <f.savigny <at> mailbox.org>
Cc: Michael Mauger <michael <at> mauger.com>, 40231 <at> debbugs.gnu.org
Subject: Re: bug#40231: sql.el: patch for syntax table propertizing escaped
 apostrophes in SQL strings as punctuation syntax class
Date: Sat, 08 Aug 2020 15:35:14 +0200
"Florian v. Savigny" <f.savigny <at> mailbox.org> 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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 13:36:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 40231 <at> debbugs.gnu.org and "Florian v. Savigny" <f.savigny <at> mailbox.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 13:36:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Sep 2020 11:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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