git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
AJAlexandre Julliard <julliard@winehq.org>
Date
Aug 11, 2007, 10:23 UTC
Message-ID
<87fy2qwesm.fsf@wine.dyndns.org>
This allows jumping to the correct file with the diff-mode commands.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 contrib/emacs/git.el |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 214b75c..be44e06 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -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))
 
-- 
1.5.3.rc4.70.gf909

-- 
Alexandre Julliard
julliard@winehq.org
Message 1 of 1 in “git.el: Always set the current directory in the git-diff buffer.”
  1. git.el: Always set the current directory in the git-diff buffer.Alexandre Julliard, Aug 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.