From: "Ulrich Mueller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: /
Date: Fri, 22 Jun 2012 17:29:24 +0000 (UTC) [thread overview]
Message-ID: <1182521363.ad0a9786dc3aa5805e83f068d9412ed05b8fbefa.ulm@gentoo> (raw)
commit: ad0a9786dc3aa5805e83f068d9412ed05b8fbefa
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 22 14:09:23 2007 +0000
Commit: Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Jun 22 14:09:23 2007 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=ad0a9786
New eselect module for ctags.
svn path=/emacs-extra/eselect-emacs/; revision=449
---
ctags.eselect | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
ctags.eselect.5 | 65 +++++++++++++++++
emacs.eselect.5 | 6 +-
3 files changed, 282 insertions(+), 3 deletions(-)
diff --git a/ctags.eselect b/ctags.eselect
new file mode 100644
index 0000000..a88c3fa
--- /dev/null
+++ b/ctags.eselect
@@ -0,0 +1,214 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+# Version: 1.0
+#
+# DOCUMENTATION
+# Following actions possible
+# * show do_show()
+# * list do_list()
+# * set do_set()
+# * update do_update()
+#
+# Behaviour:
+# do_show():
+# Checks if /usr/bin/ctags is a link and if the target exists,
+# if yes, it outputs the currently linked ctags implementation.
+# If it is no symlink, the user is told so, the same if there is
+# no /usr/bin/ctags or the target does not exist.
+# do_list(): List all available ctags implementations.
+# 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"
+MAINTAINER="emacs@gentoo.org"
+SVN_DATE='$Date$'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+find_targets() {
+ # Return the list of available ctags implementations
+
+ # (X)Emacs: offer only one ctags implementation, namely for the
+ # currently active Emacs version (selected by emacs.eselect)
+ # The logic here is the same as in emacs.eselect, don't change it!
+ local emacs
+ 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}"
+ elif [[ -f "${ROOT}/usr/bin/xemacs" ]]; then
+ [[ -f "${ROOT}/usr/bin/ctags-xemacs" ]] && echo ctags-xemacs
+ fi
+
+ # Exuberant ctags
+ [[ -f "${ROOT}"/usr/bin/exuberant-ctags ]] && echo exuberant-ctags
+}
+
+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*
+}
+
+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"
+}
+
+set_man_symlinks() {
+ # Set symlink to man page
+ local target=${1} extension i
+ for i in "${ROOT}"/usr/share/man/man1/${target}.1*; do
+ if [[ -f ${i} ]]; then
+ # target file exists; determine compress extension
+ extension=${i##*/${target}.1}
+ ln -s "${target}.1${extension}" \
+ "${ROOT}/usr/share/man/man1/ctags.1${extension}"
+ fi
+ done
+}
+
+set_symlinks() {
+ # Set symlinks to binary and man page
+ local target="${1}" targets
+ # target may be specified by its name or its index
+ if is_number "${target}"; then
+ # numeric index, find the target's name
+ targets=( $(find_targets) )
+ [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \
+ || die -q "Number out of range: ${1}"
+ target=${targets[$(( ${target} - 1 ))]}
+ fi
+
+ # is the target valid, i.e. does a ctags binary with this name exist?
+ [[ -f "${ROOT}/usr/bin/${target}" ]] \
+ || die -q "Target \"${1}\" doesn't appear to be valid!"
+
+ echo "Switching to ${target} ..."
+ remove_symlinks || die -q "Couldn't remove existing symlink"
+ set_bin_symlinks "${target}"
+ set_man_symlinks "${target}"
+ return 0
+}
+
+test_for_root() {
+ # checks if the user has rights to modify /usr/bin/
+ [[ -w "${ROOT}/usr/bin" ]] || die -q "You need to be root!"
+}
+
+### show action ###
+
+describe_show() {
+ 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_kv_list_entry \
+ $(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
+ write_kv_list_entry "(unset)" ""
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List available ctags symlink targets"
+}
+
+do_list() {
+ [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
+
+ local i targets
+ targets=( $(find_targets) )
+
+ if [[ -n ${targets[@]} ]]; then
+ 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") ) ]] \
+ && targets[${i}]="${targets[${i}]} $(highlight '*')"
+ done
+ write_list_start "Available ctags symlink targets:"
+ write_numbered_list "${targets[@]}"
+ else
+ write_kv_list_entry "(none found)" ""
+ fi
+}
+
+### set action ###
+
+describe_set() {
+ echo "Set a new ctags symlink"
+}
+
+describe_set_options() {
+ echo "target : Target name or number (from 'list' action)"
+}
+
+describe_set_parameters() {
+ echo "<target>"
+}
+
+do_set() {
+ [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to"
+ [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
+ test_for_root
+
+ 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"
+}
+
+### update action ###
+
+describe_update() {
+ echo "Automatically update the ctags symlink"
+}
+
+describe_update_options() {
+ echo "--if-unset : Do not override currently set version"
+}
+
+do_update() {
+ [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
+ test_for_root
+
+ local ctags=""
+ if [[ -L "${ROOT}/usr/bin/ctags" ]]; then
+ ctags=$(basename $(canonicalise "${ROOT}/usr/bin/ctags") )
+ [[ "${ctags}" == ctags-*emacs* ]] && ctags="ctags-*emacs*"
+ 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
+ die -q "Sorry, ${ROOT}/usr/bin/ctags exists but is not a symlink"
+ fi
+
+ # For an "update" only the version should be changed, but not the
+ # provider (i.e. Emacs vs Exuberant). At the moment only (X)Emacs
+ # offers several concurrent versions.
+
+ local i target targets=( $(find_targets) )
+ if [[ ${#targets[@]} -gt 0 ]]; then
+ target=${targets[0]}
+ for i in ${targets[@]}; do
+ [[ "${i}" == "${ctags}" ]] && target="${i}"
+ done
+ set_symlinks "${target}" || die -q "Couldn't set a new symlink"
+ fi
+}
diff --git a/ctags.eselect.5 b/ctags.eselect.5
new file mode 100644
index 0000000..47023e4
--- /dev/null
+++ b/ctags.eselect.5
@@ -0,0 +1,65 @@
+.\" Copyright 1999-2007 Gentoo Foundation
+.\" Distributed under the terms of the GNU General Public License v2
+.\" $Id$
+.\"
+.TH "ESELECT" "22" "June 2007" "Gentoo Linux" "eselect"
+.SH "NAME"
+ctags.eselect \- The ctags management module for Gentoo's eselect
+.SH "SYNOPSIS"
+\fBeselect ctags\fR [\fBhelp\fR|\fBusage\fR]
+.br
+\fBeselect ctags list\fR
+.br
+\fBeselect ctags set\fR \fItarget\fR
+.br
+\fBeselect ctags show\fR
+.br
+\fBeselect ctags update\fR [\fI--if-unset\fR]
+.SH "DESCRIPTION"
+\fBeselect\fR is Gentoo's configuration and management tool. It features
+modules that care for the individual administrative tasks.
+.SH "ACTION: LIST"
+\fBeselect ctags list\fR
+.br
+List all installed ctags versions.
+
+# eselect ctags list
+.br
+Available ctags symlink targets:
+.br
+ [1] ctags-emacs-22 *
+ [2] exuberant-ctags
+.SH "ACTION: SET"
+\fBeselect ctags set\fR \fItarget\fR
+.br
+Activates the selected ctags version. \fItarget\fR can be either an
+identification number given by \fBeselect ctags list\fR or the name of
+one installed version.
+
+# eselect ctags set 2
+.br
+Switching to exuberant-ctags ...
+.SH "ACTION: SHOW"
+\fBeselect ctags show\fR [\fItarget\fR]
+.br
+Prints the currently activated ctags version.
+
+# eselect ctags show
+.br
+Current target of symlink:
+.br
+ exuberant-ctags
+.SH "ACTION: UPDATE"
+\fBeselect ctags update\fR
+.br
+Update the ctags symlink. For an update only the version is changed,
+but not the provider (i.e. Emacs vs Exuberant). At the moment only
+(X)Emacs offers several concurrent versions.
+
+# eselect ctags update
+.br
+Switching to exuberant-ctags ...
+.SH "AUTHOR"
+Ulrich Mueller <ulm@gentoo.org>
+.SH "REVISION"
+$Id$
diff --git a/emacs.eselect.5 b/emacs.eselect.5
index 25936fe..c916cce 100644
--- a/emacs.eselect.5
+++ b/emacs.eselect.5
@@ -40,7 +40,7 @@ one installed version.
# eselect emacs set 3
.br
-Switching to emacs-22...
+Switching to emacs-22 ...
.SH "ACTION: SHOW"
\fBeselect emacs show\fR [\fItarget\fR]
.br
@@ -50,7 +50,7 @@ Prints the currently activated Emacs version.
.br
Current target of symlink:
.br
-emacs-22
+ emacs-22
.SH "ACTION: UPDATE"
\fBeselect emacs update\fR [\fI--if-unset\fR]
.br
@@ -60,7 +60,7 @@ overridden.
# eselect emacs update
.br
-Switching to emacs-22...
+Switching to emacs-22 ...
.SH "AUTHORS"
Christian Faulhammer <opfer@gentoo.org>
.br
next reply other threads:[~2012-06-22 17:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-22 17:29 Ulrich Mueller [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-06-22 17:29 [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: / Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1182521363.ad0a9786dc3aa5805e83f068d9412ed05b8fbefa.ulm@gentoo \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox