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

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

bug#12671: 24.2.50; diff-kill-hunk with diff-auto-refine-mode jumps to b


From: Stefan Monnier
Subject: bug#12671: 24.2.50; diff-kill-hunk with diff-auto-refine-mode jumps to beginning
Date: Tue, 23 Oct 2012 14:44:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

> In diff mode killing a hunk with diff-auto-refine-mode on will jump to the
> beginning of the file-bounds.  This is because `diff-hunk-kill' calls
> `diff-hunk-next' when it's getting the file bounds.  The call to
> `diff-hunk-next' schedules a timer which moves the point to where it was
> when `diff-hunk-next' was called, namely the first hunk of the file.

That was a bug in the timer, indeed.
I installed the patch below which should fix it.

> I'm not sure the best way to fix it, but the patch below is probably the
> easiest.
[...]
> -  (let* ((hunk-bounds (diff-bounds-of-hunk))
> +  (let* ((diff-auto-refine-mode nil)
> +      (hunk-bounds (diff-bounds-of-hunk))

The auto-refine behavior is definitely suboptimal (it should rather
than triggered by jit-lock, ideally), but I'd rather not disable it
around problematic uses, at last as long as those problematic uses can
be fixed some other way.


        Stefan


=== modified file 'lisp/vc/diff-mode.el'
--- lisp/vc/diff-mode.el        2012-10-02 03:49:28 +0000
+++ lisp/vc/diff-mode.el        2012-10-23 18:37:16 +0000
@@ -581,8 +581,9 @@
                       (with-local-quit
                         (when (buffer-live-p buffer)
                           (with-current-buffer buffer
+                            (save-excursion
                             (goto-char point)
-                            (diff-refine-hunk))))))))))
+                              (diff-refine-hunk)))))))))))
 
 (easy-mmode-define-navigation
  diff-file diff-file-header-re "file" diff-end-of-file)






reply via email to

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