{"thread":{"id":"26852","subject":"[PATCH] git.el: Don't use font-lock-compile-keywords","startedAt":"2011-02-04T10:59:18Z","lastAt":"2011-04-04T23:15:41Z","messageCount":6,"participants":["Lawrence Mitchell","Jonathan Nieder","Alexandre Julliard","Junio C Hamano","Kevin Ryde"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"164235","messageId":"m3oc501rja.fsf@e4300lm.epcc.ed.ac.uk","threadId":"26852","inReplyTo":null,"subject":"[PATCH] git.el: Don't use font-lock-compile-keywords","fromName":"Lawrence Mitchell","fromEmail":"wence@gmx.li","sentAt":"2011-02-04T10:59:18Z","receivedAt":"2011-02-04T10:59:18Z","isPatch":true,"sender":{"key":"wence@gmx.li","avatar":"https://avatars.githubusercontent.com/u/1126981?v=4"},"body":"If font-lock is disabled, font-lock-compile-keywords complains.\nReally what we want to do is to replace log-edit's font-lock\ndefinitions with our own, so define a major mode deriving from\nlog-edit and set up font-lock-defaults there.  We then use the\noptional MODE argument to log-edit to set up the major mode of the\ncommit buffer appropriately.\n\nSigned-Off-By: Lawrence Mitchell <wence@gmx.li>\n---\nI sent this before, in response to Johnathan's message of 4th Feb\n(http://thread.gmane.org/gmane.comp.version-control.git/36088/focus=166038),\nbut it's possible it got lost in the noise.  So here it is\nagain.  The originally proposed patch from Debian is to use\nfont-lock-add-keywords rather than font-lock-compile-keywords.\nHowever, it doesn't exist in XEmacs, if one is looking to\nmaintain compatibility, I believe this patch is the right thing\nto do.\n\n contrib/emacs/git.el |   13 ++++++++++---\n 1 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 214930a..65c95d9 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -1310,6 +1310,13 @@ The FILES list must be sorted.\"\n       (when sign-off (git-append-sign-off committer-name committer-email)))\n     buffer))\n \n+(define-derived-mode git-log-edit-mode log-edit-mode \"Git-Log-Edit\"\n+  \"Major mode for editing git log messages.\n+\n+Set up git-specific `font-lock-keywords' for `log-edit-mode'.\"\n+  (set (make-local-variable 'font-lock-defaults)\n+       '(git-log-edit-font-lock-keywords t t)))\n+\n (defun git-commit-file ()\n   \"Commit the marked file(s), asking for a commit message.\"\n   (interactive)\n@@ -1335,9 +1342,9 @@ The FILES list must be sorted.\"\n         (git-setup-log-buffer buffer (git-get-merge-heads) author-name author-email subject date))\n       (if (boundp 'log-edit-diff-function)\n \t  (log-edit 'git-do-commit nil '((log-edit-listfun . git-log-edit-files)\n-\t\t\t\t\t (log-edit-diff-function . git-log-edit-diff)) buffer)\n-\t(log-edit 'git-do-commit nil 'git-log-edit-files buffer))\n-      (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))\n+\t\t\t\t\t (log-edit-diff-function . git-log-edit-diff)) buffer 'git-log-edit-mode)\n+\t(log-edit 'git-do-commit nil 'git-log-edit-files buffer\n+                  'git-log-edit-mode))\n       (setq paragraph-separate (concat (regexp-quote git-log-msg-separator) \"$\\\\|Author: \\\\|Date: \\\\|Merge: \\\\|Signed-off-by: \\\\|\\f\\\\|[ \t]*$\"))\n       (setq buffer-file-coding-system coding-system)\n       (re-search-forward (regexp-quote (concat git-log-msg-separator \"\\n\")) nil t))))\n-- \n1.7.4.rc2.18.gb20e9\n"},{"id":"164968","messageId":"20110403001902.GA25671@elie","threadId":"26852","inReplyTo":"m3oc501rja.fsf@e4300lm.epcc.ed.ac.uk","subject":"Re: [PATCH] git.el: Don't use font-lock-compile-keywords","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-03T00:19:02Z","receivedAt":"2011-04-03T00:19:02Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nLawrence Mitchell wrote:\n\n> If font-lock is disabled, font-lock-compile-keywords complains.\n> Really what we want to do is to replace log-edit's font-lock\n> definitions with our own, so define a major mode deriving from\n> log-edit and set up font-lock-defaults there.  We then use the\n> optional MODE argument to log-edit to set up the major mode of the\n> commit buffer appropriately.\n>\n> Signed-Off-By: Lawrence Mitchell <wence@gmx.li>\n> ---\n> I sent this before, in response to Johnathan's message of 4th Feb\n> (http://thread.gmane.org/gmane.comp.version-control.git/36088/focus=166038),\n> but it's possible it got lost in the noise.\n\nThanks.  This is way beyond my knowledge of emacs; I was just passing\non Kevin's report before.  Kevin, what do you think?  Is it a good\nfix?\n\n(For those reading between the lines: why, yes, if you would like to\nbe maintainer of the contrib/emacs directory, we would be happy to\nhave you.  When can you start? :))\n\n> So here it is\n> again.  The originally proposed patch from Debian is to use\n> font-lock-add-keywords rather than font-lock-compile-keywords.\n> However, it doesn't exist in XEmacs, if one is looking to\n> maintain compatibility, I believe this patch is the right thing\n> to do.\n>\n>  contrib/emacs/git.el |   13 ++++++++++---\n>  1 files changed, 10 insertions(+), 3 deletions(-)\n\nLeaving patch unsnipped for reviewers' sake.\n\nSorry for the slow response,\nJonathan\n\n> \n> diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\n> index 214930a..65c95d9 100644\n> --- a/contrib/emacs/git.el\n> +++ b/contrib/emacs/git.el\n> @@ -1310,6 +1310,13 @@ The FILES list must be sorted.\"\n>        (when sign-off (git-append-sign-off committer-name committer-email)))\n>      buffer))\n>  \n> +(define-derived-mode git-log-edit-mode log-edit-mode \"Git-Log-Edit\"\n> +  \"Major mode for editing git log messages.\n> +\n> +Set up git-specific `font-lock-keywords' for `log-edit-mode'.\"\n> +  (set (make-local-variable 'font-lock-defaults)\n> +       '(git-log-edit-font-lock-keywords t t)))\n> +\n>  (defun git-commit-file ()\n>    \"Commit the marked file(s), asking for a commit message.\"\n>    (interactive)\n> @@ -1335,9 +1342,9 @@ The FILES list must be sorted.\"\n>          (git-setup-log-buffer buffer (git-get-merge-heads) author-name author-email subject date))\n>        (if (boundp 'log-edit-diff-function)\n>  \t  (log-edit 'git-do-commit nil '((log-edit-listfun . git-log-edit-files)\n> -\t\t\t\t\t (log-edit-diff-function . git-log-edit-diff)) buffer)\n> -\t(log-edit 'git-do-commit nil 'git-log-edit-files buffer))\n> -      (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))\n> +\t\t\t\t\t (log-edit-diff-function . git-log-edit-diff)) buffer 'git-log-edit-mode)\n> +\t(log-edit 'git-do-commit nil 'git-log-edit-files buffer\n> +                  'git-log-edit-mode))\n>        (setq paragraph-separate (concat (regexp-quote git-log-msg-separator) \"$\\\\|Author: \\\\|Date: \\\\|Merge: \\\\|Signed-off-by: \\\\|\\f\\\\|[ \t]*$\"))\n>        (setq buffer-file-coding-system coding-system)\n>        (re-search-forward (regexp-quote (concat git-log-msg-separator \"\\n\")) nil t))))\n> -- \n> 1.7.4.rc2.18.gb20e9\n"},{"id":"165064","messageId":"87ei5j2prc.fsf@wine.dyndns.org","threadId":"26852","inReplyTo":"20110403001902.GA25671@elie","subject":"Re: [PATCH] git.el: Don't use font-lock-compile-keywords","fromName":"Alexandre Julliard","fromEmail":"julliard@winehq.org","sentAt":"2011-04-03T17:44:55Z","receivedAt":"2011-04-03T17:44:55Z","isPatch":true,"sender":{"key":"julliard@winehq.org","avatar":null},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> So here it is\n>> again.  The originally proposed patch from Debian is to use\n>> font-lock-add-keywords rather than font-lock-compile-keywords.\n>> However, it doesn't exist in XEmacs, if one is looking to\n>> maintain compatibility, I believe this patch is the right thing\n>> to do.\n>>\n>>  contrib/emacs/git.el |   13 ++++++++++---\n>>  1 files changed, 10 insertions(+), 3 deletions(-)\n>\n> Leaving patch unsnipped for reviewers' sake.\n\nLooks good to me.\n\n-- \nAlexandre Julliard\njulliard@winehq.org\n"},{"id":"165076","messageId":"20110403192515.GF3830@elie","threadId":"26852","inReplyTo":"87ei5j2prc.fsf@wine.dyndns.org","subject":"Re: [PATCH] git.el: Don't use font-lock-compile-keywords","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-03T19:25:15Z","receivedAt":"2011-04-03T19:25:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Alexandre Julliard wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>>> So here it is\n>>> again.  The originally proposed patch from Debian is to use\n>>> font-lock-add-keywords rather than font-lock-compile-keywords.\n>>> However, it doesn't exist in XEmacs, if one is looking to\n>>> maintain compatibility, I believe this patch is the right thing\n>>> to do.\n>>>\n>>>  contrib/emacs/git.el |   13 ++++++++++---\n>>>  1 files changed, 10 insertions(+), 3 deletions(-)\n>>\n>> Leaving patch unsnipped for reviewers' sake.\n>\n> Looks good to me.\n\nJust cc-ing Junio so he can see your ack.\n\nJunio, the patch up-thread fixes a bug reported by\nKevin Ryde <user42@zip.com.au>.  I'm not knowledgeable enough to see\nwhat the impact is, but the emacs experts seem to like it.\n"},{"id":"165077","messageId":"7vr59jb0gl.fsf@alter.siamese.dyndns.org","threadId":"26852","inReplyTo":"87ei5j2prc.fsf@wine.dyndns.org","subject":"Re: [PATCH] git.el: Don't use font-lock-compile-keywords","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-03T19:26:34Z","receivedAt":"2011-04-03T19:26:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexandre Julliard <julliard@winehq.org> writes:\n\n> Looks good to me.\n\nThanks.\n"},{"id":"165144","messageId":"871v1h38wy.fsf@blah.blah","threadId":"26852","inReplyTo":"20110403001902.GA25671@elie","subject":"Re: [PATCH] git.el: Don't use font-lock-compile-keywords","fromName":"Kevin Ryde","fromEmail":"user42@zip.com.au","sentAt":"2011-04-04T23:15:41Z","receivedAt":"2011-04-04T23:15:41Z","isPatch":true,"sender":{"key":"user42@zip.com.au","avatar":null},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n> Lawrence Mitchell wrote:\n>> font-lock-add-keywords rather than font-lock-compile-keywords.\n>> However, it doesn't exist in XEmacs,\n\nOh, I didn't realize that.  In my own code I think I've only ever\nset font-lock-defaults and left it at that ...\n\n\n\n-- \nNewton's first law elucidated for the layman:\nA body in motion continues in motion, unless it doesn't.\n"}]}