Re: make_ctags: use -I option to ignore pg_node_attr macro
| От | Tatsuo Ishii |
|---|---|
| Тема | Re: make_ctags: use -I option to ignore pg_node_attr macro |
| Дата | |
| Msg-id | 20230207.212904.212898112889723622.t-ishii@sranhm.sra.co.jp обсуждение исходный текст |
| Ответ на | Re: make_ctags: use -I option to ignore pg_node_attr macro (Yugo NAGATA <nagata@sraoss.co.jp>) |
| Ответы |
Re: make_ctags: use -I option to ignore pg_node_attr macro
|
| Список | pgsql-hackers |
> Does is make sense to change make_etags as the attached patch does?
> This allows make_etags to use etags if Exuberant-type ctags is not
> available. This allows users to use make_etags if hey has either
> Exuberant-type ctags or etags.
The patch drops support for "-n" option :-<
Attached is the patch by fixing make_ctags (make_etags is not
touched).
If Exuberant-type ctags is available, use it (not changed).
If Exuberant-type ctags is not available, try old ctags (not changed).
If the old ctags does not support "-e" option, try etags (new).
If etags is not available, give up (new).
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 102881667b..8fb9991db0 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -12,12 +12,15 @@ fi
MODE=
NO_SYMLINK=
TAGS_FILE="tags"
+ETAGS_EXISTS=
+PROG=ctags
while [ $# -gt 0 ]
do
if [ $1 = "-e" ]
then MODE="-e"
TAGS_FILE="TAGS"
+ command -v etags >/dev/null && ETAGS_EXISTS="Y"
elif [ $1 = "-n" ]
then NO_SYMLINK="Y"
else
@@ -27,8 +30,10 @@ do
shift
done
-command -v ctags >/dev/null || \
+if test -z "$MODE"
+then (command -v ctags >/dev/null) || \
{ echo "'ctags' program not found" 1>&2; exit 1; }
+fi
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
rm -f ./$TAGS_FILE
@@ -36,6 +41,20 @@ rm -f ./$TAGS_FILE
IS_EXUBERANT=""
ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
+if test -z "$IS_EXUBERANT"
+then
+ if test -n "$MODE"
+ then ctags --version 2>&1 | grep -- -e >/dev/null
+ if [ $? != 0 ]
+ then
+ if [ -z $ETAGS_EXISTS ]
+ then echo "'ctags' does not support emacs mode and etags does not exist" 1>&2; exit 1
+ else PROG=etags
+ fi
+ fi
+ fi
+fi
+
# List of kinds supported by Exuberant Ctags 5.8
# generated by ctags --list-kinds
# --c-kinds was called --c-types before 2003
@@ -65,11 +84,16 @@ then IGNORE_IDENTIFIES="-I pg_node_attr+"
else IGNORE_IDENTIFIES=
fi
+if [ $PROG = "ctags" ]
+then TAGS_OPT="-a -f"
+else TAGS_OPT="-a -o"
+fi
+
# this is outputting the tags into the file 'tags', and appending
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"
+ xargs $PROG $MODE $TAGS_OPT $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
В списке pgsql-hackers по дате отправления: