c89 and c99 filetypes

2006-06-22 Thread Yakov Lerner

Bram,

Following the discussion in vim mailing list, and now that
more C compilers support c99 features, what do you think about
adding two explicit filetypes, c89 and c99, to allow vim scripts
to clearly distinguish between the two distinct flavors of C:

--- file syntax/c89.vim --
 Vim syntax file
 Language: C99 flavor of C (as opposed to C89)

let c_no_c99
runtime c.vim
 file syntax/c99.vim ---
 Vim syntax file
 Language: C89 flavour of C (as opposed to C99)

unlet c_no_c99
runtime c.vim


I am unsure about couple of points:

1) shall variable c_no_c99 be not global but buffer-local ?
   What c.vim checks is global var, is not it ?
2) is addition to filetypes.vim needed ?

Yakov


Re: c89 and c99 filetypes

2006-06-22 Thread Bram Moolenaar

Yakov Lerner wrote:

 Following the discussion in vim mailing list, and now that
 more C compilers support c99 features, what do you think about
 adding two explicit filetypes, c89 and c99, to allow vim scripts
 to clearly distinguish between the two distinct flavors of C:
 
 --- file syntax/c89.vim --
  Vim syntax file
  Language: C99 flavor of C (as opposed to C89)
 
 let c_no_c99
 runtime c.vim
  file syntax/c99.vim ---
  Vim syntax file
  Language: C89 flavour of C (as opposed to C99)
 
 unlet c_no_c99
 runtime c.vim
 
 
 I am unsure about couple of points:
 
 1) shall variable c_no_c99 be not global but buffer-local ?
 What c.vim checks is global var, is not it ?
 2) is addition to filetypes.vim needed ?

I think we should keep the filetype name at C.  Adding variables to
specify what kind of C is fine, but using c89 and c99 as a filetype
name will cause trouble (you would need to triple all plugins that are
related to C).

There might be a way in between: when 'filetype' is set to c89 or
c99 an autocommand or plugin sets the global variable and sets
'filetype' to c.  I haven't seen this used yet, there might very well
be some disadvantages.  At least it would be possible to set the
filetype in a modeline.

-- 
LAUNCELOT: Isn't there a St. Arrggghhh's in Cornwall?
ARTHUR:No, that's Saint Ives.
 Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: c89 and c99 filetypes

2006-06-22 Thread Nikolai Weibull

On 6/22/06, Bram Moolenaar [EMAIL PROTECTED] wrote:


There might be a way in between: when 'filetype' is set to c89 or
c99 an autocommand or plugin sets the global variable and sets
'filetype' to c.  I haven't seen this used yet, there might very well
be some disadvantages.  At least it would be possible to set the
filetype in a modeline.


I like that solution.  It's simple, forces minimal changes, and even
solves the problem!

 nikolai