Skip to content

Commit

Permalink
git.el: Always set the current directory in the git-diff buffer.
Browse files Browse the repository at this point in the history
This allows jumping to the correct file with the diff-mode commands.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alexandre Julliard authored and Junio C Hamano committed Aug 13, 2007
1 parent 09afcd6 commit 8fdc397
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contrib/emacs/git.el
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,12 @@ Return the list of files that haven't been handled."

(defun git-setup-diff-buffer (buffer)
"Setup a buffer for displaying a diff."
(with-current-buffer buffer
(diff-mode)
(goto-char (point-min))
(setq buffer-read-only t))
(let ((dir default-directory))
(with-current-buffer buffer
(diff-mode)
(goto-char (point-min))
(setq default-directory dir)
(setq buffer-read-only t)))
(display-buffer buffer)
(shrink-window-if-larger-than-buffer))

Expand Down

0 comments on commit 8fdc397

Please sign in to comment.