{"thread":{"id":"11493","subject":"[PATCH 1/3] git.el: Support for getting diffs from inside the log-edit buffer.","startedAt":"2008-01-06T11:12:24Z","lastAt":"2008-01-06T11:12:24Z","messageCount":1,"participants":["Alexandre Julliard"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"64586","messageId":"877iin8axz.fsf@wine.dyndns.org","threadId":"11493","inReplyTo":null,"subject":"[PATCH 1/3] git.el: Support for getting diffs from inside the log-edit buffer.","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2008-01-06T11:12:24Z","receivedAt":"2008-01-06T11:12:24Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"Take advantage of the new log-edit feature that allows to show a diff\nwith C-c C-d while editing the log message.\n\nSigned-off-by: Alexandre Julliard <julliard@winehq.org>\n---\n contrib/emacs/git.el |   14 ++++++++++++--\n 1 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 28a4899..e0e6316 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -1024,7 +1024,9 @@ Return the list of files that haven't been handled.\"\n       (setq default-directory dir)\n       (setq buffer-read-only t)))\n   (display-buffer buffer)\n-  (shrink-window-if-larger-than-buffer))\n+  ; shrink window only if it displays the status buffer\n+  (when (eq (window-buffer) (current-buffer))\n+    (shrink-window-if-larger-than-buffer)))\n \n (defun git-diff-file ()\n   \"Diff the marked file(s) against HEAD.\"\n@@ -1097,6 +1099,11 @@ Return the list of files that haven't been handled.\"\n   (with-current-buffer log-edit-parent-buffer\n     (git-get-filenames (git-marked-files-state 'added 'deleted 'modified))))\n \n+(defun git-log-edit-diff ()\n+  \"Run a diff of the current files being committed from a log-edit buffer.\"\n+  (with-current-buffer log-edit-parent-buffer\n+    (git-diff-file)))\n+\n (defun git-append-sign-off (name email)\n   \"Append a Signed-off-by entry to the current buffer, avoiding duplicates.\"\n   (let ((sign-off (format \"Signed-off-by: %s <%s>\" name email))\n@@ -1169,7 +1176,10 @@ Return the list of files that haven't been handled.\"\n             (when (re-search-forward \"^Date: \\\\(.*\\\\)$\" nil t)\n               (setq date (match-string 1)))))\n         (git-setup-log-buffer buffer author-name author-email subject date))\n-      (log-edit #'git-do-commit nil #'git-log-edit-files buffer)\n+      (if (boundp 'log-edit-diff-function)\n+          (log-edit 'git-do-commit nil '((log-edit-listfun . git-log-edit-files)\n+                                         (log-edit-diff-function . git-log-edit-diff)) buffer)\n+        (log-edit 'git-do-commit nil 'git-log-edit-files buffer))\n       (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))\n       (setq buffer-file-coding-system coding-system)\n       (re-search-forward (regexp-quote (concat git-log-msg-separator \"\\n\")) nil t))))\n-- \n1.5.4.rc2.53.gb6f8\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"}]}