help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Diff could also show the changes within lines


From: Sebastien Vauban
Subject: Re: Diff could also show the changes within lines
Date: Thu, 15 Nov 2012 22:34:57 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (windows-nt)

Tom,

Tom wrote:
> Sebastien Vauban <wxhgmqzgwmuf@...> writes:
>> 
>> And the results of the jury are:
>> - it works for the refining of *all* hunks
>
> Cool. I think the last hunk is actually processed twice, once when you call
> the refine function explicitly and once when the timer mentioned in the bug
> report explanation kicks in. But it's not a big deal, probably does not add
> a noticable delay.
>
>> - it does not work wrt the position of the cursor, that is it's at the end
>>   of the buffer...
>
> I have no idea what causes this. You can try adding a (goto-char
> (point-min)) call to the end of the refine all function

Did not work.

> or if it does not work then you can try using a null timer for this, so it
> is called after the command is finished, and hopefully after that code is
> finished which moves the cursor:
>
> (run-at-time 0.0 nil (lambda () (goto-char (point-min))))

Like this?

--8<---------------cut here---------------start------------->8---
  (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)))))
--8<---------------cut here---------------end--------------->8---

Yep!  This does work perfectly: all hunks refined, and pointer at beginning of
buffer...

Thanks a lot for your more than precious help!

Best regards,
  Seb

-- 
Sebastien Vauban


reply via email to

[Prev in Thread] Current Thread [Next in Thread]