unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: rehan malak <rehan.malak@gmail.com>
To: kobarity <kobarity@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	74738@debbugs.gnu.org
Subject: bug#74738: 31.0.50; Freezes in Python-mode on some Python file when searching or scrolling
Date: Thu, 12 Dec 2024 04:49:34 +0100	[thread overview]
Message-ID: <CABGgh3Bf8EdR-E0dzMd1XA1-+Whvq84yGmo=YyRd0LhTiqnwuw@mail.gmail.com> (raw)
In-Reply-To: <eke7ldwmxpp9.wl-kobarity@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]

thanks kobarity, with your patch, I confirm that :
- I can open gef.py and scroll
- I get the correct font-lock-string-face in the f-string after a "#" in
the format

On Wed, Dec 11, 2024 at 3:24 PM kobarity <kobarity@gmail.com> wrote:

> rehan malak wrote:
> > Deleting all the "#" in the f-string of the gef.py file removes the
> problem on my side.
> >  sed -i -e 's/#0{align/0{align/g' gef.py
> >  sed -i -e 's/#0{width/0{width/g' gef.py
> >  sed -i -e 's/#07x}/07x}/g' gef.py
> >  sed -i -e 's/#06x}/06x}/g' gef.py
> >  sed -i -e 's/#04x}/04x}/g' gef.py
> >  sed -i -e 's/#4x}/4x}/g' gef.py
> >  sed -i -e 's/#8x}/8x}/g' gef.py
> >  sed -i -e 's/#10x}/10x}/g' gef.py
> >  sed -i -e 's/#x}/x}/g' gef.py
> >
> > Your smaller example Eli also contains a f-string with the "#".
> >
> > This python f-string format specifier is described here:
> >
> https://docs.python.org/3/library/string.html#format-specification-mini-language
> >
> > Is this format specifier supported from the beginning ?
> >
> > For example :
> >
> > value = 0xab
> > print(f"{value:x} is a value")
> >
> > => color syntax : is a value    has the color defined by
> font-lock-string-face
> >
> > while
> >
> > value = 0xab
> > print(f"{value:#x} is a value")
> >
> > => color are messed up... is has color defined by font-lock-keyword-face
> and a value has color defined by default face
>
> The mechanism of the hang is still unclear, but I found the cause of
> the font-lock malfunction: when using `up-list' to find the
> corresponding closing brace for an opening brace in an f-string, if
> the format specifier contains "#", the rest of the string is
> considered a comment and the search fails.  Therefore, it can be
> worked around by temporarily binding `parse-sexp-ignore-comments' to
> nil, as in the attached patch.
>
> Hangs on gef.py can also be avoided with this patch, but it assumes
> that the braces are properly closed.  If you remove the closing braces
> of expressions containing "#", it will eventually hang.
>

[-- Attachment #2: Type: text/html, Size: 2855 bytes --]

  reply	other threads:[~2024-12-12  3:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-08 13:05 bug#74738: 31.0.50; Freezes in Python-mode on some Python file when searching or scrolling rehan malak
2024-12-08 17:37 ` Eli Zaretskii
2024-12-09 14:58   ` rehan malak
2024-12-11 14:24     ` kobarity
2024-12-12  3:49       ` rehan malak [this message]
2024-12-09 15:04   ` kobarity

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='CABGgh3Bf8EdR-E0dzMd1XA1-+Whvq84yGmo=YyRd0LhTiqnwuw@mail.gmail.com' \
    --to=rehan.malak@gmail.com \
    --cc=74738@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=kobarity@gmail.com \
    --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).