GNU bug report logs - #44653
28.0.50; sql-mode gets confused about string literals

Previous Next

Package: emacs;

Reported by: Dale Sedivec <dale <at> codefu.org>

Date: Sun, 15 Nov 2020 06:38:01 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dale Sedivec <dale <at> codefu.org>
Cc: 44653 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#44653: 28.0.50; sql-mode gets confused about string literals
Date: Wed, 27 Jan 2021 04:57:29 +0100
Dale Sedivec <dale <at> codefu.org> writes:

> I think `syntax-ppss' has started returning incorrect information about
> apostrophe-delimited strings in sql-mode in master.  I am actually on
> native-comp with this afternoon's master merged in myself, but I am
> fairly confident you can reproduce this on master, nothing to do with
> native-comp.
>
> Steps to reproduce:
>
> 1. emacs -Q
>
> 2. Evaluate the following in *scratch*:
>
>       (let ((buf (generate-new-buffer "sql")))
>         (switch-to-buffer buf)
>         (sql-mode)
>         (insert "select '''")
>         (goto-char 1)
>         (delete-region 1 8)
>         (goto-char (point-max)))
>
>    Point should now be at the end of an `sql-mode' buffer containing
>    "'''" (three apostrophes).
>
> 4. Press backspace to erase the third apostrophe.
>
> 5. M-: (nth 3 (syntax-ppss)) RET
>
> Expected result: fourth element of syntax-ppss, the delimiter character
> for the current string, is nil, since we are no longer in a string
>
> Observed result: fourth element is ?' (39), indicating that point is
> still inside a string

I can reproduce this behaviour...  but if I then type, say, "a DEL",
then (nth 3 (syntax-ppss)) returns nil.

So it seems like syntax-ppss doesn't recompute the status until a new
character is inserted...  which I think makes sense?  Until you've typed
something more, Emacs doesn't really know whether we've entered a new
syntax state or not here.

(I'm also wondering what the actual bug you're experiencing is, since
I', guessing you don't go typing M-: (nth 3 (syntax-ppss)) RET at random
just for fun.  :-))

I've added Stefan M to the CCs; perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 198 days ago.

Previous Next


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