unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Dale Sedivec <dale@codefu.org>
Cc: 44653@debbugs.gnu.org, Stefan Monnier <monnier@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	[thread overview]
Message-ID: <87o8hbc9qu.fsf@gnus.org> (raw)
In-Reply-To: <04127C97-3437-4A95-9640-92347FB62FE4@codefu.org> (Dale Sedivec's message of "Sun, 15 Nov 2020 00:37:08 -0600")

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





  parent reply	other threads:[~2021-01-27  3:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15  6:37 bug#44653: 28.0.50; sql-mode gets confused about string literals Dale Sedivec
2020-11-16 22:42 ` Lars Ingebrigtsen
2021-01-27  3:57 ` Lars Ingebrigtsen [this message]
2021-01-27 18:09   ` Dale Sedivec
2021-01-28  4:35     ` Lars Ingebrigtsen
2021-01-28  4:48       ` Lars Ingebrigtsen
2021-01-28  9:41     ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8hbc9qu.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=44653@debbugs.gnu.org \
    --cc=dale@codefu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).