From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: kobarity <kobarity@gmail.com>
Cc: Tom Gillespie <tgbugs@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
63622@debbugs.gnu.org
Subject: bug#63622: lisp/progmodes/python.el: performance regression introduced by multiline font-lock
Date: Mon, 22 May 2023 11:08:35 -0400 [thread overview]
Message-ID: <jwvmt1wo176.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <eke7o7mch0pu.wl-kobarity@gmail.com> (kobarity@gmail.com's message of "Mon, 22 May 2023 23:58:37 +0900")
> @@ -869,18 +869,20 @@ python-font-lock-keywords
> Which one will be chosen depends on the value of
> `font-lock-maximum-decoration'.")
>
> -(defun python-font-lock-extend-region (beg end _old-len)
> - "Extend font-lock region given by BEG and END to statement boundaries."
> - (save-excursion
> - (save-match-data
> - (goto-char beg)
> - (python-nav-beginning-of-statement)
> - (setq beg (point))
> - (goto-char end)
> - (python-nav-end-of-statement)
> - (setq end (point))
> - (cons beg end))))
> -
> +(defvar font-lock-beg)
> +(defvar font-lock-end)
> +(defun python-font-lock-extend-region ()
> + "Extend font-lock region to statement boundaries."
> + (let ((beg font-lock-beg)
> + (end font-lock-end))
> + (goto-char beg)
> + (python-nav-beginning-of-statement)
> + (setq font-lock-beg (point))
> + (goto-char end)
> + (python-nav-end-of-statement)
> + (when (not (eobp)) (forward-char))
> + (setq font-lock-end (point))
> + (or (/= beg font-lock-beg) (/= end font-lock-end))))
>
> (defconst python-syntax-propertize-function
> (syntax-propertize-rules
Looks fine to me (I assume you've checked that it behaves about as well
as the previous code).
> @@ -6708,8 +6710,8 @@ python-mode
> nil nil nil nil
> (font-lock-syntactic-face-function
> . python-font-lock-syntactic-face-function)
> - (font-lock-extend-after-change-region-function
> - . python-font-lock-extend-region)))
> + (font-lock-extend-region-functions
> + . (python-font-lock-extend-region))))
> (setq-local syntax-propertize-function
> python-syntax-propertize-function)
> (setq-local imenu-create-index-function
This is bound to break in some cases. Please use `add-hook` instead.
Stefan
next prev parent reply other threads:[~2023-05-22 15:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-21 3:14 bug#63622: lisp/progmodes/python.el: performance regression introduced by multiline font-lock Tom Gillespie
2023-05-21 4:53 ` bug#63622: source of problem identified to be python-font-lock-extend-region Tom Gillespie
2023-05-21 6:08 ` bug#63622: lisp/progmodes/python.el: performance regression introduced by multiline font-lock Eli Zaretskii
2023-05-21 7:13 ` Tom Gillespie
2023-05-21 9:31 ` kobarity
2023-05-21 15:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-22 14:58 ` kobarity
2023-05-22 15:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-23 15:45 ` kobarity
2023-05-23 17:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-23 19:04 ` Tom Gillespie
2023-05-23 23:21 ` kobarity
2023-05-24 18:53 ` Tom Gillespie
2023-05-23 23:41 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-24 15:05 ` kobarity
2023-05-26 10:01 ` Eli Zaretskii
2023-05-21 15:44 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvmt1wo176.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=63622@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=kobarity@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=tgbugs@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.