public inbox for [email protected]  
help / color / mirror / Atom feed
Backpatching make_ctags -e and -n to v15 and v14
3+ messages / 2 participants
[nested] [flat]

* Backpatching make_ctags -e and -n to v15 and v14
@ 2026-04-09 02:10 Michael Paquier <[email protected]>
  2026-04-09 02:42 ` Re: Backpatching make_ctags -e and -n to v15 and v14 Julien Rouhaud <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2026-04-09 02:10 UTC (permalink / raw)
  To: Postgres hackers <[email protected]>

Hi all,

While doing some work on back branches lately, I have been annoyed by
the fact that the improvements done in make_ctags as of d1e2a380cb91
are not available in REL_14_STABLE and REL_15_STABLE.  I don't really
use the -n mode, but the emacs mode covered by -e has been a
time-saver for some time now, and it's sad to have only that available
in v16~.

Would there by any objections in backpatching the attached down to v14
and v15?  This includes d1e2a380cb91, 87f21d2c6890 and ae66716bf3ef.

Opinions or comments?
--
Michael

From 94f85759a81572b17132085754d39498ce04564d Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <[email protected]>
Date: Wed, 19 Oct 2022 12:59:29 +0900
Subject: [PATCH] Enhance make_ctags and make_etags.

make_ctags did not include field members of structs since the commit
964d01ae90c314eb31132c2e7712d5d9fc237331.

For example, in the following field of RestrictInfo:

   Selectivity norm_selec pg_node_attr(equal_ignore);

pg_node_attr was mistakenly interpreted to be the name of the field.
To fix this, add -I option to ctags command if the command is
Exuberant ctags or Universal ctags (for plain old ctags, struct
members are not included in the tags file anyway).

Also add "-e" and "-n" options to make_ctags. The -e option invokes
ctags command with -e option, which produces TAGS file for emacs. This
allows to eliminate duplicate codes in make_etags so that make_etags
just exec make_ctags with -e option.

The -n option allows not to produce symbolic links in each
sub directory (the default is producing symbolic links).

This includes some follow-up fixes: 87f21d2c6890 and ae66716bf3ef.

Author: Yugo Nagata
Reviewers: Alvaro Herrera, Tatsuo Ishii
Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528a%40sraoss.co.jp
---
 src/tools/make_ctags | 80 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 14 deletions(-)

diff --git a/src/tools/make_ctags b/src/tools/make_ctags
index 9e952ce916f2..ad027c71e3dd 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -1,16 +1,54 @@
 #!/bin/sh
 
-# src/tools/make_ctags
+# src/tools/make_ctags [-e] [-n]
+# If -e is specified, generate tags files for emacs.
+# If -n is specified, don't create symbolic links of tags file.
+usage="Usage:  $0 [-e][-n]"
+if [ $# -gt 2 ]
+then	echo $usage
+	exit 1
+fi
 
-command -v ctags >/dev/null || \
+EMACS_MODE=
+NO_SYMLINK=
+IS_EXUBERANT=
+PROG="ctags"
+TAGS_OPT="-a -f"
+TAGS_FILE="tags"
+FLAGS=
+IGNORE_IDENTIFIES=
+
+while [ $# -gt 0 ]
+do
+	if [ $1 = "-e" ]
+	then	EMACS_MODE="Y"
+	elif [ $1 = "-n" ]
+	then	NO_SYMLINK="Y"
+	else
+		echo $usage
+		exit 1
+	fi
+	shift
+done
+
+if [ ! "$EMACS_MODE" ]
+then	(command -v ctags >/dev/null) || \
 	{ echo "'ctags' program not found" 1>&2; exit 1; }
+fi
 
-trap "rm -f /tmp/$$" 0 1 2 3 15
-rm -f ./tags
-
-IS_EXUBERANT=""
 ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
+if [ "$EMACS_MODE" ]
+then	TAGS_FILE="TAGS"
+	if [ "$IS_EXUBERANT" ]
+	then PROG="ctags -e"
+	else	(command -v etags >/dev/null) || \
+		{ echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; exit 1; }
+		PROG="etags"
+		TAGS_OPT="-a -o"
+	fi
+fi
+
 # List of kinds supported by Exuberant Ctags 5.8
 # generated by ctags --list-kinds
 # --c-kinds was called --c-types before 2003
@@ -31,12 +69,23 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
 if [ "$IS_EXUBERANT" ]
 then	FLAGS="--c-kinds=+dfmstuv"
-else	FLAGS="-dt"
+elif [ ! "$EMACS_MODE" ]
+then	FLAGS="-dt"
 fi
 
+# Use -I option to ignore a macro
+if [ "$IS_EXUBERANT" ]
+then	IGNORE_IDENTIFIES="-I pg_node_attr+"
+fi
+
+trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
+rm -f ./$TAGS_FILE
+
 # 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 $PROG $TAGS_OPT $TAGS_FILE $FLAGS $IGNORE_IDENTIFIES
 
 # Sorting non-Exuberant ctags file allows for fast searching of the tags file.
 # Since etags file has a header that we cannot sort in with the other entries
@@ -44,10 +93,13 @@ find `pwd`/ -type f -name '*.[chyl]' -print |
 if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ]
 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
-done
+# create symbolic links
+if [ ! "$NO_SYMLINK" ]
+then    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_FILE "$DIR"/$TAGS_FILE
+	done
+fi
-- 
2.53.0


From 3a00b4cd2a6b0b4ac090fca9563dbff4cc5098ff Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <[email protected]>
Date: Wed, 19 Oct 2022 12:59:29 +0900
Subject: [PATCH] Enhance make_ctags and make_etags.

make_ctags did not include field members of structs since the commit
964d01ae90c314eb31132c2e7712d5d9fc237331.

For example, in the following field of RestrictInfo:

   Selectivity norm_selec pg_node_attr(equal_ignore);

pg_node_attr was mistakenly interpreted to be the name of the field.
To fix this, add -I option to ctags command if the command is
Exuberant ctags or Universal ctags (for plain old ctags, struct
members are not included in the tags file anyway).

Also add "-e" and "-n" options to make_ctags. The -e option invokes
ctags command with -e option, which produces TAGS file for emacs. This
allows to eliminate duplicate codes in make_etags so that make_etags
just exec make_ctags with -e option.

The -n option allows not to produce symbolic links in each
sub directory (the default is producing symbolic links).

This includes some follow-up fixes: 87f21d2c6890 and ae66716bf3ef.

Author: Yugo Nagata
Reviewers: Alvaro Herrera, Tatsuo Ishii
Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528a%40sraoss.co.jp
---
 src/tools/make_ctags | 89 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 70 insertions(+), 19 deletions(-)

diff --git a/src/tools/make_ctags b/src/tools/make_ctags
index d8d18d1569f9..ad027c71e3dd 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -1,16 +1,54 @@
 #!/bin/sh
 
-# src/tools/make_ctags
+# src/tools/make_ctags [-e] [-n]
+# If -e is specified, generate tags files for emacs.
+# If -n is specified, don't create symbolic links of tags file.
+usage="Usage:  $0 [-e][-n]"
+if [ $# -gt 2 ]
+then	echo $usage
+	exit 1
+fi
 
-command -v ctags >/dev/null || \
+EMACS_MODE=
+NO_SYMLINK=
+IS_EXUBERANT=
+PROG="ctags"
+TAGS_OPT="-a -f"
+TAGS_FILE="tags"
+FLAGS=
+IGNORE_IDENTIFIES=
+
+while [ $# -gt 0 ]
+do
+	if [ $1 = "-e" ]
+	then	EMACS_MODE="Y"
+	elif [ $1 = "-n" ]
+	then	NO_SYMLINK="Y"
+	else
+		echo $usage
+		exit 1
+	fi
+	shift
+done
+
+if [ ! "$EMACS_MODE" ]
+then	(command -v ctags >/dev/null) || \
 	{ echo "'ctags' program not found" 1>&2; exit 1; }
+fi
 
-trap "rm -f /tmp/$$" 0 1 2 3 15
-rm -f ./tags
-
-IS_EXUBERANT=""
 ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
+if [ "$EMACS_MODE" ]
+then	TAGS_FILE="TAGS"
+	if [ "$IS_EXUBERANT" ]
+	then PROG="ctags -e"
+	else	(command -v etags >/dev/null) || \
+		{ echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; exit 1; }
+		PROG="etags"
+		TAGS_OPT="-a -o"
+	fi
+fi
+
 # List of kinds supported by Exuberant Ctags 5.8
 # generated by ctags --list-kinds
 # --c-kinds was called --c-types before 2003
@@ -31,24 +69,37 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
 if [ "$IS_EXUBERANT" ]
 then	FLAGS="--c-kinds=+dfmstuv"
-else	FLAGS="-dt"
+elif [ ! "$EMACS_MODE" ]
+then	FLAGS="-dt"
 fi
 
+# Use -I option to ignore a macro
+if [ "$IS_EXUBERANT" ]
+then	IGNORE_IDENTIFIES="-I pg_node_attr+"
+fi
+
+trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
+rm -f ./$TAGS_FILE
+
 # 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 $PROG $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
-# Why are we sorting this?  I guess some tag implementation need this,
-# particularly for append mode.  bjm 2012-02-24
-if [ ! "$IS_EXUBERANT" ]
+# Sorting non-Exuberant ctags file allows for fast searching of the tags file.
+# Since etags file has a header that we cannot sort in with the other entries
+# we skip the sort step.
+if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ]
 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
-done
+# create symbolic links
+if [ ! "$NO_SYMLINK" ]
+then    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_FILE "$DIR"/$TAGS_FILE
+	done
+fi
-- 
2.53.0



Attachments:

  [text/plain] 0001-Enhance-make_ctags-and-make_etags-v15.patch (4.4K, 2-0001-Enhance-make_ctags-and-make_etags-v15.patch)
  download | inline diff:
From 94f85759a81572b17132085754d39498ce04564d Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <[email protected]>
Date: Wed, 19 Oct 2022 12:59:29 +0900
Subject: [PATCH] Enhance make_ctags and make_etags.

make_ctags did not include field members of structs since the commit
964d01ae90c314eb31132c2e7712d5d9fc237331.

For example, in the following field of RestrictInfo:

   Selectivity norm_selec pg_node_attr(equal_ignore);

pg_node_attr was mistakenly interpreted to be the name of the field.
To fix this, add -I option to ctags command if the command is
Exuberant ctags or Universal ctags (for plain old ctags, struct
members are not included in the tags file anyway).

Also add "-e" and "-n" options to make_ctags. The -e option invokes
ctags command with -e option, which produces TAGS file for emacs. This
allows to eliminate duplicate codes in make_etags so that make_etags
just exec make_ctags with -e option.

The -n option allows not to produce symbolic links in each
sub directory (the default is producing symbolic links).

This includes some follow-up fixes: 87f21d2c6890 and ae66716bf3ef.

Author: Yugo Nagata
Reviewers: Alvaro Herrera, Tatsuo Ishii
Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528a%40sraoss.co.jp
---
 src/tools/make_ctags | 80 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 14 deletions(-)

diff --git a/src/tools/make_ctags b/src/tools/make_ctags
index 9e952ce916f2..ad027c71e3dd 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -1,16 +1,54 @@
 #!/bin/sh
 
-# src/tools/make_ctags
+# src/tools/make_ctags [-e] [-n]
+# If -e is specified, generate tags files for emacs.
+# If -n is specified, don't create symbolic links of tags file.
+usage="Usage:  $0 [-e][-n]"
+if [ $# -gt 2 ]
+then	echo $usage
+	exit 1
+fi
 
-command -v ctags >/dev/null || \
+EMACS_MODE=
+NO_SYMLINK=
+IS_EXUBERANT=
+PROG="ctags"
+TAGS_OPT="-a -f"
+TAGS_FILE="tags"
+FLAGS=
+IGNORE_IDENTIFIES=
+
+while [ $# -gt 0 ]
+do
+	if [ $1 = "-e" ]
+	then	EMACS_MODE="Y"
+	elif [ $1 = "-n" ]
+	then	NO_SYMLINK="Y"
+	else
+		echo $usage
+		exit 1
+	fi
+	shift
+done
+
+if [ ! "$EMACS_MODE" ]
+then	(command -v ctags >/dev/null) || \
 	{ echo "'ctags' program not found" 1>&2; exit 1; }
+fi
 
-trap "rm -f /tmp/$$" 0 1 2 3 15
-rm -f ./tags
-
-IS_EXUBERANT=""
 ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
+if [ "$EMACS_MODE" ]
+then	TAGS_FILE="TAGS"
+	if [ "$IS_EXUBERANT" ]
+	then PROG="ctags -e"
+	else	(command -v etags >/dev/null) || \
+		{ echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; exit 1; }
+		PROG="etags"
+		TAGS_OPT="-a -o"
+	fi
+fi
+
 # List of kinds supported by Exuberant Ctags 5.8
 # generated by ctags --list-kinds
 # --c-kinds was called --c-types before 2003
@@ -31,12 +69,23 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
 if [ "$IS_EXUBERANT" ]
 then	FLAGS="--c-kinds=+dfmstuv"
-else	FLAGS="-dt"
+elif [ ! "$EMACS_MODE" ]
+then	FLAGS="-dt"
 fi
 
+# Use -I option to ignore a macro
+if [ "$IS_EXUBERANT" ]
+then	IGNORE_IDENTIFIES="-I pg_node_attr+"
+fi
+
+trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
+rm -f ./$TAGS_FILE
+
 # 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 $PROG $TAGS_OPT $TAGS_FILE $FLAGS $IGNORE_IDENTIFIES
 
 # Sorting non-Exuberant ctags file allows for fast searching of the tags file.
 # Since etags file has a header that we cannot sort in with the other entries
@@ -44,10 +93,13 @@ find `pwd`/ -type f -name '*.[chyl]' -print |
 if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ]
 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
-done
+# create symbolic links
+if [ ! "$NO_SYMLINK" ]
+then    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_FILE "$DIR"/$TAGS_FILE
+	done
+fi
-- 
2.53.0



  [text/plain] 0001-Enhance-make_ctags-and-make_etags-v14.patch (4.6K, 3-0001-Enhance-make_ctags-and-make_etags-v14.patch)
  download | inline diff:
From 3a00b4cd2a6b0b4ac090fca9563dbff4cc5098ff Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <[email protected]>
Date: Wed, 19 Oct 2022 12:59:29 +0900
Subject: [PATCH] Enhance make_ctags and make_etags.

make_ctags did not include field members of structs since the commit
964d01ae90c314eb31132c2e7712d5d9fc237331.

For example, in the following field of RestrictInfo:

   Selectivity norm_selec pg_node_attr(equal_ignore);

pg_node_attr was mistakenly interpreted to be the name of the field.
To fix this, add -I option to ctags command if the command is
Exuberant ctags or Universal ctags (for plain old ctags, struct
members are not included in the tags file anyway).

Also add "-e" and "-n" options to make_ctags. The -e option invokes
ctags command with -e option, which produces TAGS file for emacs. This
allows to eliminate duplicate codes in make_etags so that make_etags
just exec make_ctags with -e option.

The -n option allows not to produce symbolic links in each
sub directory (the default is producing symbolic links).

This includes some follow-up fixes: 87f21d2c6890 and ae66716bf3ef.

Author: Yugo Nagata
Reviewers: Alvaro Herrera, Tatsuo Ishii
Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528a%40sraoss.co.jp
---
 src/tools/make_ctags | 89 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 70 insertions(+), 19 deletions(-)

diff --git a/src/tools/make_ctags b/src/tools/make_ctags
index d8d18d1569f9..ad027c71e3dd 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -1,16 +1,54 @@
 #!/bin/sh
 
-# src/tools/make_ctags
+# src/tools/make_ctags [-e] [-n]
+# If -e is specified, generate tags files for emacs.
+# If -n is specified, don't create symbolic links of tags file.
+usage="Usage:  $0 [-e][-n]"
+if [ $# -gt 2 ]
+then	echo $usage
+	exit 1
+fi
 
-command -v ctags >/dev/null || \
+EMACS_MODE=
+NO_SYMLINK=
+IS_EXUBERANT=
+PROG="ctags"
+TAGS_OPT="-a -f"
+TAGS_FILE="tags"
+FLAGS=
+IGNORE_IDENTIFIES=
+
+while [ $# -gt 0 ]
+do
+	if [ $1 = "-e" ]
+	then	EMACS_MODE="Y"
+	elif [ $1 = "-n" ]
+	then	NO_SYMLINK="Y"
+	else
+		echo $usage
+		exit 1
+	fi
+	shift
+done
+
+if [ ! "$EMACS_MODE" ]
+then	(command -v ctags >/dev/null) || \
 	{ echo "'ctags' program not found" 1>&2; exit 1; }
+fi
 
-trap "rm -f /tmp/$$" 0 1 2 3 15
-rm -f ./tags
-
-IS_EXUBERANT=""
 ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
+if [ "$EMACS_MODE" ]
+then	TAGS_FILE="TAGS"
+	if [ "$IS_EXUBERANT" ]
+	then PROG="ctags -e"
+	else	(command -v etags >/dev/null) || \
+		{ echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; exit 1; }
+		PROG="etags"
+		TAGS_OPT="-a -o"
+	fi
+fi
+
 # List of kinds supported by Exuberant Ctags 5.8
 # generated by ctags --list-kinds
 # --c-kinds was called --c-types before 2003
@@ -31,24 +69,37 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
 
 if [ "$IS_EXUBERANT" ]
 then	FLAGS="--c-kinds=+dfmstuv"
-else	FLAGS="-dt"
+elif [ ! "$EMACS_MODE" ]
+then	FLAGS="-dt"
 fi
 
+# Use -I option to ignore a macro
+if [ "$IS_EXUBERANT" ]
+then	IGNORE_IDENTIFIES="-I pg_node_attr+"
+fi
+
+trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
+rm -f ./$TAGS_FILE
+
 # 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 $PROG $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
-# Why are we sorting this?  I guess some tag implementation need this,
-# particularly for append mode.  bjm 2012-02-24
-if [ ! "$IS_EXUBERANT" ]
+# Sorting non-Exuberant ctags file allows for fast searching of the tags file.
+# Since etags file has a header that we cannot sort in with the other entries
+# we skip the sort step.
+if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ]
 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
-done
+# create symbolic links
+if [ ! "$NO_SYMLINK" ]
+then    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_FILE "$DIR"/$TAGS_FILE
+	done
+fi
-- 
2.53.0



  [application/pgp-signature] signature.asc (833B, 4-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Backpatching make_ctags -e and -n to v15 and v14
  2026-04-09 02:10 Backpatching make_ctags -e and -n to v15 and v14 Michael Paquier <[email protected]>
@ 2026-04-09 02:42 ` Julien Rouhaud <[email protected]>
  2026-04-09 23:03   ` Re: Backpatching make_ctags -e and -n to v15 and v14 Michael Paquier <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Julien Rouhaud @ 2026-04-09 02:42 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: Postgres hackers <[email protected]>

Hi,

On Thu, Apr 09, 2026 at 11:10:55AM +0900, Michael Paquier wrote:
>
> While doing some work on back branches lately, I have been annoyed by
> the fact that the improvements done in make_ctags as of d1e2a380cb91
> are not available in REL_14_STABLE and REL_15_STABLE.  I don't really
> use the -n mode, but the emacs mode covered by -e has been a
> time-saver for some time now, and it's sad to have only that available
> in v16~.

Oh I missed the addition of the -n mode.

Honestly the creation of the symlinks in all the subdirectories is the main
reason why I never used the make_ctags script (and just used some local stuff
instead), so since I now know that I can use it strong +1 to backporting that
commit to v14 and v15.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Backpatching make_ctags -e and -n to v15 and v14
  2026-04-09 02:10 Backpatching make_ctags -e and -n to v15 and v14 Michael Paquier <[email protected]>
  2026-04-09 02:42 ` Re: Backpatching make_ctags -e and -n to v15 and v14 Julien Rouhaud <[email protected]>
