bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44653: 28.0.50; sql-mode gets confused about string literals


From: Lars Ingebrigtsen
Subject: bug#44653: 28.0.50; sql-mode gets confused about string literals
Date: Wed, 27 Jan 2021 04:57:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Dale Sedivec <dale@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]