Version 4.4

The following fixes are made in this release:
1. If multiple Vim plugins register for the BufEnter autocmd, then sometimes
    the buffer name supplied to the autocmd is incorrect. Use the buffer number
    instead of buffer name in the BufEnter autocmd.
2. Add the filename to the tags menu only for valid file names.
This commit is contained in:
Yegappan Lakshmanan 2007-05-25 00:00:00 +00:00 committed by Able Scraper
parent d6a611f70a
commit b892dfe62b
2 changed files with 21 additions and 14 deletions

View File

@ -2,7 +2,7 @@
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
For Vim version 6.0 and above For Vim version 6.0 and above
Last change: 2007 February 18 Last change: 2007 May 24
1. Overview |taglist-intro| 1. Overview |taglist-intro|
2. Taglist on the internet |taglist-internet| 2. Taglist on the internet |taglist-internet|
@ -1413,6 +1413,13 @@ A. Are you using Vim version 6.0 and above? The taglist plugin relies on the
> >
let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe' let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe'
< <
If you are using a cygwin compiled version of exuberant ctags on MS-Windows,
make sure that either you have the cygwin compiled sort utility installed
and available in your PATH or compile exuberant ctags with internal sort
support. Otherwise, when exuberant ctags sorts the tags output by invoking
the sort utility, it may end up invoking the MS-Windows version of
sort.exe, thereby resulting in failure.
Q. When I try to open the taglist window, I am seeing the following error Q. When I try to open the taglist window, I am seeing the following error
message. How do I fix this problem? message. How do I fix this problem?

View File

@ -1,8 +1,8 @@
" File: taglist.vim " File: taglist.vim
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
" Version: 4.3 " Version: 4.4
" Last Modified: February 18, 2007 " Last Modified: May 24, 2007
" Copyright: Copyright (C) 2002-2006 Yegappan Lakshmanan " Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -1662,7 +1662,7 @@ function! s:Tlist_Window_Init()
" Close the fold for this buffer when leaving the buffer " Close the fold for this buffer when leaving the buffer
if g:Tlist_File_Fold_Auto_Close if g:Tlist_File_Fold_Auto_Close
autocmd BufEnter * silent autocmd BufEnter * silent
\ call s:Tlist_Window_Open_File_Fold(expand('<afile>')) \ call s:Tlist_Window_Open_File_Fold(expand('<abuf>'))
endif endif
" Exit Vim itself if only the taglist window is present (optional) " Exit Vim itself if only the taglist window is present (optional)
if g:Tlist_Exit_OnlyWindow if g:Tlist_Exit_OnlyWindow
@ -4012,8 +4012,8 @@ autocmd BufDelete * silent call s:Tlist_Buffer_Removed(expand('<afile>:p'))
" Tlist_Window_Open_File_Fold " Tlist_Window_Open_File_Fold
" Open the fold for the specified file and close the fold for all the " Open the fold for the specified file and close the fold for all the
" other files " other files
function! s:Tlist_Window_Open_File_Fold(acmd_file) function! s:Tlist_Window_Open_File_Fold(acmd_bufnr)
call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_file . ')') call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_bufnr . ')')
" Make sure the taglist window is present " Make sure the taglist window is present
let winnum = bufwinnr(g:TagList_title) let winnum = bufwinnr(g:TagList_title)
@ -4044,7 +4044,7 @@ function! s:Tlist_Window_Open_File_Fold(acmd_file)
silent! %foldclose silent! %foldclose
" Get tag list index of the specified file " Get tag list index of the specified file
let fname = fnamemodify(a:acmd_file, ":p") let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p')
if filereadable(fname) if filereadable(fname)
let fidx = s:Tlist_Get_File_Index(fname) let fidx = s:Tlist_Get_File_Index(fname)
if fidx != -1 if fidx != -1
@ -4251,12 +4251,6 @@ function! s:Tlist_Menu_Update_File(clear_menu)
endif endif
let fname = escape(fnamemodify(bufname('%'), ':t'), '.')
if fname != ''
exe 'anoremenu T&ags.' . fname . ' <Nop>'
anoremenu T&ags.-SEP2- :
endif
" Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help
if &buftype != '' if &buftype != ''
return return
@ -4285,6 +4279,12 @@ function! s:Tlist_Menu_Update_File(clear_menu)
endif endif
endif endif
let fname = escape(fnamemodify(bufname('%'), ':t'), '.')
if fname != ''
exe 'anoremenu T&ags.' . fname . ' <Nop>'
anoremenu T&ags.-SEP2- :
endif
if !s:tlist_{fidx}_tag_count if !s:tlist_{fidx}_tag_count
return return
endif endif