r976 - in /trunk/packages/vim: debian/changelog patches/debchangelog-closes_omni.vim.diff

zack at users.alioth.debian.org zack at users.alioth.debian.org
Sat Jun 23 12:54:14 UTC 2007


Author: zack
Date: Sat Jun 23 12:54:14 2007
New Revision: 976

URL: http://svn.debian.org/wsvn/pkg-vim/?sc=1&rev=976
Log:
* Add debchangelog-closes_omni.vim.diff, which add omni completion support
  for "Closes: #..." retrieving data from the BTS via apt-listbugs

Added:
    trunk/packages/vim/patches/debchangelog-closes_omni.vim.diff
Modified:
    trunk/packages/vim/debian/changelog

Modified: trunk/packages/vim/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim/debian/changelog?rev=976&op=diff
==============================================================================
--- trunk/packages/vim/debian/changelog (original)
+++ trunk/packages/vim/debian/changelog Sat Jun 23 12:54:14 2007
@@ -25,6 +25,8 @@
   [ Stefano Zacchiroli ]
   * Add javac_cmdline-vim.diff, which fixes the invocation of the javac
     compiler. (Closes: #408338)
+  * Add debchangelog-closes_omni.vim.diff, which add omni completion support
+    for "Closes: #..." retrieving data from the BTS via apt-listbugs
   * Added the new Debian Vim Policy to the "vim-doc" package, overriding the
     old unenforced one
   * debian/runtime/debian.vim.in
@@ -35,7 +37,7 @@
     - added build deps on docbook stuff to build the policy (note that this
       includes lynx, due to #387035)
 
- -- James Vega <jamessan at debian.org>  Fri, 22 Jun 2007 10:31:03 +0100
+ -- Stefano Zacchiroli <zack at debian.org>  Sat, 23 Jun 2007 13:51:55 +0100
 
 vim (1:7.1-000+1) unstable; urgency=low
 

Added: trunk/packages/vim/patches/debchangelog-closes_omni.vim.diff
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim/patches/debchangelog-closes_omni.vim.diff?rev=976&op=file
==============================================================================
--- trunk/packages/vim/patches/debchangelog-closes_omni.vim.diff (added)
+++ trunk/packages/vim/patches/debchangelog-closes_omni.vim.diff Sat Jun 23 12:54:14 2007
@@ -1,0 +1,99 @@
+Index: vim/runtime/ftplugin/debchangelog.vim
+===================================================================
+--- vim/runtime/ftplugin/debchangelog.vim.orig
++++ vim/runtime/ftplugin/debchangelog.vim
+@@ -1,4 +1,4 @@
+-" Vim filetype plugin file (GUI menu and folding)
++" Vim filetype plugin file (GUI menu, folding and completion)
+ " Language:	Debian Changelog
+ " Maintainer:	Michael Piefel <piefel at informatik.hu-berlin.de>
+ "		Stefano Zacchiroli <zack at debian.org>
+@@ -15,7 +15,7 @@
+ if !exists("g:debchangelog_fold_disable")
+   setlocal foldmethod=expr
+ endif
+-setlocal foldexpr=GetDebChangelogFold(v:lnum)
++setlocal foldexpr=DebGetChangelogFold(v:lnum)
+ setlocal foldtext=DebChangelogFoldText()
+ 
+ " Debian changelogs are not supposed to have any other text width,
+@@ -242,6 +242,22 @@
+   return '[unknown]'
+ endfunction
+ 
++" Look for a package source name searching backward from the givenline and
++" returns it. Return the empty string if the package name can't be found
++function! DebGetPkgSrcName(lineno)
++  let lineidx = a:lineno
++  let pkgname = ''
++  while lineidx > 0
++    let curline = getline(lineidx)
++    if curline =~ '^\S'
++      let pkgname = matchlist(curline, '^\(\S\+\).*$')[1]
++      break
++    endif
++    let lineidx = lineidx - 1
++  endwhile
++  return pkgname
++endfunction
++
+ function! DebChangelogFoldText()
+   if v:folddashes == '-'  " changelog entry fold
+     return foldtext() . ' -- ' . s:getAuthor(v:foldstart, v:foldend) . ' '
+@@ -249,7 +265,7 @@
+   return foldtext()
+ endfunction
+ 
+-function! GetDebChangelogFold(lnum)
++function! DebGetChangelogFold(lnum)
+   let line = getline(a:lnum)
+   if line =~ '^\w\+'
+     return '>1' " beginning of a changelog entry
+@@ -269,4 +285,47 @@
+ 
+ " }}}
+ 
++" {{{1 omnicompletion for Closes: #
++
++if !exists('g:debchangelog_listbugs_severities')
++  let g:debchangelog_listbugs_severities = 'critical,grave,serious,important,normal,minor,wishlist'
++endif
++
++fun! DebCompleteBugs(findstart, base)
++  if a:findstart
++    " it we are just after an '#', the completion should start at the '#',
++    " otherwise no completion is possible
++    let line = getline('.')
++    let colidx = col('.')
++    if colidx > 1 && line[colidx - 2] =~ '#'
++      let colidx = colidx - 2
++    else
++      let colidx = -1
++    endif
++    return colidx
++  else
++    if ! filereadable('/usr/sbin/apt-listbugs')
++      echoerr 'apt-listbugs not found, you should install it to use Closes bug completion'
++      return
++    endif
++    let pkgsrc = DebGetPkgSrcName(line('.'))
++    let listbugs_output = system('apt-listbugs -s ' . g:debchangelog_listbugs_severities . ' list ' . pkgsrc . ' | grep "^ #" 2> /dev/null')
++    let bug_lines = split(listbugs_output, '\n')
++    let completions = []
++    for line in bug_lines
++      let parts = matchlist(line, '^\s*\(#\S\+\)\s*-\s*\(.*\)$')
++      let completion = {}
++      let completion['word'] = parts[1]
++      let completion['menu'] = parts[2]
++      let completion['info'] = parts[0]
++      let completions += [completion]
++    endfor
++    return completions
++  endif
++endfun
++
++setlocal omnifunc=DebCompleteBugs
++
++" }}}
++
+ " vim: set foldmethod=marker:




More information about the pkg-vim-maintainers mailing list