Skip to contentSkip to conversation

git.el: Always set the current directory in the git-diff buffer.

PATCH New Alexandre Julliard 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git.el: Always set the current directory in the git-diff buffer.

This allows jumping to the correct file with the diff-mode commands.

---
 contrib/emacs/git.el |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
contrib/emacs/git.el +6 -4
index 214b75c..be44e06 100644
@@ -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))
 
Signature · 5 lines
1.5.3.rc4.70.gf909

-- 
Alexandre Julliard
[email protected]