GNU bug report logs - #12671
24.2.50; diff-kill-hunk with diff-auto-refine-mode jumps to beginning

Previous Next

Package: emacs;

Reported by: Ivan Andrus <darthandrus <at> gmail.com>

Date: Thu, 18 Oct 2012 12:42:01 UTC

Severity: normal

Found in version 24.2.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 12671-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ivan Andrus <darthandrus <at> gmail.com>
Cc: 12671-done <at> debbugs.gnu.org
Subject: Re: 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
> 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)





This bug report was last modified 12 years and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.