GNU bug report logs - #51362
python font-lock-mode in emacs 28 seems broken

Previous Next

Package: emacs;

Reported by: Jeff Spencer <jeffspencerd <at> gmail.com>

Date: Sat, 23 Oct 2021 20:08:02 UTC

Severity: normal

Tags: moreinfo

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 51362 <at> debbugs.gnu.org (full text, mbox):

From: Jeff Spencer <jeffspencerd <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 51362 <at> debbugs.gnu.org
Subject: Re: bug#51362: python font-lock-mode in emacs 28 seems broken
Date: Sun, 24 Oct 2021 17:37:39 -0500
[Message part 1 (text/plain, inline)]
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 <stefan <at> marxist.se> wrote:

> Jeff Spencer <jeffspencerd <at> 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
> > 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?
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 7 days ago.

Previous Next


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