vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] vile does not understand certain entries in "tags" files gene


From: Thomas Dickey
Subject: Re: [vile] vile does not understand certain entries in "tags" files generated by `ctags'.
Date: Sat, 10 Mar 2018 19:41:54 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

On Sat, Mar 10, 2018 at 11:09:29PM +0100, j. van den hoff wrote:
> On Fri, 09 Mar 2018 22:24:16 +0100, Thomas Dickey <address@hidden> wrote:
> 
> >On Fri, Mar 09, 2018 at 05:37:24PM +0100, j. van den hoff wrote:
> >>I have a "tags" file of function definitions in the `R' language
> >>(https://www.r-project.org). function names can contain periods, so I
> >>have
> >>lines such as
> >>
> >>disp.array      fzrutils/R/disp.array.R /^disp.array <- function ($/;"
> >>f
> >>
> >>in the "tags" file. my `.vilerc' contains
> >>
> >>set tags {path_to_the_tags_file}
> >>set tagrelative
> >>
> >>`vi -t disp.array' does not work as expected but reacts the same way it
> >>does
> >>when a non-existent tag is specified (just reporting the read-in config
> >>files: "Reading ~/vile.rc" etc.). tags not containing a `.'  in the
> >>function
> >>name work just fine. `vim -t disp.array' does the expected even if the
> >>`.'
> >>is present in the name.
> >>
> >>Am I missing something or is this a bug?
> >
> >When doing ^]], vile's using a function checks only the character class,
> >and stops when a character isn't an "identifier":
> >
> >int
> >screen_to_ident(char *buf, size_t bufn)
> >{
> >    int rc = FALSE;
> >    CHARTYPE mask = vl_ident;
> >    int whole_line = adjust_chartype(&mask);
> >
> >    TRACE((T_CALLED "screen_to_ident\n"));
> >    rc = read_by_regex(buf, bufn, b_val_rexp(curbp, VAL_IDENTIFIER_EXPR),
> >whole_line);
> >    if (rc == FALSE)
> >     rc = read_by_ctype(buf, bufn, mask, whole_line);
> >    returnCode(rc);
> >}
> >
> >:show-printable shows that it's not (by default) an "id" character:
> >
> >45   -        -   -   -   -  -   prn pun -   -  path -   arg -  nsp -   tmp 
> >sh
> >46   .        -   -   -   -  -   prn pun -   -  path -   arg -  nsp -   tmp 
> >sh
> >47   /        -   -   -   -  -   prn pun -   -  path -   -   -  nsp -   tmp 
> >sh
> >48   0        -   -   num -  -   prn -   -   id path -   arg -  nsp qid tmp 
> >sh
> >49   1        -   -   num -  -   prn -   -   id path -   arg -  nsp qid tmp 
> >sh
> >
> >You could change that with
> >
> >     set-char-class id=[.]
> >45   -        -   -   -   -  -   prn pun -   -  path -   arg -  nsp -   tmp 
> >sh
> >46   .        -   -   -   -  -   prn pun -   id path -   arg -  nsp -   tmp 
> >sh
> >47   /        -   -   -   -  -   prn pun -   -  path -   -   -  nsp -   tmp 
> >sh
> >48   0        -   -   num -  -   prn -   -   id path -   arg -  nsp qid tmp 
> >sh
> >49   1        -   -   num -  -   prn -   -   id path -   arg -  nsp qid tmp 
> >sh
> 
> thank you -- didn't know of the `show-printable' command... anyhow, your
> suggested solution does not work for me: I put the
> 
>    set-char-class id=[.]
> 
> into my .vilerc but nothing has changed. `vi -t disp.array' (in my example)
> does still not work.

ah... I was answering the scenario that I used for a quick test.

The short answer is that there's more than one case used for tags.

From the command-line, the -t option adds the value as part of a startup
script:

                    add_cmdarg(opts_bp, "tag %s\n", GetArgVal(param));
 
so you should get the same result using
        :tag disp.array

Reading from the screen is different.

From a command-line (or script), the code's not limited by the character
class exactly - it's ended with whitespace, newline, etc.  It accepts
a tab for name-completion of course.

But I'm puzzled because a few cases that I set up for answering the mail
worked for me, e.g.,

PACKAGES.arch   package/debian/rules    /^PACKAGES.arch  = vile vile-filters 
xvile$/;"  m

and now, using your example (and a suitable file for the target of course):

disp.array      fzrutils/R/disp.array.R /^disp.array <- function ($/;"  f

Perhaps there's something related to your locale settings.  I'm using
en_US.UTF-8, and recall that "." is treated differently in the European
locales.  But a quick test with de_DE.UTF-8 gives me consistent results.

> what I _have_ learned in the meantime: when being already in the editor `:ta
> disp.array' works just fine (w/ or w/o the `set-char-class id=[.]' in
> `.vilerc'). this is good and suffices as a working solution but I would of
> course be grateful for any further hint how to make `vi -t' work for
> `foo.bar' type names.
> 
> another observation: when using `:ta {tagname}' from within `vile', TAB
> completion of tagname works, but only for tagnames _not_ containing a `.'
> (again, independent of whether `set-char-class id=[.]' has been issued or
> not).
> 
> >
> >>seen with vile version 9.8o for darwin14.3.0.
> >>
> >>thank you
> >>
> >>joerg
> >>
> >>PS: I also presume, there is a small `ctags' bug here. the search
> >>pattern
> >>probably should backslash-protect the period in order to actually only
> >>match
> >>`disp.array' verbatim rather than
> >>disp{any-single-character}array, no? otherwise one might jump to the
> >>wrong
> >>tag/file/position.
> >
> >hmm - I think it's correct, since "magic" is normally set.
> 
> ah., I see. maybe it's time to spend some time with the (really good) vile
> help file again: I was not aware of the 'magic' feature of vi and vile at
> all. sorry for the noise...

no problem - actually reading the mail, I made a note to verify whether
vile's doing the right thing

-- 
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]