* [PATCH 1/3] git.el: Support for getting diffs from inside the log-edit buffer.
@ 2008-01-06 11:12 Alexandre Julliard
0 siblings, 0 replies; only message in thread
From: Alexandre Julliard @ 2008-01-06 11:12 UTC (permalink / raw)
To: git
Take advantage of the new log-edit feature that allows to show a diff
with C-c C-d while editing the log message.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
contrib/emacs/git.el | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 28a4899..e0e6316 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1024,7 +1024,9 @@ Return the list of files that haven't been handled."
(setq default-directory dir)
(setq buffer-read-only t)))
(display-buffer buffer)
- (shrink-window-if-larger-than-buffer))
+ ; shrink window only if it displays the status buffer
+ (when (eq (window-buffer) (current-buffer))
+ (shrink-window-if-larger-than-buffer)))
(defun git-diff-file ()
"Diff the marked file(s) against HEAD."
@@ -1097,6 +1099,11 @@ Return the list of files that haven't been handled."
(with-current-buffer log-edit-parent-buffer
(git-get-filenames (git-marked-files-state 'added 'deleted 'modified))))
+(defun git-log-edit-diff ()
+ "Run a diff of the current files being committed from a log-edit buffer."
+ (with-current-buffer log-edit-parent-buffer
+ (git-diff-file)))
+
(defun git-append-sign-off (name email)
"Append a Signed-off-by entry to the current buffer, avoiding duplicates."
(let ((sign-off (format "Signed-off-by: %s <%s>" name email))
@@ -1169,7 +1176,10 @@ Return the list of files that haven't been handled."
(when (re-search-forward "^Date: \\(.*\\)$" nil t)
(setq date (match-string 1)))))
(git-setup-log-buffer buffer author-name author-email subject date))
- (log-edit #'git-do-commit nil #'git-log-edit-files buffer)
+ (if (boundp 'log-edit-diff-function)
+ (log-edit 'git-do-commit nil '((log-edit-listfun . git-log-edit-files)
+ (log-edit-diff-function . git-log-edit-diff)) buffer)
+ (log-edit 'git-do-commit nil 'git-log-edit-files buffer))
(setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
(setq buffer-file-coding-system coding-system)
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
--
1.5.4.rc2.53.gb6f8
--
Alexandre Julliard
julliard@winehq.org
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-06 11:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-06 11:12 [PATCH 1/3] git.el: Support for getting diffs from inside the log-edit buffer Alexandre Julliard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).