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

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 4, 2011, 00:10 UTC
Message-ID
<20110204001016.GC16688@elie>
In-Reply-To
<87lkkgw9mg.fsf@wine.dyndns.org>
Hi,
Kevin Ryde reports[1]:
Show 14 quoted lines
> 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
Previous: Alexandre JulliardNext: Lawrence Mitchell
Message 2 of 3 in “git.el: Avoid setting font lock keywords before entering log-edit mode.”
  1. git.el: Avoid setting font lock keywords before entering log-edit mode.Alexandre Julliard, Jan 6, 2007
  2. [BUG?] git.el: M-x git-commit-file produces error if font lock is disabledJonathan Nieder, Feb 4, 2011
  3. Lawrence MitchellFeb 4, 2011

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.