public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] eselect r390 - in trunk: man modules
@ 2008-09-22 13:56 Ulrich Mueller (ulm)
  0 siblings, 0 replies; only message in thread
From: Ulrich Mueller (ulm) @ 2008-09-22 13:56 UTC (permalink / raw
  To: gentoo-commits

Author: ulm
Date: 2008-09-22 13:56:37 +0000 (Mon, 22 Sep 2008)
New Revision: 390

Modified:
   trunk/man/ctags.eselect.5
   trunk/man/emacs.eselect.5
   trunk/modules/ctags.eselect
   trunk/modules/emacs.eselect
Log:
Sync from current stable eselect-emacs-1.5 version.

Modified: trunk/man/ctags.eselect.5
===================================================================
--- trunk/man/ctags.eselect.5	2008-06-01 17:54:27 UTC (rev 389)
+++ trunk/man/ctags.eselect.5	2008-09-22 13:56:37 UTC (rev 390)
@@ -1,10 +1,11 @@
-.\" Copyright 1999-2007 Gentoo Foundation
+.\" Copyright 1999-2008 Gentoo Foundation
 .\" Distributed under the terms of the GNU General Public License v2
 .\" $Id$
 .\"
-.TH "ESELECT" "5" "August 2007" "Gentoo Linux" "eselect"
+.TH "ESELECT" "5" "May 2008" "Gentoo Linux" "eselect"
 .SH "NAME"
-ctags.eselect \- The ctags management module for Gentoo's eselect
+ctags.eselect, etags.eselect \- The ctags and etags management module
+for Gentoo's eselect
 .SH "SYNOPSIS"
 \fBeselect ctags\fR [\fBhelp\fR|\fBusage\fR]
 .br
@@ -18,6 +19,9 @@
 .SH "DESCRIPTION"
 \fBeselect\fR is Gentoo's configuration and management tool. It features
 modules that care for the individual administrative tasks.
+
+The \fBctags\fR and \fBetags\fR eselect modules share a common syntax,
+therefore this man page collectively refers to them as \fBctags\fR.
 .SH "ACTION: LIST"
 \fBeselect ctags list\fR
 .br
@@ -38,7 +42,7 @@
 
 # eselect ctags set 2
 .br
-Switching to exuberant-ctags ...
+Switching ctags to exuberant-ctags ...
 .SH "ACTION: SHOW"
 \fBeselect ctags show\fR
 .br
@@ -58,10 +62,16 @@
 
 # eselect ctags update
 .br
-Switching to exuberant-ctags ...
+Switching ctags to exuberant-ctags ...
+.br
+Switching etags to etags-emacs-22 ...
 .SH "BUGS"
 Under FreeBSD, \fBeselect ctags\fR does not work since \fBctags\fR is
-a real binary (owned by package freebsd-ubin).
+a real binary, owned by package freebsd-ubin. (\fBeselect etags\fR
+does work though.)
+
+\fBeselect etags\fR does not display any valid targets if there is no
+Emacs variant installed. This is a feature.
 .SH "AUTHOR"
 Ulrich Mueller <ulm@gentoo.org>
 .SH "SEE ALSO"

Modified: trunk/man/emacs.eselect.5
===================================================================
--- trunk/man/emacs.eselect.5	2008-06-01 17:54:27 UTC (rev 389)
+++ trunk/man/emacs.eselect.5	2008-09-22 13:56:37 UTC (rev 390)
@@ -1,8 +1,8 @@
-.\" Copyright 1999-2007 Gentoo Foundation
+.\" Copyright 1999-2008 Gentoo Foundation
 .\" Distributed under the terms of the GNU General Public License v2
 .\" $Id$
 .\"
-.TH "ESELECT" "5" "August 2007" "Gentoo Linux" "eselect"
+.TH "ESELECT" "5" "May 2008" "Gentoo Linux" "eselect"
 .SH "NAME"
 emacs.eselect \- The Emacs management module for Gentoo's eselect
 .SH "SYNOPSIS"
@@ -40,9 +40,11 @@
 
 # eselect emacs set 3
 .br
-Switching to emacs-22 ...
+Switching emacs to emacs-22 ...
 .br
-Switching to ctags-emacs-22 ...
+Switching ctags to ctags-emacs-22 ...
+.br
+Switching etags to etags-emacs-22 ...
 .SH "ACTION: SHOW"
 \fBeselect emacs show\fR
 .br
@@ -62,10 +64,11 @@
 
 # eselect emacs update
 .br
-Switching to emacs-22 ...
+Switching emacs to emacs-22 ...
 .br
-Switching to ctags-emacs-22 ...
-
+Switching ctags to ctags-emacs-22 ...
+.br
+Switching etags to etags-emacs-22 ...
 .SH "AUTHORS"
 Christian Faulhammer <opfer@gentoo.org>
 .br

Modified: trunk/modules/ctags.eselect
===================================================================
--- trunk/modules/ctags.eselect	2008-06-01 17:54:27 UTC (rev 389)
+++ trunk/modules/ctags.eselect	2008-09-22 13:56:37 UTC (rev 390)
@@ -1,4 +1,4 @@
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2008 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 #
@@ -19,7 +19,11 @@
 # do_set(): Set a version to be target of the symlink.
 # do_update(): Set the target to the "best" available version. See below.
 
-DESCRIPTION="Manage /usr/bin/ctags implementations"
+# This module is used for ctags and etags
+#CTAGS=$(basename ${BASH_SOURCE%.*})
+CTAGS=ctags
+
+DESCRIPTION="Manage /usr/bin/${CTAGS} implementations"
 MAINTAINER="emacs@gentoo.org"
 SVN_DATE='$Date$'
 VERSION=$(svn_date_to_version "${SVN_DATE}" )
@@ -34,9 +38,15 @@
 	if [[ -L "${ROOT}/usr/bin/emacs" && \
 		  -e $(canonicalise "${ROOT}/usr/bin/emacs") ]]; then
 		emacs=$(basename $(canonicalise "${ROOT}/usr/bin/emacs") )
-		[[ -f "${ROOT}/usr/bin/ctags-${emacs}" ]] && echo "ctags-${emacs}"
+		[[ -f "${ROOT}/usr/bin/${CTAGS}-${emacs}" ]] && echo ${CTAGS}-${emacs}
 	elif [[ -f "${ROOT}/usr/bin/xemacs" ]]; then
-		[[ -f "${ROOT}/usr/bin/ctags-xemacs" ]] && echo ctags-xemacs
+		[[ -f "${ROOT}/usr/bin/${CTAGS}-xemacs" ]] && echo ${CTAGS}-xemacs
+	elif [[ ${CTAGS} == etags ]]; then
+		# We are called as etags module, but no (X)Emacs is installed.
+		# Return an empty list in this case, because we don't want
+		# exuberant-ctags as default for etags (for ctags it's fine).
+		# Also, vi purists wouldn't want an etags symlink.
+		return
 	fi
 
 	# Exuberant ctags
@@ -45,15 +55,15 @@
 
 remove_symlinks() {
 	# Remove existing symlinks to binary and man page
-	rm -f "${ROOT}"/usr/bin/ctags
-	rm -f "${ROOT}"/usr/share/man/man1/ctags.1*
+	rm -f "${ROOT}"/usr/bin/${CTAGS}
+	rm -f "${ROOT}"/usr/share/man/man1/${CTAGS}.1*
 }
 
 set_bin_symlinks() {
 	# Set symlink to binary
 	local target=${1}
-	ln -s "${target}" "${ROOT}/usr/bin/ctags" \
-		|| die "Couldn't set ${target} ${ROOT}/usr/bin/ctags symlink"
+	ln -s "${target}" "${ROOT}/usr/bin/${CTAGS}" \
+		|| die "Couldn't set ${target} ${ROOT}/usr/bin/${CTAGS} symlink"
 }
 
 set_man_symlinks() {
@@ -64,7 +74,7 @@
 			# target file exists; determine compress extension
 			extension=${i##*/${target}.1}
 			ln -s "${target}.1${extension}" \
-				"${ROOT}/usr/share/man/man1/ctags.1${extension}"
+				"${ROOT}/usr/share/man/man1/${CTAGS}.1${extension}"
 		fi
 	done
 }
@@ -85,7 +95,7 @@
 	[[ -f "${ROOT}/usr/bin/${target}" ]] \
 		|| die -q "Target \"${1}\" doesn't appear to be valid!"
 
-	echo "Switching to ${target} ..."
+	echo "Switching ${CTAGS} to ${target} ..."
 	remove_symlinks || die -q "Couldn't remove existing symlink"
 	set_bin_symlinks "${target}"
 	set_man_symlinks "${target}"
@@ -100,18 +110,18 @@
 ### show action ###
 
 describe_show() {
-	echo "Show the current target of the ctags symlink"
+	echo "Show the current target of the ${CTAGS} symlink"
 }
 
 do_show() {
 	[[ ${#@} -gt 0 ]] && die -q "Too many parameters"
 
-	write_list_start "Current target of ctags symlink:"
-	if [[ -L "${ROOT}/usr/bin/ctags" && \
-		  -e $(canonicalise "${ROOT}/usr/bin/ctags") ]]; then
+	write_list_start "Current target of ${CTAGS} symlink:"
+	if [[ -L "${ROOT}/usr/bin/${CTAGS}" && \
+		  -e $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ]]; then
 		write_kv_list_entry \
-			$(basename $(canonicalise "${ROOT}/usr/bin/ctags") ) ""
-	elif [[ -e "${ROOT}/usr/bin/ctags" ]]; then
+			$(basename $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ) ""
+	elif [[ -e "${ROOT}/usr/bin/${CTAGS}" ]]; then
 		write_kv_list_entry \
 			"(not a symlink or target of symlink does not exist)" ""
 	else
@@ -122,7 +132,7 @@
 ### list action ###
 
 describe_list() {
-	echo "List available ctags symlink targets"
+	echo "List available ${CTAGS} symlink targets"
 }
 
 do_list() {
@@ -135,10 +145,10 @@
 		for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do
 			# Display a star to indicate the currently chosen version
 			[[ ${targets[${i}]} = \
-				$(basename $(canonicalise "${ROOT}/usr/bin/ctags") ) ]] \
+				$(basename $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ) ]] \
 				&& targets[${i}]="${targets[${i}]} $(highlight '*')"
 		done
-		write_list_start "Available ctags symlink targets:"
+		write_list_start "Available ${CTAGS} symlink targets:"
 		write_numbered_list "${targets[@]}"
 	else
 		write_kv_list_entry "(none found)" ""
@@ -148,7 +158,7 @@
 ### set action ###
 
 describe_set() {
-	echo "Set a new ctags symlink"
+	echo "Set a new ${CTAGS} symlink"
 }
 
 describe_set_options() {
@@ -164,13 +174,9 @@
 	[[ ${#@} -gt 1 ]] && die -q "Too many parameters"
 	test_for_root
 
-	if [[ -e "${ROOT}/usr/bin/ctags" && ! -L "${ROOT}/usr/bin/ctags" ]]; then
-		if [[ -f "${ROOT}/usr/bin/ctags" && $(uname) == FreeBSD ]]; then
-			# On FreeBSD ctags is a real file, installed by freebsd-ubin
-			echo "${ROOT}/usr/bin/ctags is a real file - no action"
-			return
-		fi
-		die -q "Sorry, ${ROOT}/usr/bin/ctags exists but is not a symlink"
+	if [[ -e "${ROOT}/usr/bin/${CTAGS}" && ! -L "${ROOT}/usr/bin/${CTAGS}" ]]
+	then
+		die -q "Sorry, ${ROOT}/usr/bin/${CTAGS} exists but is not a symlink"
 	fi
 
 	set_symlinks "${1}" || die -q "Couldn't set a new symlink"
@@ -179,26 +185,27 @@
 ### update action ###
 
 describe_update() {
-	echo "Automatically update the ctags symlink"
+	echo "Automatically update the ${CTAGS} symlink"
 }
 
 do_update() {
-	[[ ${#@} -gt 0 ]] && die -q "Too many parameters"
+	[[ -z "${1}" || "${1}" == norecursion ]] || die -q "Usage error"
+	[[ ${#@} -gt 1 ]] && die -q "Too many parameters"
 	test_for_root
 
-	local ctags=""
-	if [[ -L "${ROOT}/usr/bin/ctags" ]]; then
-		ctags=$(basename $(canonicalise "${ROOT}/usr/bin/ctags") )
-		if [[ ! -e $(canonicalise "${ROOT}/usr/bin/ctags") ]]; then
+	local current=""
+	if [[ -L "${ROOT}/usr/bin/${CTAGS}" ]]; then
+		current=$(basename $(canonicalise "${ROOT}/usr/bin/${CTAGS}") )
+		if [[ ! -e $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ]]; then
 			# clean up dead symlinks
 			remove_symlinks || die -q "Couldn't remove existing symlink"
 		fi
-	elif [[ -e "${ROOT}/usr/bin/ctags" ]]; then
-		if [[ -f "${ROOT}/usr/bin/ctags" && $(uname) == FreeBSD ]]; then
-			# On FreeBSD ctags is a real file, installed by freebsd-ubin
-			return
+	elif [[ -e "${ROOT}/usr/bin/${CTAGS}" ]]; then
+		if ! [[ ${CTAGS} == ctags && $(uname) == FreeBSD ]]; then
+			die -q "Sorry, ${ROOT}/usr/bin/${CTAGS} exists but is not a symlink"
 		fi
-		die -q "Sorry, ${ROOT}/usr/bin/ctags exists but is not a symlink"
+		# On FreeBSD ctags is a real file, installed by freebsd-ubin
+		current=nolink
 	fi
 
 	# For an "update" only the version should be changed, but not the
@@ -206,12 +213,19 @@
 	# offers several concurrent versions.
 
 	local i target targets=( $(find_targets) )
-	if [[ ${#targets[@]} -gt 0 ]]; then
+	if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then
 		target=${targets[0]}
-		[[ "${ctags}" == ctags-*emacs* ]] && ctags="ctags-*emacs*"
+		[[ "${current}" == ${CTAGS}-*emacs* ]] && current="${CTAGS}-*emacs*"
 		for i in ${targets[@]}; do
-			[[ "${i}" == "${ctags}" ]] && target="${i}"
+			[[ "${i}" == "${current}" ]] && target="${i}"
 		done
 		set_symlinks "${target}" || die -q "Couldn't set a new symlink"
 	fi
+
+	# Call "eselect etags update" from the ctags module and vice versa
+	[[ "${1}" == norecursion ]] && return
+	case ${CTAGS} in
+		ctags) CTAGS=etags do_update norecursion ;;
+		etags) CTAGS=ctags do_update norecursion ;;
+	esac
 }

Modified: trunk/modules/emacs.eselect
===================================================================
--- trunk/modules/emacs.eselect	2008-06-01 17:54:27 UTC (rev 389)
+++ trunk/modules/emacs.eselect	2008-09-22 13:56:37 UTC (rev 390)
@@ -25,9 +25,9 @@
 SVN_DATE='$Date$'
 VERSION=$(svn_date_to_version "${SVN_DATE}" )
 
-# ctags is handled in an own module now
-BINARYLIST="emacsclient etags b2m ebrowse rcs-checkin grep-changelog"
-MANPAGELIST="emacs emacsclient etags gfdl"
+# ctags and etags are handled in their own module
+BINARYLIST="emacsclient b2m ebrowse rcs-checkin grep-changelog"
+MANPAGELIST="emacs emacsclient gfdl"
 
 find_targets() {
 	# Return the list of available Emacs binaries
@@ -105,7 +105,7 @@
 	[[ -f "${ROOT}/usr/bin/${target}" ]] \
 		|| die -q "Target \"${1}\" doesn't appear to be valid!"
 
-	echo "Switching to ${target} ..."
+	echo "Switching emacs to ${target} ..."
 	remove_symlinks || die -q "Couldn't remove existing symlink"
 	# the main /usr/bin/emacs symlink is only set for Emacs binaries
 	# (but not for other providers of auxiliary programs, e.g., XEmacs)




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-22 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 13:56 [gentoo-commits] eselect r390 - in trunk: man modules Ulrich Mueller (ulm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox