Hi,
>> > I found that tag files generated by src/tools/make_ctags
>> > doesn't include some keywords, that were field names of node
>> > structs, for example norm_select in RestrictInfo. Such fields
>> > are defined with pg_node_attr macro that was introduced
>> > recently, like:
>> >
>> > Selectivity norm_selec pg_node_attr(equal_ignore);
>> >
>> > In this case, pg_node_attr is mistakenly interpreted to be
>> > the name of the field. So, I propose to use -I option of ctags
>> > to ignore the marco name. Attached is a patch to do it.
I found the same issue with make_etags too.
> I updated the patch to ignore the code under tmp_install and add
> some file types like sql, p[lm], and so on. .sgml or .sh is not
> included because they don't seem to be beneficial for ctags.
I tried to apply the v2 patch approach to make_etags but noticed that
make_ctags and make_etags have quite a few duplicate codes, that would
bring maintenance headache. I think we could merge make_etags into
make_ctags, then add "-e" option (or whatever) to make_ctags so that
it generates tags files for emacs if the option is specified.
Patch attahced.
Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
diff --git a/src/tools/make_ctags b/src/tools/make_ctags
index 912b6fafac..3a65139d94 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -1,12 +1,30 @@
#!/bin/sh
-# src/tools/make_ctags
+# src/tools/make_ctags [-e]
+# If -e is specified, generate tags files for emacs.
+usage="$0 [-e]"
+if [ $# -gt 1 ];then
+ echo $usage
+ exit 1
+fi
+
+mode=
+tags_file=tags
+
+if [ $# = 1 ];then
+ if [ $1 != "-e" ];then
+ echo $usage
+ exit 1
+ fi
+ mode="-e"
+ tags_file=TAGS
+fi
command -v ctags >/dev/null || \
{ echo "'ctags' program not found" 1>&2; exit 1; }
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
-rm -f ./tags
+rm -f ./$tags_file
IS_EXUBERANT=""
ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
@@ -34,9 +52,17 @@ then FLAGS="--c-kinds=+dfmstuv"
else FLAGS="-dt"
fi
+# Use -I option to ignore a macro
+if [ "$IS_EXUBERANT" ]
+then IGNORE_IDENTIFIES="-I pg_node_attr+"
+else IGNORE_IDENTIFIES=
+fi
+
# this is outputting the tags into the file 'tags', and appending
-find `pwd`/ -type f -name '*.[chyl]' -print |
- xargs ctags -a -f tags "$FLAGS"
+find `pwd`/ \( -name tmp_install -prune -o -name tmp_check -prune \) \
+ -o \( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*.in" \
+ -o -name "*.sql" -o -name "*.p[lm]" \) -type f -print |
+ xargs ctags $mode -a -f $tags_file "$FLAGS" "$IGNORE_IDENTIFIES"
# Exuberant tags has a header that we cannot sort in with the other entries
# so we skip the sort step
@@ -45,10 +71,10 @@ find `pwd`/ -type f -name '*.[chyl]' -print |
if [ ! "$IS_EXUBERANT" ]
then LC_ALL=C
export LC_ALL
- sort tags >/tmp/$$ && mv /tmp/$$ tags
+ sort $tags_file >/tmp/$$ && mv /tmp/$$ $tags_file
fi
find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -type d -print |
while read DIR
-do [ "$DIR" != "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/tags "$DIR"/tags
+do [ "$DIR" != "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/$tags_file "$DIR"/$tags_file
done