@matheusbsbs / matheus-bagliano / commits / 485cdb9bd8
Fork 0

git.el: Don't use font-lock-compile-keywords

If font-lock is disabled, font-lock-compile-keywords complains. Really what we want to do is to replace log-edit's font-lock definitions with our own, so define a major mode deriving from log-edit and set up font-lock-defaults there. We then use the optional MODE argument to log-edit to set up the major mode of the commit buffer appropriately. Signed-off-by: Lawrence Mitchell <wence@gmx.li> Acked-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lawrence Mitchell committed Feb 4, 2011 at 10:59 UTC 485cdb9bd8bd7de6c7099c1c3e9c6fca6a60fdd3
1 file changed +10 -3
contrib/emacs/git.el
+10 -3
@@ -1310,6 +1310,13 @@ The FILES list must be sorted."
1310 (when sign-off (git-append-sign-off committer-name committer-email)))
1311 buffer))
1312
1313 +(define-derived-mode git-log-edit-mode log-edit-mode "Git-Log-Edit"
1314 + "Major mode for editing git log messages.
1315 +
1316 +Set up git-specific `font-lock-keywords' for `log-edit-mode'."
1317 + (set (make-local-variable 'font-lock-defaults)
1318 + '(git-log-edit-font-lock-keywords t t)))
1319 +
1320 (defun git-commit-file ()
1321 "Commit the marked file(s), asking for a commit message."
1322 (interactive)
@@ -1335,9 +1342,9 @@ The FILES list must be sorted."
1342 (git-setup-log-buffer buffer (git-get-merge-heads) author-name author-email subject date))
1343 (if (boundp 'log-edit-diff-function)
1344 (log-edit 'git-do-commit nil '((log-edit-listfun . git-log-edit-files)
1338 - (log-edit-diff-function . git-log-edit-diff)) buffer)
1339 - (log-edit 'git-do-commit nil 'git-log-edit-files buffer))
1340 - (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
1345 + (log-edit-diff-function . git-log-edit-diff)) buffer 'git-log-edit-mode)
1346 + (log-edit 'git-do-commit nil 'git-log-edit-files buffer
1347 + 'git-log-edit-mode))
1348 (setq paragraph-separate (concat (regexp-quote git-log-msg-separator) "$\\|Author: \\|Date: \\|Merge: \\|Signed-off-by: \\|\f\\|[ ]*$"))
1349 (setq buffer-file-coding-system coding-system)
1350 (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))