From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Spencer Newsgroups: gmane.emacs.bugs Subject: bug#51362: python font-lock-mode in emacs 28 seems broken Date: Sun, 24 Oct 2021 17:40:44 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fa219e05cf20ef1f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1118"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51362@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 25 00:42:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1memC0-00006F-L2 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Oct 2021 00:42:16 +0200 Original-Received: from localhost ([::1]:47688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1memBy-0002bQ-Q3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 18:42:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1memBm-0002a7-Cd for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 18:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1memBm-0005s7-4S for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 18:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1memBm-0003I6-2h for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 18:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jeff Spencer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Oct 2021 22:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 51362-submit@debbugs.gnu.org id=B51362.163511526312577 (code B ref 51362); Sun, 24 Oct 2021 22:42:02 +0000 Original-Received: (at 51362) by debbugs.gnu.org; 24 Oct 2021 22:41:03 +0000 Original-Received: from localhost ([127.0.0.1]:41249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1memAo-0003Gn-Iq for submit@debbugs.gnu.org; Sun, 24 Oct 2021 18:41:02 -0400 Original-Received: from mail-ot1-f49.google.com ([209.85.210.49]:44765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1memAn-0003GC-79 for 51362@debbugs.gnu.org; Sun, 24 Oct 2021 18:41:01 -0400 Original-Received: by mail-ot1-f49.google.com with SMTP id d21-20020a9d4f15000000b0054e677e0ac5so12277315otl.11 for <51362@debbugs.gnu.org>; Sun, 24 Oct 2021 15:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9fmnX77FLhBhZDsyarrvY7n1KSSvzyPm+XPis1UuQF0=; b=kdYPlyCvE72G/cJR49PSLq2cDOfvwC5DCgR8FEgg8bIQOVMv1zb1O/qRp2EFEWi1Yy LBrVkFASu4tUtRjHSeGma2uCyw9P94w5vje25ATB+xxaMt9IVNTC4l/Kyjc9CyPddbnu sAGsWNmtvxOSp20mjfyObGM/TrZpvK172vXM0VLKLQZDyG3XnctKwADL9qLpbgwb3SlY tp9lRRrs3vfHtt7CNh7t/W8qdB6dwtw9gslwUqiKzDzwVmV4eYO75LYOIwts7FRP2XjE ALJGJAxmk84jFErF8y/rHHBj043GsXOjFmwsbyCYuNBVqwWQ5f5lDqxz+lWTrfKIjhRI ogIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9fmnX77FLhBhZDsyarrvY7n1KSSvzyPm+XPis1UuQF0=; b=CemGVJ6fcI6zoMAAnL+IlAkrwPBaJ8F3hY7ZxVKlisq7llXbwfyRjw7lL0wPQMFfp1 DUengIUMRhJ1OlzxSLV22tj3VHwM96aLesHshL3dBs7e9DmFi2DN2LFoFmqL9+niDOLx rD5gRb2TLSPN+c7mLL3JZb4qwXZJxVyllHnYVTWYWWEt4EHoF3Kis5CocDOehb7KIWXO 69iRIK1G1sr6Cq+AJ+NVFVxMh7ls3udKND50Xca4xLiaxr0Puef/pQZqHHvh1fEum/NV smcDEZzbOoftit+UtDkc8aDVh9BP6rxuvpt1waa3gNBgwxy0rKDLHTQod+ZrS9MVzTLP l0pg== X-Gm-Message-State: AOAM530dTxCzqusP+ipyKC6/DkfsbF08tVL26s6Sn6M7yl6Y63ITG/b3 QRe3sExT5DZQ5Odd97MYQBbsbRqW0SfNWpvUw3xR+lpe++E= X-Google-Smtp-Source: ABdhPJxtPRrINQhXavAuk4lpzSZStSmLzVMy8sWR44yl4I6JMPsA2Hd6Amk9zSvfE7WrawYPhgOUE5co3VdJB4FkEn8= X-Received: by 2002:a05:6830:922:: with SMTP id v34mr10924680ott.223.1635115255602; Sun, 24 Oct 2021 15:40:55 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218231 Archived-At: --000000000000fa219e05cf20ef1f Content-Type: text/plain; charset="UTF-8" Also, the snapshot_spec when colored is `font-lock-function-name-face`, but when not it has no face property. On Sun, Oct 24, 2021 at 5:37 PM Jeff Spencer wrote: > Here is a somewhat minimal example. What is weird is it is inconsistent. > If I save this as `test.py` and load it none of the `snapshot_spec` are > colored, but they are just normal text. If on the line where snapshot_spec > is defined I delete the tuple part of input_tuple it will be highlighted > correctly and remains that way. Then if I go back up and I for example > delete `| datetime` then it goes back to no color. > > ``` > from __future__ import annotations > > from datetime import datetime > > import pandas as pd > > > def make_snapshot_temp(input_tuple: tuple, window: int, date: str | > datetime) -> None: > > snapshot_spec = pd.DataFrame(input_tuple, columns=["lead_id"]) > snapshot_spec["snapshot_to_date"] = pd.to_datetime(date) > > if window == 0: > snapshot_spec["snapshot_from_date"] = pd.to_datetime("2017-04-01") > snapshot_spec["snapshot_window"] = "all-time" > > return snapshot_spec > ``` > > On Sun, Oct 24, 2021 at 7:45 AM Stefan Kangas wrote: > >> Jeff Spencer writes: >> >> > If you look at the link below it doesn't highlight the `post_split_...` >> > variable but it does highlight the `df_train` variable below it >> > correctly. The link shows my settings, but this happens when starting >> > with emacs -Q as well. It seems the syntax highlighting got messed up >> > with the addition of the f-strings code. >> >> Do you have an example file or snippet where font-lock fails? >> > --000000000000fa219e05cf20ef1f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Also, the snapshot_spec when colored is `font-lock-functio= n-name-face`, but when not it has no face property.

On Sun, Oct 24, 2021 at = 5:37 PM Jeff Spencer <jeffspen= cerd@gmail.com> wrote:
Here is a somewhat minimal example. Wha= t is weird is it is inconsistent. If I save this as `test.py` and load it n= one of the `snapshot_spec` are colored, but they are just normal text. If o= n the line where snapshot_spec is defined I delete the tuple part of input_= tuple it will be highlighted correctly and remains that way. Then if I go b= ack up and I for example delete `| datetime` then it goes back to no color.=

```
from __future__ import annotations
from datetime import datetime

import pandas as pd


def m= ake_snapshot_temp(input_tuple: tuple, window: int, date: str | datetime) -&= gt; None:

=C2=A0 =C2=A0 snapshot_spec =3D pd.DataFrame(input_tuple, = columns=3D["lead_id"])
=C2=A0 =C2=A0 snapshot_spec["snaps= hot_to_date"] =3D pd.to_datetime(date)

=C2=A0 =C2=A0 if window = =3D=3D 0:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 snapshot_spec["snapshot_from_= date"] =3D pd.to_datetime("2017-04-01")
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 snapshot_spec["snapshot_window"] =3D "all-time&qu= ot;

=C2=A0 =C2=A0 return snapshot_spec
```

On Sun, Oct = 24, 2021 at 7:45 AM Stefan Kangas <stefan@marxist.se> wrote:
Jeff Spencer <jeffspencerd@gmail.com> writes:=

> If you look at the link below it doesn't highlight the `post_split= _...`
> variable but it does highlight the `df_train` variable below it
> correctly. The link shows my settings, but this happens when starting<= br> > with emacs -Q as well. It seems the syntax highlighting got messed up<= br> > with the addition of the f-strings code.

Do you have an example file or snippet where font-lock fails?
--000000000000fa219e05cf20ef1f--