From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 71604@debbugs.gnu.org
Subject: bug#71604: diff--get-revision-properties calls set-auto-mode twice
Date: Mon, 17 Jun 2024 19:33:03 +0300 [thread overview]
Message-ID: <865xu7zg6o.fsf@mail.linkov.net> (raw)
In-Reply-To: <d4fc2e28-fcad-4233-adbf-eb029b41b606@gutov.dev> (Dmitry Gutov's message of "Mon, 17 Jun 2024 05:25:31 +0300")
> vc-find-revision-no-save calls set-auto-mode, and then we repeat that call
> in diff-syntax-fontify-props.
>
> Which is a problem with CC Mode because it parses the buffer inside the
> major mode function, and ends up doing that twice, at least the first time
> the buffer is initialized before being saved to revision cache. Not exactly
> double the work, but more work nevertheless.
>
> This is a split off from https://debbugs.gnu.org/61667#587. I thought
> I recalled an existing report of vc-diff being slow, but apparently not.
>
> @@ -2883,9 +2883,6 @@ diff--get-revision-properties
> (buffer (cdr entry)))
> (if (buffer-live-p buffer)
> (progn
> - ;; Don't re-initialize the buffer (which would throw
> - ;; away the previous fontification work).
> - (setq file nil)
> (setq diff--cached-revision-buffers
> (cons entry
> (delq entry diff--cached-revision-buffers))))
> @@ -2905,7 +2902,8 @@ diff--get-revision-properties
> (diff--cache-schedule-clean)
> (and buffer
> (with-current-buffer buffer
> - (diff-syntax-fontify-props file text line-nb)))))
> + ;; major mode is set in vc-find-revision-no-save already.
> + (diff-syntax-fontify-props nil text line-nb)))))
Thanks, looks correct.
next prev parent reply other threads:[~2024-06-17 16:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 2:25 bug#71604: diff--get-revision-properties calls set-auto-mode twice Dmitry Gutov
2024-06-17 16:33 ` Juri Linkov [this message]
2024-06-17 20:01 ` Dmitry Gutov
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=865xu7zg6o.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=71604@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
/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.