@ 2026-04-09 23:03   ` Michael Paquier <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2026-04-09 23:03 UTC (permalink / raw)
  To: Julien Rouhaud <[email protected]>; +Cc: Postgres hackers <[email protected]>

On Thu, Apr 09, 2026 at 10:42:55AM +0800, Julien Rouhaud wrote:
> Oh I missed the addition of the -n mode.

I have switched my stuff to use -n just a few hours ago with a trick
to tell emacs to look at the root of a git folder if we are in a git
repo for the location of a TAGS file:
(setq tags-table-list nil)
(defun my/set-tags-table-to-git-root ()
  "Set TAGS file path to the root of the current git repository."
  (let ((git-root (string-trim-right
                   (shell-command-to-string "git rev-parse --show-toplevel"))))
    (when (and git-root (not (string-match-p "fatal" git-root)))
      (setq tags-file-name (expand-file-name "TAGS" git-root)))))
(add-hook 'find-file-hook #'my/set-tags-table-to-git-root)

Perhaps there is a smarter way to set that, no idea.  This works quite
nicely for me.

> Honestly the creation of the symlinks in all the subdirectories is the main
> reason why I never used the make_ctags script (and just used some local stuff
> instead), so since I now know that I can use it strong +1 to backporting that
> commit to v14 and v15.

Thanks.  This is going to save time for the two of us, at least, so
done :)
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-04-09 23:03 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-09 02:10 Backpatching make_ctags -e and -n to v15 and v14 Michael Paquier <[email protected]>
2026-04-09 02:42 ` Julien Rouhaud <[email protected]>
2026-04-09 23:03   ` Michael Paquier <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox