about vim contrib support

2013-01-10 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

In the contrib/vim/README file there are instructions about how to setup
git support with Vim builtin git syntax files.

However these instructions seems to be redundant, since the system
filetype.vim file already have the autocmd rules.

The only issue I found is with:

autocmd BufNewFile,BufRead .msg.[0-9]*
\ if getline(1) =~ '^From.*# This line is ignored.$' |
\   setf gitsendemail |
\ endif

It should be:

autocmd BufNewFile,BufRead [0-9]*.patch

IMHO it should contain some other checks, to make sure it is a patch
generated by git format-patch, and not, as an example, a plain patch or
a Mercurial patch.


By the way: I don't understand the purpose of gitsendemail syntax.
On my system it does not highlight the diff.

I have implemented an alternate gitpatch syntax file, attached.
What I would like to get, is to syntax highligth the commit subject
message, but I'm not a Vim expert.


Regards   Manlio
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDuo0sACgkQscQJ24LbaUTZMQCgm7QRylhxc5v4i4tHBfUXCl8o
36IAn3t72o/+5R/x1TF7r9mu85z6wY25
=b2l0
-END PGP SIGNATURE-
 Vim syntax file
 Language: git format-patch message
 Maintainer:   Manlio Perillo
 Filenames:[0-9]*.patch (first line is From ... # This line is ignored.)
 Last Change:  2014 Gen 10

if exists(b:current_syntax)
finish
endif

syn case match

syn match   gitsendemailComment \%^From.*#.*
syn match   gitsendemailComment ^GIT:.*

if has(spell)
syn spell toplevel
endif

syn include @gitcommitMessage syntax/gitcommit.vim
syn region gitcommitMessage start=/^Subject: \@=/ end=/^$|^#\@=/ 
contains=@gitcommitMessage

hi def link gitsendemailComment Comment

let b:current_syntax = gitpatch


Re: about vim contrib support

2013-01-10 Thread Jeff King
On Thu, Jan 10, 2013 at 12:17:31PM +0100, Manlio Perillo wrote:

 In the contrib/vim/README file there are instructions about how to setup
 git support with Vim builtin git syntax files.
 
 However these instructions seems to be redundant, since the system
 filetype.vim file already have the autocmd rules.

What version of vim do you have? As the README says, version 7.2 and on
come with the files already, and you do not need to do anything. If you
have an older version that does not ship with them, and you are pulling
them down directly from the URLs provided, then your vim probably does
not already have them in its stock filetype.vim.

 The only issue I found is with:
 
 autocmd BufNewFile,BufRead .msg.[0-9]*
   \ if getline(1) =~ '^From.*# This line is ignored.$' |
   \   setf gitsendemail |
   \ endif
 
 It should be:
 
 autocmd BufNewFile,BufRead [0-9]*.patch

It looks like .msg.[0-9] was originally used for send-email cover
letters, and was changed to .gitsendemail.msg.* by commit eed6ca7. I
think your [0-9]*.patch would match something else entirely (though it
is still broken, of course, as .msg.* does not exist anymore).

I'd argue that we should just remove contrib/vim at this point. It has
no actual files in it, only pointers to vim.org for pre-7.2 vim users.
And that version was released in 2008, so the README is helping almost
nobody at this point (if you are on an ancient platform, and are an avid
enough vim user to download the syntax files, I suspect you would simply
install a newer version of vim).

 IMHO it should contain some other checks, to make sure it is a patch
 generated by git format-patch, and not, as an example, a plain patch or
 a Mercurial patch.
 
 By the way: I don't understand the purpose of gitsendemail syntax.
 On my system it does not highlight the diff.

As far as I can tell, it is for cover letters, not for patches. Patches
should already be handled by existing RFC822-message highlighting.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: about vim contrib support

2013-01-10 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 10/01/2013 12:39, Jeff King ha scritto:
 On Thu, Jan 10, 2013 at 12:17:31PM +0100, Manlio Perillo wrote:
 
 In the contrib/vim/README file there are instructions about how to setup
 git support with Vim builtin git syntax files.

 However these instructions seems to be redundant, since the system
 filetype.vim file already have the autocmd rules.
 
 What version of vim do you have? As the README says, version 7.2 and on
 come with the files already, and you do not need to do anything.

Ah, right.
I missed the first lines of the README file, sorry.


 [...]
 The only issue I found is with:

 autocmd BufNewFile,BufRead .msg.[0-9]*
  \ if getline(1) =~ '^From.*# This line is ignored.$' |
  \   setf gitsendemail |
  \ endif

 It should be:

 autocmd BufNewFile,BufRead [0-9]*.patch
 
 It looks like .msg.[0-9] was originally used for send-email cover
 letters,

Ok, thanks.
I was assuming it was used for the generated patched.

 and was changed to .gitsendemail.msg.* by commit eed6ca7. I
 think your [0-9]*.patch would match something else entirely (though it
 is still broken, of course, as .msg.* does not exist anymore).
 
 [...]
 By the way: I don't understand the purpose of gitsendemail syntax.
 On my system it does not highlight the diff.
 
 As far as I can tell, it is for cover letters, not for patches. Patches
 should already be handled by existing RFC822-message highlighting.
 

.patch files are handled by diff highlight.
What I would like to do is to use gitcommit syntax highlight, in order
to also enable commit subject message hightlight.



Thanks   Manlio
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDuqzYACgkQscQJ24LbaUQ5TgCfQPeX53KOsQDF6WJF1AaSpiRd
NpMAn0GcffJwTA/etrnOnXAQctCKAY4W
=IDVf
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html