* [PATCH] git.el: Don't use font-lock-compile-keywords
@ 2011-02-04 10:59 Lawrence Mitchell
2011-04-03 0:19 ` Jonathan Nieder
0 siblings, 1 reply; 6+ messages in thread
From: Lawrence Mitchell @ 2011-02-04 10:59 UTC (permalink / raw)
To: git; +Cc: Alexandre Julliard, Jonathan Nieder
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>
---
I sent this before, in response to Johnathan's message of 4th Feb
(http://thread.gmane.org/gmane.comp.version-control.git/36088/focus=166038),
but it's possible it got lost in the noise. So here it is
again. The originally proposed patch from Debian is to use
font-lock-add-keywords rather than font-lock-compile-keywords.
However, it doesn't exist in XEmacs, if one is looking to
maintain compatibility, I believe this patch is the right thing
to do.
contrib/emacs/git.el | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 214930a..65c95d9 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1310,6 +1310,13 @@ The FILES list must be sorted."
(when sign-off (git-append-sign-off committer-name committer-email)))
buffer))
+(define-derived-mode git-log-edit-mode log-edit-mode "Git-Log-Edit"
+ "Major mode for editing git log messages.
+
+Set up git-specific `font-lock-keywords' for `log-edit-mode'."
+ (set (make-local-variable 'font-lock-defaults)
+ '(git-log-edit-font-lock-keywords t t)))
+
(defun git-commit-file ()
"Commit the marked file(s), asking for a commit message."
(interactive)
@@ -1335,9 +1342,9 @@ The FILES list must be sorted."
(git-setup-log-buffer buffer (git-get-merge-heads) author-name author-email subject date))
(if (boundp 'log-edit-diff-function)
(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))
+ (log-edit-diff-function . git-log-edit-diff)) buffer 'git-log-edit-mode)
+ (log-edit 'git-do-commit nil 'git-log-edit-files buffer
+ 'git-log-edit-mode))
(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.rc2.18.gb20e9
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] git.el: Don't use font-lock-compile-keywords
2011-02-04 10:59 [PATCH] git.el: Don't use font-lock-compile-keywords Lawrence Mitchell
@ 2011-04-03 0:19 ` Jonathan Nieder
2011-04-03 17:44 ` Alexandre Julliard
2011-04-04 23:15 ` Kevin Ryde
0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Nieder @ 2011-04-03 0:19 UTC (permalink / raw)
To: Lawrence Mitchell; +Cc: Alexandre Julliard, git, David Kågedal, Kevin Ryde
Hi,
Lawrence Mitchell wrote:
> 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>
> ---
> I sent this before, in response to Johnathan's message of 4th Feb
> (http://thread.gmane.org/gmane.comp.version-control.git/36088/focus=166038),
> but it's possible it got lost in the noise.
Thanks. This is way beyond my knowledge of emacs; I was just passing
on Kevin's report before. Kevin, what do you think? Is it a good
fix?
(For those reading between the lines: why, yes, if you would like to
be maintainer of the contrib/emacs directory, we would be happy to
have you. When can you start? :))
> So here it is
> again. The originally proposed patch from Debian is to use
> font-lock-add-keywords rather than font-lock-compile-keywords.
> However, it doesn't exist in XEmacs, if one is looking to
> maintain compatibility, I believe this patch is the right thing
> to do.
>
> contrib/emacs/git.el | 13 ++++++++++---
> 1 files changed, 10 insertions(+), 3 deletions(-)
Leaving patch unsnipped for reviewers' sake.
Sorry for the slow response,
Jonathan
>
> diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
> index 214930a..65c95d9 100644
> --- a/contrib/emacs/git.el
> +++ b/contrib/emacs/git.el
> @@ -1310,6 +1310,13 @@ The FILES list must be sorted."
> (when sign-off (git-append-sign-off committer-name committer-email)))
> buffer))
>
> +(define-derived-mode git-log-edit-mode log-edit-mode "Git-Log-Edit"
> + "Major mode for editing git log messages.
> +
> +Set up git-specific `font-lock-keywords' for `log-edit-mode'."
> + (set (make-local-variable 'font-lock-defaults)
> + '(git-log-edit-font-lock-keywords t t)))
> +
> (defun git-commit-file ()
> "Commit the marked file(s), asking for a commit message."
> (interactive)
> @@ -1335,9 +1342,9 @@ The FILES list must be sorted."
> (git-setup-log-buffer buffer (git-get-merge-heads) author-name author-email subject date))
> (if (boundp 'log-edit-diff-function)
> (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))
> + (log-edit-diff-function . git-log-edit-diff)) buffer 'git-log-edit-mode)
> + (log-edit 'git-do-commit nil 'git-log-edit-files buffer
> + 'git-log-edit-mode))
> (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.rc2.18.gb20e9
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] git.el: Don't use font-lock-compile-keywords
2011-04-03 0:19 ` Jonathan Nieder
@ 2011-04-03 17:44 ` Alexandre Julliard
2011-04-03 19:25 ` Jonathan Nieder
2011-04-03 19:26 ` Junio C Hamano
2011-04-04 23:15 ` Kevin Ryde
1 sibling, 2 replies; 6+ messages in thread
From: Alexandre Julliard @ 2011-04-03 17:44 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Lawrence Mitchell, git, David Kågedal, Kevin Ryde
Jonathan Nieder <jrnieder@gmail.com> writes:
>> So here it is
>> again. The originally proposed patch from Debian is to use
>> font-lock-add-keywords rather than font-lock-compile-keywords.
>> However, it doesn't exist in XEmacs, if one is looking to
>> maintain compatibility, I believe this patch is the right thing
>> to do.
>>
>> contrib/emacs/git.el | 13 ++++++++++---
>> 1 files changed, 10 insertions(+), 3 deletions(-)
>
> Leaving patch unsnipped for reviewers' sake.
Looks good to me.
--
Alexandre Julliard
julliard@winehq.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] git.el: Don't use font-lock-compile-keywords
2011-04-03 17:44 ` Alexandre Julliard
@ 2011-04-03 19:25 ` Jonathan Nieder
2011-04-03 19:26 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2011-04-03 19:25 UTC (permalink / raw)
To: Junio C Hamano
Cc: Alexandre Julliard, Lawrence Mitchell, git, David Kågedal,
Kevin Ryde
Alexandre Julliard wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>>> So here it is
>>> again. The originally proposed patch from Debian is to use
>>> font-lock-add-keywords rather than font-lock-compile-keywords.
>>> However, it doesn't exist in XEmacs, if one is looking to
>>> maintain compatibility, I believe this patch is the right thing
>>> to do.
>>>
>>> contrib/emacs/git.el | 13 ++++++++++---
>>> 1 files changed, 10 insertions(+), 3 deletions(-)
>>
>> Leaving patch unsnipped for reviewers' sake.
>
> Looks good to me.
Just cc-ing Junio so he can see your ack.
Junio, the patch up-thread fixes a bug reported by
Kevin Ryde <user42@zip.com.au>. I'm not knowledgeable enough to see
what the impact is, but the emacs experts seem to like it.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] git.el: Don't use font-lock-compile-keywords
2011-04-03 17:44 ` Alexandre Julliard
2011-04-03 19:25 ` Jonathan Nieder
@ 2011-04-03 19:26 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2011-04-03 19:26 UTC (permalink / raw)
To: Alexandre Julliard
Cc: Jonathan Nieder, Lawrence Mitchell, git, David Kågedal,
Kevin Ryde
Alexandre Julliard <julliard@winehq.org> writes:
> Looks good to me.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] git.el: Don't use font-lock-compile-keywords
2011-04-03 0:19 ` Jonathan Nieder
2011-04-03 17:44 ` Alexandre Julliard
@ 2011-04-04 23:15 ` Kevin Ryde
1 sibling, 0 replies; 6+ messages in thread
From: Kevin Ryde @ 2011-04-04 23:15 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Lawrence Mitchell, Alexandre Julliard, git, David Kågedal
Jonathan Nieder <jrnieder@gmail.com> writes:
>
> Lawrence Mitchell wrote:
>> font-lock-add-keywords rather than font-lock-compile-keywords.
>> However, it doesn't exist in XEmacs,
Oh, I didn't realize that. In my own code I think I've only ever
set font-lock-defaults and left it at that ...
--
Newton's first law elucidated for the layman:
A body in motion continues in motion, unless it doesn't.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-04 22:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04 10:59 [PATCH] git.el: Don't use font-lock-compile-keywords Lawrence Mitchell
2011-04-03 0:19 ` Jonathan Nieder
2011-04-03 17:44 ` Alexandre Julliard
2011-04-03 19:25 ` Jonathan Nieder
2011-04-03 19:26 ` Junio C Hamano
2011-04-04 23:15 ` Kevin Ryde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).