Re: The global parameter -f is invalid for files of non - C/C++ languages
Shigio YAMAGUCHI <[email protected]> Thu, 8 May 2025 18:08:34 +0900
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <CADJmJYq-ODMLyyWXuvYRwn=pH4Xz_A9enQh52-pbmRaCv0AmEw@mail.gmail.com> |
--00000000000064514606349c3206
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hello,
> So, I suspect that the -f parameter is only effective for C/C++ language
files.
I don't think that's the case. In my environment, I get the following
results:
---------------------------------------------------------------
$ cat test.sh
test1() {
echo "test1"
}
test1
$ cat test.py
def test2():
print("test2")
test2()
$ gtags
$ global -f test.sh
test1 1 test.sh test1() {
$ global -f test.py
test2 1 test.py def test2():
$ cat gtags.conf
default:\
:ctagscom=3D/usr/local/bin/ctags:\
:ctagslib=3D$libdir/gtags/universal-ctags.la:\
:langmap=3DPython\:.py.pyx.pxd.pxi.scons:\
:langmap=3DSh\:.sh.SH.bsh.bash.ksh.zsh.ash:\
:gtags_parser=3DPython\:$ctagslib:\
:gtags_parser=3DSh\:$ctagslib:
---------------------------------------------------------------
Could you please try running gtags(1) with the -v option?
Perhaps .sh and .py files are not being recognized as source code?
Regards,
Shigio
On Thu, May 8, 2025 at 5:42=E2=80=AFPM agen <[email protected]> wrote:
> Case=EF=BC=9A
>
> ~/aaa$ global -xa main
> main 3 /home/cstor/aaa/test.cc int main () {
> main 1 /home/cstor/aaa/test1.c int main()
> main 1 /home/cstor/aaa/test2.sh function main () {
> main 1 /home/cstor/aaa/test3.py def main():
> ~/aaa$
> ~/aaa$
> ~/aaa$ global -xaf test.cc
> main 3 /home/cstor/aaa/test.cc int main () {
> ~/aaa$
> ~/aaa$ global -xaf test3.py
> ~/aaa$
> ~/aaa$global -xaf test2.sh
> ~/aaa$
>
>
> As can be seen above=EF=BC=9A
>
> - The *global -xa main* command can find all files containing the main
> symbol, which means there is no problem with the *gtags* command when
> generating symbols.
> - The *global -xaf test.cc* command can display all the symbols in the
> test.cc file.
> - The outputs of both *global -xaf test3.py* and *global -xaf test2.sh=
* are
> empty.
>
>
> So, I suspect that the *-f* parameter is only effective for C/C++
> language files.
>
--=20
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F 1C33 969C 3BE3 89DD A6EB
--00000000000064514606349c3206
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello,<br>> So, I suspect that the -f parameter is only=
effective for C/C++ language files.<br><br>I don't think that's th=
e case. In my environment, I get the following results:<br><br>------------=
---------------------------------------------------<br>$ cat test.sh<br>tes=
t1() {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "test1"<br>}<br>test1 =
<br>$ cat test.py<br>def test2():<br>=C2=A0 =C2=A0 print("test2")=
<br>test2()<br>$ gtags<br>$ global -f test.sh <br>test1 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1 test.sh =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0test1() {<br>$ global -f test.py <br>test2 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 1 test.py =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0def test2(=
):<br>$ cat gtags.conf<br>default:\<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 :ctagsco=
m=3D/usr/local/bin/ctags:\<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 :ctagslib=3D$libd=
ir/gtags/<a href=3D"http://universal-ctags.la">universal-ctags.la</a>:\<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 :langmap=3DPython\:.py.pyx.pxd.pxi.scons:\<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 :langmap=3DSh\:.sh.SH.bsh.bash.ksh.zsh.ash:\<br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 :gtags_parser=3DPython\:$ctagslib:\<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 :gtags_parser=3DSh\:$ctagslib:<br><br>----------------=
-----------------------------------------------<br><br>Could you please try=
running gtags(1) with the -v option?<br>Perhaps .sh and .py files are not =
being recognized as source code?<br><br>Regards,<br>Shigio<br></div><br><di=
v class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gma=
il_attr">On Thu, May 8, 2025 at 5:42=E2=80=AFPM agen <<a href=3D"mailto:=
[email protected]">[email protected]</a>> wrote:<br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
rgb(204,204,204);padding-left:1ex"><div style=3D"font-family:-apple-system=
,system-ui;font-size:14px;color:rgb(0,0,0)"><span style=3D"line-height:1.6"=
>Case=EF=BC=9A</span></div><div style=3D"font-family:-apple-system,system-u=
i;font-size:14px;color:rgb(0,0,0)"><br></div><table style=3D"box-sizing:bor=
der-box;border-collapse:collapse;border-spacing:0px"><tbody><tr><td style=
=3D"width:1121px;height:22px;border-width:1px;border-style:solid;border-col=
or:rgb(171,171,171);padding:4px 8px;vertical-align:middle;box-sizing:border=
-box"><div style=3D"font-family:-apple-system,system-ui;font-size:14px;colo=
r:rgb(0,0,0)"><span style=3D"line-height:1.6">~/aaa$ global -xa main</span>=
</div><div style=3D"font-family:-apple-system,system-ui;font-size:14px;colo=
r:rgb(0,0,0)"><span style=3D"line-height:1.6">main =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03 /home/cstor/aaa/test.cc int main () {</spa=
n></div><div style=3D"font-family:-apple-system,system-ui;font-size:14px;co=
lor:rgb(0,0,0)"><span style=3D"line-height:1.6">main =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01 /home/cstor/aaa/test1.c int main()</spa=
n></div><div style=3D"font-family:-apple-system,system-ui;font-size:14px;co=
lor:rgb(0,0,0)"><span style=3D"line-height:1.6">main =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01 /home/cstor/aaa/test2.sh=C2=A0function =
main () {</span></div><div style=3D"font-family:-apple-system,system-ui;fon=
t-size:14px;color:rgb(0,0,0)"><span style=3D"line-height:1.6">main =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01 /home/cstor/aaa/test3.py =
def main():</span></div><div style=3D"font-family:-apple-system,system-ui;f=
ont-size:14px;color:rgb(0,0,0)"><span style=3D"line-height:1.6">~/aaa$</spa=
n></div><div style=3D"font-family:-apple-system,system-ui;font-size:14px;co=
lor:rgb(0,0,0)"><span style=3D"line-height:1.6">~/aaa$</span></div><div sty=
le=3D"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)">=
<span style=3D"line-height:1.6">~/aaa$ global -xaf test.cc</span></div><div=
style=3D"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,=
0)"><span style=3D"line-height:1.6">main =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A03 /home/cstor/aaa/test.cc=C2=A0int main () {</span></d=
iv><div style=3D"font-family:-apple-system,system-ui;font-size:14px;color:r=
gb(0,0,0)"><span style=3D"line-height:1.6">~/aaa$</span></div><div style=3D=
"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)"><span=
style=3D"line-height:1.6">~/aaa$ global -xaf test3.py</span></div><div sty=
le=3D"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)">=
<span style=3D"line-height:1.6">~/aaa$</span></div><div style=3D"font-famil=
y:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)"><span style=3D"l=
ine-height:1.6">~/aaa$</span><span style=3D"background-color:rgb(255,255,25=
5);line-height:1.6">global -xaf test2.sh</span></div><div style=3D"font-fam=
ily:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)"><span style=3D=
"background-color:rgb(255,255,255);line-height:1.6">~/aaa$</span></div><div=
style=3D"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,=
0)"><span style=3D"background-color:rgb(255,255,255);line-height:1.6"><br><=
/span></div></td></tr></tbody></table><div style=3D"font-family:-apple-syst=
em,system-ui;font-size:14px;color:rgb(0,0,0)"><span style=3D"line-height:1.=
6"><br></span></div><div style=3D"font-family:-apple-system,system-ui;font-=
size:14px;color:rgb(0,0,0)"><span style=3D"line-height:1.6">As can be seen =
above=EF=BC=9A</span></div><ul style=3D"list-style-type:disc"><li style=3D"=
font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)"><div><=
span style=3D"background-color:rgb(255,255,255);line-height:1.6">The <b>glo=
bal -xa main</b>=C2=A0command can find all files containing the main symbol=
, which means there is no problem with the <b>gtags</b>=C2=A0command when g=
enerating symbols.</span></div></li><li style=3D"font-family:-apple-system,=
system-ui;font-size:14px;color:rgb(0,0,0)"><div><span style=3D"background-c=
olor:rgb(255,255,255);line-height:1.6">The <b>global -xaf test.cc</b>=C2=A0=
command can display all the symbols in the test.cc file.</span></div></li><=
li style=3D"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,=
0,0)"><div><span style=3D"background-color:rgb(255,255,255);line-height:1.6=
">The outputs of both <b>global -xaf test3.py</b>=C2=A0and <b>global -xaf t=
est2.sh</b>=C2=A0are empty.</span></div></li></ul><div style=3D"font-family=
:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)"><span style=3D"ba=
ckground-color:rgb(255,255,255);line-height:1.6"><br></span></div><div styl=
e=3D"font-family:-apple-system,system-ui;font-size:14px;color:rgb(0,0,0)"><=
span style=3D"background-color:rgb(255,255,255);line-height:1.6">So, I susp=
ect that the <b>-f</b>=C2=A0parameter is only effective for C/C++ language =
files.</span></div></blockquote></div><div><br clear=3D"all"></div><div><br=
></div><span class=3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr=
" class=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div dir=
=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">Shigio YAMAGUCH=
I <<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a=
>></div><div dir=3D"ltr"><div dir=3D"ltr">PGP fingerprint:=C2=A0</div><d=
iv dir=3D"ltr">26F6 31B4 3D62 4A92 7E6F =C2=A01C33 969C 3BE3 89DD A6EB</div=
></div></div></div></div></div></div></div></div>
--00000000000064514606349c3206--