Skip to content

Commit

Permalink
git.el: Avoid setting font lock keywords before entering log-edit mode.
Browse files Browse the repository at this point in the history
Instead, reinitialize the keywords after the fact. This avoids
conflicts with other users of log-edit mode, like pcl-cvs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Alexandre Julliard authored and Junio C Hamano committed Jan 6, 2007
1 parent f281e3a commit 9fa77a5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions contrib/emacs/git.el
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

(eval-when-compile (require 'cl))
(require 'ewoc)
(require 'log-edit)


;;;; Customizations
Expand Down Expand Up @@ -147,6 +148,13 @@ if there is already one that displays the same directory."

(defconst git-log-msg-separator "--- log message follows this line ---")

(defvar git-log-edit-font-lock-keywords
`(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)$"
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))
(,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
(1 font-lock-comment-face))))

(defun git-get-env-strings (env)
"Build a list of NAME=VALUE strings from a list of environment strings."
(mapcar (lambda (entry) (concat (car entry) "=" (cdr entry))) env))
Expand Down Expand Up @@ -894,14 +902,9 @@ and returns the process output as a string."
(sign-off
(insert (format "\n\nSigned-off-by: %s <%s>\n"
(git-get-committer-name) (git-get-committer-email)))))))
(let ((log-edit-font-lock-keywords
`(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)"
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))
(,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
(1 font-lock-comment-face)))))
(log-edit #'git-do-commit nil #'git-log-edit-files buffer)
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
(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))
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t)))

(defun git-find-file ()
"Visit the current file in its own buffer."
Expand Down

0 comments on commit 9fa77a5

Please sign in to comment.