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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Dale Sedivec <dale@HIDDEN>; dated Sun, 15 Nov 2020 06:38:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 44653 <at> debbugs.gnu.org:


Received: (at 44653) by debbugs.gnu.org; 16 Nov 2020 22:43:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 16 17:43:19 2020
Received: from localhost ([127.0.0.1]:57639 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kenDT-00048t-5b
	for submit <at> debbugs.gnu.org; Mon, 16 Nov 2020 17:43:19 -0500
Received: from quimby.gnus.org ([95.216.78.240]:39924)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kenDR-00048e-7I
 for 44653 <at> debbugs.gnu.org; Mon, 16 Nov 2020 17:43:17 -0500
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=jmdtSeFJllKxUJM+5dvIREgqQomjhJlByI6xq3UZ3H0=; b=jlgoyTi4qOeWR4IvZh8gqbdaM6
 A8BNrHBUfg6wI4Ws8Ic1joN0nGzwe+NBpSuaqh/gSsqFt7Zp9BcdlCn2lncqKPDm8Jg08ODQEDkWu
 IgYEFIocXtaCN6QpwkFpYd26/rUECH4kFETV1Wa2eNCZ0wWA7QuXzNX8L9Zpf1rqt8zU=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kenD8-0006er-5J; Mon, 16 Nov 2020 23:43:10 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Florian v. Savigny <f.savigny@HIDDEN>
Subject: Re: bug#44653: 28.0.50; sql-mode gets confused about string literals
References: <04127C97-3437-4A95-9640-92347FB62FE4@HIDDEN>
X-Now-Playing: Various's _Amchitka (2)_: "Joni Mitchell - A Case Of You"
Date: Mon, 16 Nov 2020 23:42:56 +0100
In-Reply-To: <04127C97-3437-4A95-9640-92347FB62FE4@HIDDEN> (Dale Sedivec's
 message of "Sun, 15 Nov 2020 00:37:08 -0600")
Message-ID: <874klovs7j.fsf@HIDDEN>
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: Dale Sedivec <dale@HIDDEN> writes: > 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 [...] 
 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: 44653
Cc: 44653 <at> debbugs.gnu.org, Dale Sedivec <dale@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Dale Sedivec <dale@HIDDEN> writes:

> 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
>
> My first guess is that this is related to commit 289d6b2265e and #40231.

Yes, sounds likely.  I've added Florian to the Cc's -- perhaps he has
some comments here.

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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#44653; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Nov 2020 06:37:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 15 01:37:35 2020
Received: from localhost ([127.0.0.1]:52437 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1keBfL-0007I3-0X
	for submit <at> debbugs.gnu.org; Sun, 15 Nov 2020 01:37:35 -0500
Received: from lists.gnu.org ([209.51.188.17]:58614)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dale@HIDDEN>) id 1keBfJ-0007Hv-VU
 for submit <at> debbugs.gnu.org; Sun, 15 Nov 2020 01:37:34 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:44964)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dale@HIDDEN>) id 1keBfJ-0006G7-Ou
 for bug-gnu-emacs@HIDDEN; Sun, 15 Nov 2020 01:37:33 -0500
Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:42188)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <dale@HIDDEN>) id 1keBfH-0005oU-59
 for bug-gnu-emacs@HIDDEN; Sun, 15 Nov 2020 01:37:33 -0500
Received: by mail-il1-x132.google.com with SMTP id g15so12211294ilc.9
 for <bug-gnu-emacs@HIDDEN>; Sat, 14 Nov 2020 22:37:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=codefu-org.20150623.gappssmtp.com; s=20150623;
 h=from:content-transfer-encoding:mime-version:subject:message-id:date
 :to; bh=/CD/5BeelcHK3d3t049p2uyFEH2dwlLu+B6gHZfwI+4=;
 b=fFjcTE3kXQFuU0crG8+rFgN7BV2ZtifOwfRwC94BwCcIsM3oxFIjb0yBS1PZlCErZw
 fLtYNTj5Wfa1nxMlFksCFuBPHxPutDKY3kJeCebnuYHdcOWN67lvXNtFUNaDivkLophd
 lNp3UjfrNjuOInVIaSuX3XCvsEGswnJQc6m2N86prjtiZCk6cFYn29KQzOVLjUcCrRq8
 jX5UQVNbzOzSSAGFoDfcYuHiisk8Zq/b3+5MoXc9LO7t4ithpZdWk/rjd9bZhqi2BzEt
 PmxIdZm/Hsg0mIRaQuXj1DjQ8mbf5Js+WIeUujgXqu2fbHuhWhuuBkBgyJm1/DHf+e6h
 fN0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:content-transfer-encoding:mime-version
 :subject:message-id:date:to;
 bh=/CD/5BeelcHK3d3t049p2uyFEH2dwlLu+B6gHZfwI+4=;
 b=DuiDBGrlm/GIlK2jP1RPivUOjx0jtReHyk+UuIJNPUqX6q9nkLtcAd/DjFlCd1l2Br
 Xd7CCtdm66MHNwhB9GDUzZs35aQoSTj+ipvDZrYQJofU8i9jgxIsZqJHKPfaimRNUBEH
 Bv4Z4PisoABRFaGLkHuiXKUmg9dhoKjvuTPW9LZ5AVqEhTyTtySynabrW7p9EtdVRt1f
 Sld3Kdpwfx/5aiyRxloe2VRAX/zgDlM9OUc4XZbkNIV3pgRwN+i2hwwc6UpfzdcxinMS
 cgS0E5G9/uvCxI5JT0NT6FWy5/4+5Kdl/U6cso/52duEKshIbHDiY1I5IzsHxA6L/ZP3
 PcvQ==
