GNU bug report logs -
#18128
Diff-mode doesn't refine hunks automatically
Previous Next
Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>
Date: Mon, 28 Jul 2014 14:00:02 UTC
Severity: wishlist
Tags: fixed
Merged with 12747,
16798,
21744
Found in versions 23.4, 24.5
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #34 received at control <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
merge 12747 16798 18128 21744
tags 12747 fixed
close 12747 27.1
quit
Stefan Monnier <monnier <at> 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?
[0001-Speed-up-smerge-refine-regions-by-avoiding-fsync.patch (text/x-diff, inline)]
From e5f3cf973c37ddaca92cc819d95d896ca0d869c7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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
This bug report was last modified 7 years and 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.