On Sun, 10 Sep 2006 at 1:56pm, Bram Moolenaar wrote:

>
> Patch 7.0.096
> Problem:    taglist() returns the filename relative to the tags file, while
>           the directory of the tags file is unknown. (Hari Krishna Dara)
> Solution:   Expand the file name. (Yegappan Lakshmanan)
> Files:            src/tag.c

I applied the patch and tested that it works in my scenario, thank you.
However, I see that the name is expanded only when the tags file is not
in the current directory, which means the results can have a mixture of
both absolute and relative names (if they are coming from different tag
files in different directories). this could create some weird issues
with looking up tags in one window and opening the file in another
window and if they have differe lcd. This also means, the results can't
be cached and used later on, as the current directory could change. Is
this intentional?

One observation I made is that (on windows) the expanded path doesn't
include the drive letter unless the current directory and the directory
of the tags files are on different drives. I don't know if this is how
Vim normally behaves, but this means, they are not really absolute
paths, but relative to the current drive.

I could always explicitly do a fnamemodify() on each of the files, so it
is not a big deal, but I am wondering how efficient fnamemodify() is, if
it involves simple string manipulation or OS calls.

There was also a request from me some time back to allow a limit
argument to the taglist() function such that its response can be
improved in scenarios involving large number of matches. Is there a plan
to provide a 7.0 patch for this feature?

-- 
Thank you,
Hari

>
>
> *** ../vim-7.0.095/src/tag.c  Thu Apr 27 23:40:34 2006
> --- src/tag.c Sun Sep 10 13:42:41 2006
> ***************
> *** 3787,3792 ****
> --- 3787,3793 ----
>   {
>       int             num_matches, i, ret;
>       char_u  **matches, *p;
> +     char_u  *full_fname;
>       dict_T  *dict;
>       tagptrs_T       tp;
>       long    is_static;
> ***************
> *** 3809,3823 ****
>           if (list_append_dict(list, dict) == FAIL)
>               ret = FAIL;
>
>           if (add_tag_field(dict, "name", tp.tagname, tp.tagname_end) == FAIL
> !                 || add_tag_field(dict, "filename", tp.fname,
> !                                                      tp.fname_end) == FAIL
>                   || add_tag_field(dict, "cmd", tp.command,
>                                                      tp.command_end) == FAIL
>                   || add_tag_field(dict, "kind", tp.tagkind,
>                                                     tp.tagkind_end) == FAIL
>                   || dict_add_nr_str(dict, "static", is_static, NULL) == FAIL)
>               ret = FAIL;
>
>           if (tp.command_end != NULL)
>           {
> --- 3810,3827 ----
>           if (list_append_dict(list, dict) == FAIL)
>               ret = FAIL;
>
> +         full_fname = tag_full_fname(&tp);
>           if (add_tag_field(dict, "name", tp.tagname, tp.tagname_end) == FAIL
> !                 || add_tag_field(dict, "filename", full_fname,
> !                                                      NULL) == FAIL
>                   || add_tag_field(dict, "cmd", tp.command,
>                                                      tp.command_end) == FAIL
>                   || add_tag_field(dict, "kind", tp.tagkind,
>                                                     tp.tagkind_end) == FAIL
>                   || dict_add_nr_str(dict, "static", is_static, NULL) == FAIL)
>               ret = FAIL;
> +
> +         vim_free(full_fname);
>
>           if (tp.command_end != NULL)
>           {
> *** ../vim-7.0.095/src/version.c      Sun Sep 10 13:22:26 2006
> --- src/version.c     Sun Sep 10 13:52:01 2006
> ***************
> *** 668,669 ****
> --- 668,671 ----
>   {   /* Add new patch number below this line */
> + /**/
> +     96,
>   /**/
>
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to