From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Si7gP-00037C-5x for garchives@archives.gentoo.org; Fri, 22 Jun 2012 17:30:09 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 360ECE0950; Fri, 22 Jun 2012 17:29:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id EB65BE0950 for ; Fri, 22 Jun 2012 17:29:26 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6BB5C1B4011 for ; Fri, 22 Jun 2012 17:29:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 15AFCE543D for ; Fri, 22 Jun 2012 17:29:24 +0000 (UTC) From: "Ulrich Mueller" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Mueller" Message-ID: <1182521363.ad0a9786dc3aa5805e83f068d9412ed05b8fbefa.ulm@gentoo> Subject: [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: / X-VCS-Repository: proj/emacs-tools X-VCS-Files: ctags.eselect ctags.eselect.5 emacs.eselect.5 X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Mueller X-VCS-Revision: ad0a9786dc3aa5805e83f068d9412ed05b8fbefa X-VCS-Branch: eselect-emacs-1.1 Date: Fri, 22 Jun 2012 17:29:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 64489c5f-3fe4-4129-bf77-c051de18376a X-Archives-Hash: e3666e9cca926985c2a638a71b1b2731 commit: ad0a9786dc3aa5805e83f068d9412ed05b8fbefa Author: Ulrich M=C3=BCller gentoo org> AuthorDate: Fri Jun 22 14:09:23 2007 +0000 Commit: Ulrich Mueller gentoo org> CommitDate: Fri Jun 22 14:09:23 2007 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/emacs-tools.g= it;a=3Dcommit;h=3Dad0a9786 New eselect module for ctags. svn path=3D/emacs-extra/eselect-emacs/; revision=3D449 --- 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=3D"Manage /usr/bin/ctags implementations" +MAINTAINER=3D"emacs@gentoo.org" +SVN_DATE=3D'$Date$' +VERSION=3D$(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=3D$(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=3D${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=3D${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=3D${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=3D"${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=3D( $(find_targets) ) + [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ + || die -q "Number out of range: ${1}" + target=3D${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=3D( $(find_targets) ) + + if [[ -n ${targets[@]} ]]; then + for (( i =3D 0; i < ${#targets[@]}; i =3D i + 1 )); do + # Display a star to indicate the currently chosen version + [[ ${targets[${i}]} =3D \ + $(basename $(canonicalise "${ROOT}/usr/bin/ctags") ) ]] \ + && targets[${i}]=3D"${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 "" +} + +do_set() { + [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink t= o" + [[ ${#@} -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=3D"" + if [[ -L "${ROOT}/usr/bin/ctags" ]]; then + ctags=3D$(basename $(canonicalise "${ROOT}/usr/bin/ctags") ) + [[ "${ctags}" =3D=3D ctags-*emacs* ]] && ctags=3D"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=3D( $(find_targets) ) + if [[ ${#targets[@]} -gt 0 ]]; then + target=3D${targets[0]} + for i in ${targets[@]}; do + [[ "${i}" =3D=3D "${ctags}" ]] && target=3D"${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 +.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. =20 # 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. =20 # eselect emacs update .br -Switching to emacs-22... +Switching to emacs-22 ... .SH "AUTHORS" Christian Faulhammer .br