git.el: Avoid setting font lock keywords before entering log-edit mode.
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>
Alexandre Julliard committed
Jan 6, 2007 at 14:46 UTC
9fa77a51a49b16fa8886643d7f6346eb0a0601c5
1 file changed
+11
-8
contrib/emacs/git.el
+11
-8
@@ -49,6 +49,7 @@
49
50
(eval-when-compile (require 'cl))
51
(require 'ewoc)
52
+(require 'log-edit)
53
54
55
;;;; Customizations
@@ -147,6 +148,13 @@ if there is already one that displays the same directory."
148
149
(defconst git-log-msg-separator "--- log message follows this line ---")
150
151
+(defvar git-log-edit-font-lock-keywords
152
+ `(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)$"
153
+ (1 font-lock-keyword-face)
154
+ (2 font-lock-function-name-face))
155
+ (,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
156
+ (1 font-lock-comment-face))))
157
+
158
(defun git-get-env-strings (env)
159
"Build a list of NAME=VALUE strings from a list of environment strings."
160
(mapcar (lambda (entry) (concat (car entry) "=" (cdr entry))) env))
@@ -894,14 +902,9 @@ and returns the process output as a string."
902
(sign-off
903
(insert (format "\n\nSigned-off-by: %s <%s>\n"
904
(git-get-committer-name) (git-get-committer-email)))))))
897
- (let ((log-edit-font-lock-keywords
898
- `(("^\\(Author:\\|Date:\\|Parent:\\|Signed-off-by:\\)\\(.*\\)"
899
- (1 font-lock-keyword-face)
900
- (2 font-lock-function-name-face))
901
- (,(concat "^\\(" (regexp-quote git-log-msg-separator) "\\)$")
902
- (1 font-lock-comment-face)))))
903
- (log-edit #'git-do-commit nil #'git-log-edit-files buffer)
904
- (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
905
+ (log-edit #'git-do-commit nil #'git-log-edit-files buffer)
906
+ (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
907
+ (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t)))
908
909
(defun git-find-file ()
910
"Visit the current file in its own buffer."