Florian Ragwitz (rafl) has written a git-commit-mode [1], a major mode
for editing log messages that people might like to use in conjunction
with Magit.  So, add this project as a submodule to the Magit project,
and make magit-log-edit-mode derive this mode.

[1]: https://github.com/rafl/git-commit-mode

Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
 I've been using this locally for a long time now.  Although I posted
 this patch on the list a long time ago, I'm guilty of not pushing.
 Christmas is a perfect time to fix this :)

 Thoughts?

 [1]: 
http://thread.gmane.org/gmane.comp.version-control.git.magit/1022/focus=1057

 .gitmodules     |    3 +++
 git-commit-mode |    1 +
 magit.el        |   14 ++++++++++----
 3 files changed, 14 insertions(+), 4 deletions(-)
 create mode 100644 .gitmodules
 create mode 160000 git-commit-mode

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..3a55da4
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "git-commit-mode"]
+       path = git-commit-mode
+       url = git://github.com/rafl/git-commit-mode.git
diff --git a/git-commit-mode b/git-commit-mode
new file mode 160000
index 0000000..ec88948
--- /dev/null
+++ b/git-commit-mode
@@ -0,0 +1 @@
+Subproject commit ec88948e06f787fcc1c3b9951930ef00b25d0b8a
diff --git a/magit.el b/magit.el
index 1c0d73d..aaa2fdc 100644
--- a/magit.el
+++ b/magit.el
@@ -4026,10 +4026,16 @@ typing and automatically refreshes the status buffer."
 
 (defvar magit-pre-log-edit-window-configuration nil)
 
-(define-derived-mode magit-log-edit-mode text-mode "Magit Log Edit"
-  ;; Recognize changelog-style paragraphs
-  (set (make-local-variable 'paragraph-start)
-       (concat paragraph-start "\\|*\\|(")))
+(if (require 'git-commit nil 'noerror)
+    (define-derived-mode magit-log-edit-mode git-commit-mode "Magit Log Edit"
+                        (define-key magit-log-edit-mode-map (kbd "C-c C-s")
+                           'git-commit-signoff)
+                        ;; Recognize changelog-style paragraphs
+                        (set (make-local-variable 'paragraph-start)
+                             (concat paragraph-start "\\|*\\|(")))
+    (define-derived-mode magit-log-edit-mode text-mode "Magit Log Edit"
+                        (set (make-local-variable 'paragraph-start)
+                             (concat paragraph-start "\\|*\\|("))))
 
 (defun magit-log-edit-cleanup ()
   (save-excursion
-- 
1.7.8.1.362.g5d6df.dirty

Reply via email to