* bug#18128: Diff-mode doesn't refine hunks automatically
@ 2014-07-28 13:59 Paul Pogonyshev
2014-07-28 14:28 ` Eli Zaretskii
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Paul Pogonyshev @ 2014-07-28 13:59 UTC (permalink / raw)
To: 18128
[-- Attachment #1: Type: text/plain, Size: 242 bytes --]
Diff-mode should just refine hunks automatically when visiting a buffer. If
it is a performance concern, there should be some customization option for
it and/or this could be done lazily.
Chunk refining is just too useful to not have.
Paul
[-- Attachment #2: Type: text/html, Size: 313 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 13:59 bug#18128: Diff-mode doesn't refine hunks automatically Paul Pogonyshev
@ 2014-07-28 14:28 ` Eli Zaretskii
2014-07-28 14:39 ` Paul Pogonyshev
2014-07-28 23:28 ` Stefan Monnier
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2014-07-28 14:28 UTC (permalink / raw)
To: Paul Pogonyshev; +Cc: 18128
> Date: Mon, 28 Jul 2014 15:59:12 +0200
> From: Paul Pogonyshev <pogonyshev@gmail.com>
>
> Diff-mode should just refine hunks automatically when visiting a buffer. If
> it is a performance concern, there should be some customization option for
> it and/or this could be done lazily.
>
> Chunk refining is just too useful to not have.
Why isn't diff-auto-refine-mode enough?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 14:28 ` Eli Zaretskii
@ 2014-07-28 14:39 ` Paul Pogonyshev
2014-07-28 14:44 ` Eli Zaretskii
2014-07-28 14:45 ` Paul Pogonyshev
0 siblings, 2 replies; 10+ messages in thread
From: Paul Pogonyshev @ 2014-07-28 14:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18128
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
It is enough. Then please add a reference to it to documentation of
diff-refine-hunk, I wasn't even aware of that mode.
Paul
On 28 July 2014 16:28, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 28 Jul 2014 15:59:12 +0200
> > From: Paul Pogonyshev <pogonyshev@gmail.com>
> >
> > Diff-mode should just refine hunks automatically when visiting a buffer.
> If
> > it is a performance concern, there should be some customization option
> for
> > it and/or this could be done lazily.
> >
> > Chunk refining is just too useful to not have.
>
> Why isn't diff-auto-refine-mode enough?
>
[-- Attachment #2: Type: text/html, Size: 995 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 14:39 ` Paul Pogonyshev
@ 2014-07-28 14:44 ` Eli Zaretskii
2014-07-28 14:49 ` Paul Pogonyshev
2014-07-28 14:45 ` Paul Pogonyshev
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2014-07-28 14:44 UTC (permalink / raw)
To: Paul Pogonyshev; +Cc: 18128
> Date: Mon, 28 Jul 2014 16:39:56 +0200
> From: Paul Pogonyshev <pogonyshev@gmail.com>
> Cc: 18128@debbugs.gnu.org
>
> It is enough. Then please add a reference to it to documentation of
> diff-refine-hunk, I wasn't even aware of that mode.
It is currently mentioned there as follows:
`M-n'
Move to the next hunk-start (`diff-hunk-next').
This command has a side effect: it "refines" the hunk you move to,
highlighting its changes with better granularity. To disable this
feature, type `M-x diff-auto-refine-mode' to toggle off the minor
mode Diff Auto-Refine mode. To disable Diff Auto Refine mode by
default, add this to your init file (*note Hooks::):
(add-hook 'diff-mode-hook
(lambda () (diff-auto-refine-mode -1)))
If you think this is not enough, please tell what else would you like
to see there about this minor mode.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 14:39 ` Paul Pogonyshev
2014-07-28 14:44 ` Eli Zaretskii
@ 2014-07-28 14:45 ` Paul Pogonyshev
1 sibling, 0 replies; 10+ messages in thread
From: Paul Pogonyshev @ 2014-07-28 14:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18128
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
Actually, it seems it is not enough. My usecase: I open a fairly large diff
file with many changes like
-bla bla bla a long line were some word was changed or maybe two
+bla bla bla a long line where some word was changed or maybe two
I want to be able to immediately see the changes, without reading whole
lines and certainly without visiting the hunks. When Emacs highlights the
change (there is only one above), I see it right away. Otherwise I have to
scan the lines with my eyes, which is tedious and error-prone. Of course I
can also hit C-c C-b on each hunk, but it feels like some sort of work I'd
prefer Emacs do for me.
Paul
On 28 July 2014 16:39, Paul Pogonyshev <pogonyshev@gmail.com> wrote:
> It is enough. Then please add a reference to it to documentation of
> diff-refine-hunk, I wasn't even aware of that mode.
>
> Paul
>
>
> On 28 July 2014 16:28, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > Date: Mon, 28 Jul 2014 15:59:12 +0200
>> > From: Paul Pogonyshev <pogonyshev@gmail.com>
>> >
>> > Diff-mode should just refine hunks automatically when visiting a
>> buffer. If
>> > it is a performance concern, there should be some customization option
>> for
>> > it and/or this could be done lazily.
>> >
>> > Chunk refining is just too useful to not have.
>>
>> Why isn't diff-auto-refine-mode enough?
>>
>
>
[-- Attachment #2: Type: text/html, Size: 2266 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 14:44 ` Eli Zaretskii
@ 2014-07-28 14:49 ` Paul Pogonyshev
0 siblings, 0 replies; 10+ messages in thread
From: Paul Pogonyshev @ 2014-07-28 14:49 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18128
[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]
I'd like hunks to be refined regardless of the way I move around the file.
E.g. if I chose to page-up through uninteresting parts of the diff,
auto-refinining shouldn't stop.
Paul
On 28 July 2014 16:44, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 28 Jul 2014 16:39:56 +0200
> > From: Paul Pogonyshev <pogonyshev@gmail.com>
> > Cc: 18128@debbugs.gnu.org
> >
> > It is enough. Then please add a reference to it to documentation of
> > diff-refine-hunk, I wasn't even aware of that mode.
>
> It is currently mentioned there as follows:
>
> `M-n'
> Move to the next hunk-start (`diff-hunk-next').
>
> This command has a side effect: it "refines" the hunk you move to,
> highlighting its changes with better granularity. To disable this
> feature, type `M-x diff-auto-refine-mode' to toggle off the minor
> mode Diff Auto-Refine mode. To disable Diff Auto Refine mode by
> default, add this to your init file (*note Hooks::):
>
> (add-hook 'diff-mode-hook
> (lambda () (diff-auto-refine-mode -1)))
>
> If you think this is not enough, please tell what else would you like
> to see there about this minor mode.
>
[-- Attachment #2: Type: text/html, Size: 1808 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 13:59 bug#18128: Diff-mode doesn't refine hunks automatically Paul Pogonyshev
2014-07-28 14:28 ` Eli Zaretskii
@ 2014-07-28 23:28 ` Stefan Monnier
2016-01-17 6:22 ` bug#18128: Should be done as part of the font-lock Hong Xu
2016-11-05 2:10 ` bug#18128: Diff-mode doesn't refine hunks automatically npostavs
3 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2014-07-28 23:28 UTC (permalink / raw)
To: Paul Pogonyshev; +Cc: 18128
> Diff-mode should just refine hunks automatically when visiting a buffer. If
> it is a performance concern, there should be some customization option for
> it and/or this could be done lazily.
Agreed, it should be done "as part of font-locking".
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Should be done as part of the font-lock
2014-07-28 13:59 bug#18128: Diff-mode doesn't refine hunks automatically Paul Pogonyshev
2014-07-28 14:28 ` Eli Zaretskii
2014-07-28 23:28 ` Stefan Monnier
@ 2016-01-17 6:22 ` Hong Xu
2016-11-04 7:54 ` Hong Xu
2016-11-05 2:10 ` bug#18128: Diff-mode doesn't refine hunks automatically npostavs
3 siblings, 1 reply; 10+ messages in thread
From: Hong Xu @ 2016-01-17 6:22 UTC (permalink / raw)
To: 18128
[-- Attachment #1: Type: text/plain, Size: 214 bytes --]
I agree that this should be done as part of the font-lock. This issue
not only causes inconvenience, but also causes bug #21990, which does
not allow htmlfontify to correctly display the highlighting.
Hong
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Should be done as part of the font-lock
2016-01-17 6:22 ` bug#18128: Should be done as part of the font-lock Hong Xu
@ 2016-11-04 7:54 ` Hong Xu
0 siblings, 0 replies; 10+ messages in thread
From: Hong Xu @ 2016-11-04 7:54 UTC (permalink / raw)
To: 18128
[-- Attachment #1: Type: text/plain, Size: 703 bytes --]
I currently use the following to do auto refining: (modified from
http://emacs.stackexchange.com/a/28321/2755 )
(defun my-diff-refine-all ()
"Refine all diffs."
(interactive)
(save-excursion
(goto-char (point-min))
(ignore-errors
(diff-beginning-of-hunk t))
(ignore-errors
(while (not (eobp))
(diff-refine-hunk)
(diff-hunk-next)))))
(defun my-diff-hunks-highlight-all ()
"Highlight all hunks in diff-mode."
(add-hook 'font-lock-mode-hook #'my-diff-refine-all t t))
(add-hook 'diff-mode-hook 'my-diff-hunks-highlight-all)
Not sure whether it is possible to merge into Emacs after some
adjustment.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#18128: Diff-mode doesn't refine hunks automatically
2014-07-28 13:59 bug#18128: Diff-mode doesn't refine hunks automatically Paul Pogonyshev
` (2 preceding siblings ...)
2016-01-17 6:22 ` bug#18128: Should be done as part of the font-lock Hong Xu
@ 2016-11-05 2:10 ` npostavs
3 siblings, 0 replies; 10+ messages in thread
From: npostavs @ 2016-11-05 2:10 UTC (permalink / raw)
To: Paul Pogonyshev; +Cc: 18128
Paul Pogonyshev <pogonyshev@gmail.com> writes:
> Diff-mode should just refine hunks automatically when visiting a
> buffer. If it is a performance concern, there should be some
> customization option for it and/or this could be done lazily.
>
A patch was recently added to magit that let-binds
write-region-inhibit-fsync around the call to diff-refine-hunk, this was
reported to make a significant improvement in speed when refining all
hunks in a diff. We should do the same for smerge-refine-subst (or is
it possible to do this automatically for all temp files?) before
extending diff refinement over the whole buffer.
https://patch-diff.githubusercontent.com/raw/magit/magit/pull/2834.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-11-05 2:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 13:59 bug#18128: Diff-mode doesn't refine hunks automatically Paul Pogonyshev
2014-07-28 14:28 ` Eli Zaretskii
2014-07-28 14:39 ` Paul Pogonyshev
2014-07-28 14:44 ` Eli Zaretskii
2014-07-28 14:49 ` Paul Pogonyshev
2014-07-28 14:45 ` Paul Pogonyshev
2014-07-28 23:28 ` Stefan Monnier
2016-01-17 6:22 ` bug#18128: Should be done as part of the font-lock Hong Xu
2016-11-04 7:54 ` Hong Xu
2016-11-05 2:10 ` bug#18128: Diff-mode doesn't refine hunks automatically npostavs
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).