Hi Tom,
"Sebastien Vauban" wrote:
> Tom wrote:
>> Sebastien Vauban <wxhgmqzgwmuf@...> writes:
>>>
>>> And the results of the jury are:
>
> (defun my/diff-refine-all-hunks ()
> (interactive)
> (condition-case nil
> (save-excursion
> (goto-char (point-min))
> (while (not (eobp))
> (diff-hunk-next)
> (diff-refine-hunk)))
> (error nil))
> (run-at-time 0.0 nil (lambda () (goto-char (point-min)))))
>
> Yep! This does work perfectly: all hunks refined, and pointer at beginning of
> buffer...
>
> Thanks a lot for your more than precious help!
After a couple of days using this, I've observed a very tricky collateral
damage in Gnus...
Let's assume I have received 5 mails:
--8<---------------cut here---------------start------------->8---
* 18 Sun 14:25 0.2k Foo Mail #1 Hello
18 Sun 14:25 0.4M Bar Mail #2 How are you?
18 Sun 17:58 6.9k Baz Mail #3 [diff] Fix bug
18 Sun 18:06 4.1k Baz Mail #4 [diff] Fix doc
18 Sun 18:27 3.1k Baz Mail #5 I've done it
--8<---------------cut here---------------end--------------->8---
* = position of the cursor
... and I want first to read the 3rd one. I position the cursor on that one...
--8<---------------cut here---------------start------------->8---
18 Sun 14:25 0.2k Foo Mail #1 Hello
18 Sun 14:25 0.4M Bar Mail #2 How are you?
* 18 Sun 17:58 6.9k Baz Mail #3 [diff] Fix bug
18 Sun 18:06 4.1k Baz Mail #4 [diff] Fix doc
18 Sun 18:27 3.1k Baz Mail #5 I've done it
--8<---------------cut here---------------end--------------->8---
... press RET, get a new buffer created on the mid-right pane, and read it.
--8<---------------cut here---------------start------------->8---
* 18 Sun 14:25 0.2k Foo Mail #1 Hello |
18 Sun 14:25 0.4M Bar Mail #2 How are you? |
18 Sun 17:58 6.9k Baz Mail #3 [diff] Fix bug | (contents of 3rd email)
18 Sun 18:06 4.1k Baz Mail #4 [diff] Fix doc |
18 Sun 18:27 3.1k Baz Mail #5 I've done it |
--8<---------------cut here---------------end--------------->8---
Then, as I always do, I simply press "n" to read the "next one" (4th)... but
Gnus displays me the 1st one!
Why? Because the cursor has been positioned on the first line of my *summary*
buffer (on the left), after displaying the contents of the "Fix bug" email (on
the right).
Why? Because diff-mode is called (as that email contains a diff), and some
some effect -- which I don't understand -- is that *the cursor is repositioned
onto the first line of the summary buffer* (while the code is supposed to be
executed in the other window, the one with the *contents* of the mail).
So, here, to reproduce the problem, I have to:
- have emails with diffs in them (otherwise, diff-mode won't be called)
- skip reading the first email (so that, clicking "n" does open the "next"
unread email... from the current cursor position, which is wrong here...)
I know describing a dynamic behavior is not obvious per email. So, did you
understand the description of the problem, at least?
Do you understand why this is occurring, or have some helpful ideas?