X-Gm-Message-State: AOAM533NRj9kf7gXTqR6yXapbP7Rb2hn63eiX2H6Royls8UPdc478ioC
 vQADZ2sCS8avE5SwQSbthcg8mI9L4AcLFNvf
X-Google-Smtp-Source: ABdhPJxb4+XGvq0xrBZzWn/2N7rMfagPF3pQGSiszblGvHiX4f68NmB7bZ8U2JCBVobPkv7iruRUUg==
X-Received: by 2002:a92:5b8c:: with SMTP id c12mr5083991ilg.293.1605422229678; 
 Sat, 14 Nov 2020 22:37:09 -0800 (PST)
Received: from dale.caliginous.net (152.160.30.136.in-addr.arpa.
 [136.30.160.152])
 by smtp.gmail.com with ESMTPSA id n4sm7483622iox.6.2020.11.14.22.37.09
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 14 Nov 2020 22:37:09 -0800 (PST)
From: Dale Sedivec <dale@HIDDEN>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\))
Subject: 28.0.50; sql-mode gets confused about string literals
Message-Id: <04127C97-3437-4A95-9640-92347FB62FE4@HIDDEN>
Date: Sun, 15 Nov 2020 00:37:08 -0600
To: bug-gnu-emacs@HIDDEN
X-Mailer: Apple Mail (2.3445.104.17)
Received-SPF: none client-ip=2607:f8b0:4864:20::132;
 envelope-from=dale@HIDDEN; helo=mail-il1-x132.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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

My first guess is that this is related to commit 289d6b2265e and #40231.

I came across this while trying to get back something resembling the
behavior of `electric-pair-mode', and in particular
`electric-pair-skip-self', as it was prior to 289d6b2265e.  I'm almost
there, but I ran into the above bug and got stuck.

Kind regards,
Dale


In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS =
appkit-1894.60 Version 10.15.7 (Build 19H15))
of 2020-11-14 built on dale
Repository revision: 99cbb313a3fd037b55ad3700635f607f56b0fa3e
Repository branch: feature/native-comp
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.7

Configured using:
'configure --without-x --with-modules --with-threads --with-xwidgets
--with-zlib --with-xml2 --with-json --with-cairo --with-gnutls
--with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-rsvg
--with-nativecomp --with-ns --enable-ns-self-contained 'CFLAGS=3D-O2
-I/opt/local/include/gcc10' LDFLAGS=3D-L/opt/local/lib/gcc10'

Configured features:
PNG RSVG GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
XIM NS MODULES NATIVE_COMP THREADS XWIDGETS JSON PDUMPER LCMS2

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: SQL[ANSI]

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils sql auth-source
eieio eieio-core eieio-loaddefs password-cache json map view thingatpt
comint ansi-color ring comp warnings subr-x rx cl-seq cl-macs cl-extra
help-mode easymenu seq byte-opt gv cl-loaddefs cl-lib bytecomp
byte-compile cconv tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face pcase macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads xwidget-internal kqueue cocoa
ns lcms2 multi-tty make-network-process nativecomp emacs)

Memory information:
((conses 16 83359 5743)
(symbols 48 8493 1)
(strings 32 23422 3672)
(string-bytes 1 888517)
(vectors 16 16669)
(vector-slots 8 316241 15044)
(floats 8 29 23)
(intervals 56 234 0)
(buffers 992 13))





Acknowledgement sent to Dale Sedivec <dale@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#44653; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 16 Nov 2020 22:45:01 UTC

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