Thursday, March 25, 2010

Re: Why is "template" highlighted in Java code

I'm trying to track this one down. The Debian sources used for vim
don't quite jive with the sources from vim.org.

The 7.2 sources from vim.org do not highlight the keywords by default.
The change appears to have been made on 25 June 2008, well before the
9 August 2009 release of vim 7.2.

http://vim.svn.sourceforge.net/viewvc/vim/vim7/runtime/syntax/java.vim?r1=1071&r2=1073

However, the current "original" sources used in the Debian vim-common
package don't contain that change. In fact, the java.vim file found
there is not identical to the original one from 7.1 or 7.2.

http://packages.debian.org/sid/vim-common

Anyway, it looks like a Debian packaging issue.

Josh

On Thu, Mar 25, 2010 at 10:01 AM, Benjamin R. Haskell <vim@benizi.com> wrote:
> On Thu, 25 Mar 2010, sc wrote:
>
>> On Thursday 25 March 2010 11:34:50 Benjamin R. Haskell wrote:
>>
>> > From :help ft-java-syntax :
>> >
>> >         In order to help you write code that can be easily
>> >  ported between  Java and C++, all C++ keywords can be marked
>> >  as an error in a Java program.  To have this add this line in
>> >  your .vimrc file:
>> >
>> >         :let java_allow_cpp_keywords = 0
>> >
>> > So, it seems like the default is supposed to be 1, which
>> >  seems  reasonable.  (That is: the user must choose to turn
>> >  those keywords into errors.)  The syntax file on my system
>> >  appears to confirm that. (Line 126 sets it to 1 if it isn't
>> >  set.)  Perhaps your distribution made the choice (mistake,
>> >  IMO) to override that?
>>
>> maybe my runtime is out of date?  my java.vim is dated
>> 2009-mar-14
>>
>> the way it's coded:
>>
>> if !exists("java_allow_cpp_keywords")
>>   syn keyword javaError auto delete extern friend inline
>> redeclared
>>   syn keyword javaError register signed sizeof struct template
>> typedef union
>>   syn keyword javaError unsigned operator
>> endif
>>
>> (well before my mailer scrunched the long lines)
>>
>> appears to me the default is to flag the cpp keywords as
>> errors unless and until the user puts
>>
>>     let java_allow_cpp_keywords = 1
>>
>> in their .vimrc -- this leads me to think perhaps the help on
>> this subject isn't really clear on this matter
>>
>
> Mine has:
>
> if !exists("java_allow_cpp_keywords")
>  " The default used to be to highlight C++ keywords.  But several people
>  " don't like that, so default to not highlighting these.
>  let java_allow_cpp_keywords = 1
> endif
> if !java_allow_cpp_keywords
>  syn keyword javaError auto delete extern friend inline redeclared
>  syn keyword javaError register signed sizeof struct template typedef union
>  syn keyword javaError unsigned operator
> endif
>
> The comments at the top indicate that the last change was 2007 Dec 21,
> but the file timestamp is 2009-10-24 (which is the install date,
> probably).  The same is true on my home computer ('Last Change: 2007 Dec
> 21', but timestamp matches the install date '2010-03-05')
>
> --
> Best,
> Ben
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: