Subject: [BUG?] git.el: M-x git-commit-file produces error if font lock is disabled

From: Jonathan Nieder <[email-masked]>
Date: Thu, 3 Feb 2011 18:10:16 -0600

Hi,

Kevin Ryde reports[1]:

> If font lock is disabled, M-x git-commit-file gets an error when setting
> up the log message edit buffer.
>
>     M-: (global-font-lock-mode 0)
>     M-x git-status
>     /some/git/directory
>     c         <- on a modified file
>
>     => Font-lock trying to use keywords before setting them up
>
> I suppose font-lock-compile-keywords should not be used if font lock is
> not enabled.  I suspect font-lock-add-keywords might be the right thing
> instead.  It seems to work for me (the code is supposed to replace the
> normal log-edit-mode keywords is it?).

and suggests a patch[2].  Does it make sense?

Ignorantly,
Jonathan

[1] http://bugs.debian.org/577834 from a while ago.
Sorry for the long delay.
[2]

 contrib/emacs/git.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 214930a..0c93ef1 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1337,7 +1337,7 @@ The FILES list must be sorted."
 	  (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))
+      (font-lock-add-keywords nil git-log-edit-font-lock-keywords 'set)
       (setq paragraph-separate (concat (regexp-quote git-log-msg-separator) "$\\|Author: \\|Date: \\|Merge: \\|Signed-off-by: \\|\f\\|[ 	]*$"))
       (setq buffer-file-coding-system coding-system)
       (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
-- 
1.7.4