From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs 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 Message-ID: <87601lb8lc.fsf@gmail.com> References: <87y5iqbxqn.fsf@gavenkoa.example.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1531355228 9966 195.159.176.226 (12 Jul 2018 00:27:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 12 Jul 2018 00:27:08 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 12747@debbugs.gnu.org, Oleksandr Gavenko To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 12 02:27:03 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdPRm-0002Uh-6G for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Jul 2018 02:27:02 +0200 Original-Received: from localhost ([::1]:55909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdPTt-0003ri-AD for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Jul 2018 20:29:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdPTn-0003qe-2I for bug-gnu-emacs@gnu.org; Wed, 11 Jul 2018 20:29:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdPTi-0007Da-51 for bug-gnu-emacs@gnu.org; Wed, 11 Jul 2018 20:29:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fdPTh-0007DI-Uq for bug-gnu-emacs@gnu.org; Wed, 11 Jul 2018 20:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fdPTh-0002JY-KZ for bug-gnu-emacs@gnu.org; Wed, 11 Jul 2018 20:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jul 2018 00:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12747 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12747-submit@debbugs.gnu.org id=B12747.15313553398885 (code B ref 12747); Thu, 12 Jul 2018 00:29:01 +0000 Original-Received: (at 12747) by debbugs.gnu.org; 12 Jul 2018 00:28:59 +0000 Original-Received: from localhost ([127.0.0.1]:56087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdPTe-0002JE-M6 for submit@debbugs.gnu.org; Wed, 11 Jul 2018 20:28:58 -0400 Original-Received: from mail-it0-f48.google.com ([209.85.214.48]:55633) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdPTb-0002Iq-AL; Wed, 11 Jul 2018 20:28:55 -0400 Original-Received: by mail-it0-f48.google.com with SMTP id 16-v6so4882089itl.5; Wed, 11 Jul 2018 17:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=E7/kTgHKTXCfupfijdBofeXLt2Si55/QfWQafReTof4=; b=NHaZ/D/e1/1rmEnP2Vl+S2YCYS1J9RAosq415olUX5NLc3aGMd1rY9goXZfPgHwWnT 3AkywWtNmAtMTVKrQdUtM9OGVRk1xTSdu1DNk6U5WcTOCU4R19rKFsw5B9jXX4JKLm5r 826Ykn1nDrLNlX5Ofr9qNt1AUrGYJn4z2+khxFfQnGYEvabZLiFuu5DIKw5YSK6R+Sjv fsCc1XELygPJXzkp8QPDdPpOeNlMZUI3zmdBRm4LANA1bSBqWTJNyED+NrhQhWCN6qzA 6CP591+RhDvGlXulJQq/mL1cA84tdOUJE6slSF2ZDmNX+TtDDlrFmedule9/N6ANkWDG UKCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=E7/kTgHKTXCfupfijdBofeXLt2Si55/QfWQafReTof4=; b=KYUFz3UUiCaTqdQGsnj4s/2GvG3kcffD2yz0uQDjBWYfkMQ0GMGtoreW8pg+3jYhHR ITvJux2O6OnPiVws1u+J8IVq9OT6zr7CziSOHGVmvirh1W0BQOLE/TDCkezK9mIdIPgX YZYgnIhlcRWOaJdnxOJ+1dstNuilzB2AOaTH1dtqPsnDUmMiRdY1yMewZDGjlUqWnv1T 2HsDGDSLPaTABN/tTci8QWJLRVd7HbOQiyOi3FXSGqVz0314SiL1QVZIo0RmXCN20Ewi ndVHWbP6AtdkPg67hGKxGPNAZEtWW843+u9MMOLCmjR662Nr1hilF+zmo29led5XhsIJ OeVQ== X-Gm-Message-State: AOUpUlGSoZAn4OL0LyhMUE4bVY/9Bt/M5D+cSCEZ+zzVsOjirTifpY9A DYoqqfOslonJkoYq7EacZ9brBA== X-Google-Smtp-Source: AAOMgpd7o2eJXFdZr7zNeULw5y8EgrryKDdgv8BBzmJFM20LY8VFtDEOdl4Fx/hu6R6sannCmHKKeQ== X-Received: by 2002:a02:45cd:: with SMTP id o74-v6mr23206jad.43.1531355329728; Wed, 11 Jul 2018 17:28:49 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m7-v6sm6350409iog.30.2018.07.11.17.28.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 17:28:48 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 28 Oct 2012 09:54:22 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148459 Archived-At: --=-=-= Content-Type: text/plain merge 12747 16798 18128 21744 tags 12747 fixed close 12747 27.1 quit Stefan Monnier 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Speed-up-smerge-refine-regions-by-avoiding-fsync.patch Content-Description: patch >From e5f3cf973c37ddaca92cc819d95d896ca0d869c7 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--