all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 12747@debbugs.gnu.org, Oleksandr Gavenko <gavenkoa@gmail.com>
Subject: bug#12747: 23.4; diff-auto-refine-mode process only last hunk in diff (must ALL).
Date: Wed, 11 Jul 2018 20:28:47 -0400	[thread overview]
Message-ID: <87601lb8lc.fsf@gmail.com> (raw)
In-Reply-To: <jwvvcdusoi9.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 28 Oct 2012 09:54:22 -0400")

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

merge 12747 16798 18128 21744
tags 12747 fixed
close 12747 27.1
quit

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> This is not a bug.  IIUC you'd like the refinement to be done in any
> hunk that is ever displayed, right?
> If so, that is a valid request for enhancement, and I fully agree.
> If someone is interested in implementing it, here's how I think it would
> have to work:
> - add a font-lock-keywords rule in diff-mode which simply registers the
>   region displayed in a buffer-local var `diff--regions-displayed'.
> - have an idle timer that checks `diff--regions-displayed' and refines
>   all the hunks in those regions (and it should also font-lock those
>   hunks at the same time, so that if some of the hunk is not yet
>   displayed and not yet font-locked, displaying it later on won't cause
>   re-refining the hunk).

I think you've implemented this now [1: f8b1e40fb6], though not quite in
the way you describe (I don't see any timers).

[1: f8b1e40fb6]: 2018-07-10 22:52:21 -0400
  * lisp/vc/diff-mode.el: Perform hunk refinement from font-lock
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f8b1e40fb63b0a6bc6692cc0bc84e5f5e65c2644

This reminds that magit users found binding write-region-inhibit-fsync
around smerge-refine-regions made a noticable performance difference.
So should we add something like this?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1311 bytes --]

From e5f3cf973c37ddaca92cc819d95d896ca0d869c7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Wed, 11 Jul 2018 20:13:25 -0400
Subject: [PATCH] Speed up smerge-refine-regions by avoiding fsync

* lisp/vc/smerge-mode.el (smerge-refine-regions): Bind
write-region-inhibit-fsync to t.
---
 lisp/vc/smerge-mode.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index cb51fbab8e..cb9880c80d 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -1075,9 +1075,10 @@ smerge-refine-regions
           (if smerge-refine-weight-hack (make-hash-table :test #'equal))))
     (unless (markerp beg1) (setq beg1 (copy-marker beg1)))
     (unless (markerp beg2) (setq beg2 (copy-marker beg2)))
-    ;; Chop up regions into smaller elements and save into files.
-    (smerge--refine-chopup-region beg1 end1 file1 preproc)
-    (smerge--refine-chopup-region beg2 end2 file2 preproc)
+    (let ((write-region-inhibit-fsync t)) ; Don't fsync temp files.
+      ;; Chop up regions into smaller elements and save into files.
+      (smerge--refine-chopup-region beg1 end1 file1 preproc)
+      (smerge--refine-chopup-region beg2 end2 file2 preproc))
 
     ;; Call diff on those files.
     (unwind-protect
-- 
2.11.0


  parent reply	other threads:[~2018-07-12  0:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-28 12:13 bug#12747: 23.4; diff-auto-refine-mode process only last hunk in diff (must ALL) Oleksandr Gavenko
2012-10-28 13:54 ` Stefan Monnier
2012-10-28 19:38   ` Oleksandr Gavenko
2012-10-28 20:29     ` Stefan Monnier
2018-07-12  0:28   ` Noam Postavsky [this message]
2018-07-12 13:28     ` Stefan Monnier
2018-07-12 19:54       ` Noam Postavsky
2018-07-12 20:17         ` Stefan Monnier
2018-07-13  1:47       ` Noam Postavsky

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=87601lb8lc.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=12747@debbugs.gnu.org \
    --cc=gavenkoa@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 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.