[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diff-goto-source doesn't work for new files.
From: |
Óscar Fuentes |
Subject: |
diff-goto-source doesn't work for new files. |
Date: |
Thu, 24 Apr 2008 22:20:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (windows-nt) |
Hi!
Under whatever VCS system, create a file, insert some random lines of
text and diff it. The output is similar to this:
Index: foo.txt
===================================================================
--- foo.txt (revision 0)
+++ foo.txt (revision 0)
@@ -0,0 +1,6 @@
+This is a
+
+test file
+
+for demonstrating
+something
Move to some random line inside the *vc-diff* buffer. If you invoke
diff-goto-source (C-c C-c), Emacs always jumps to the first line of
`foo.txt'.
I've observed that this change to diff-goto-source fixes the problem:
diff -c t\:/diff-mode.el t\:/emacscvs/src/emacs/lisp/diff-mode.el
*** t:/diff-mode.el Thu Apr 24 22:12:40 2008
--- t:/emacscvs/src/emacs/lisp/diff-mode.el Thu Apr 24 22:15:43 2008
***************
*** 1692,1698 ****
(if event (posn-set-point (event-end event)))
(let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
(destructuring-bind (buf line-offset pos src dst &optional switched)
! (diff-find-source-location other-file rev)
(pop-to-buffer buf)
(goto-char (+ (car pos) (cdr src)))
(diff-hunk-status-msg line-offset (diff-xor rev switched) t))))
--- 1692,1698 ----
(if event (posn-set-point (event-end event)))
(let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
(destructuring-bind (buf line-offset pos src dst &optional switched)
! (diff-find-source-location other-file t)
(pop-to-buffer buf)
(goto-char (+ (car pos) (cdr src)))
(diff-hunk-status-msg line-offset (diff-xor rev switched) t))))
I suppose that `rev' is there for a good reason, so if anyone can
explain the logic behind it, I could go further on my attempt at fixing
the bug.
Regards,
--
Oscar
- diff-goto-source doesn't work for new files.,
Óscar Fuentes <=