Bug#524338: vim-runtime: Wrong check of c_syntax_for_h & ch_syntax_for_h variables to detect filetype of .h files

Jérémy Dufour djerem+debian-bug at djerem.net
Thu Apr 16 11:20:47 UTC 2009


Package: vim-runtime
Version: 2:7.2.130-1
Severity: normal
Tags: patch

In /usr/share/vim/vim72/filetype.vim, the function s:FTheader checks if
the "c_syntax_for_h" and "ch_syntax_for_h" are defined but only the
local version of those variables, which will never exist. So, even if you
set c_syntax_for_h globally, .h files are still considered as cpp and
not c. To check the problem, just try to edit a .h file and check value
of filetype (it should be "c" if c_syntax_for_h is defined).

The s:FTheader function should check for the global version of those
variables: "g:c_syntax_for_h" and "g:c_syntax_for_h".

This was working in previous version (7.1), because the code to check
c_syntax_for_h was outside of a function.

Find attached a patch to correct the function.

Thanks,

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing'), (150, 'unstable'), (110, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-openvz-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim-runtime depends on:
ii  dpkg                          1.14.25    Debian package management system

Versions of packages vim-runtime recommends:
ii  vim                          2:7.2.130-1 Vi IMproved - enhanced vi editor

vim-runtime suggests no packages.

-- debconf-show failed
-------------- next part --------------
--- /usr/share/vim/vim72/filetype.vim	2009-04-16 13:12:42.000000000 +0200
+++ /tmp/filetype.vim	2009-04-16 13:11:59.000000000 +0200
@@ -364,9 +364,9 @@
 func! s:FTheader()
   if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1
     setf objc
-  elseif exists("c_syntax_for_h")
+  elseif exists("g:c_syntax_for_h")
     setf c
-  elseif exists("ch_syntax_for_h")
+  elseif exists("g:ch_syntax_for_h")
     setf ch
   else
     setf cpp


More information about the pkg-vim-maintainers mailing list