diff options
author | Christian Faulhammer <opfer@gentoo.org> | 2007-03-15 12:10:57 +0000 |
---|---|---|
committer | Christian Faulhammer <opfer@gentoo.org> | 2007-03-15 12:10:57 +0000 |
commit | bc52f04b4ba36ce1c2d3623437542e5f94e08f7a (patch) | |
tree | 868e2cc049f890dfaab36d47d4c56243284c7870 | |
download | emacs-tools-bc52f04b4ba36ce1c2d3623437542e5f94e08f7a.tar.gz emacs-tools-bc52f04b4ba36ce1c2d3623437542e5f94e08f7a.tar.bz2 emacs-tools-bc52f04b4ba36ce1c2d3623437542e5f94e08f7a.zip |
adding distribution files for eselect tarball
svn path=/emacs-extra/eselect-emacs/; revision=5
-rw-r--r-- | ChangeLog | 0 | ||||
-rw-r--r-- | emacs.desktop | 8 | ||||
-rw-r--r-- | emacs.eselect | 177 | ||||
-rw-r--r-- | emacs.png | bin | 0 -> 4589 bytes |
4 files changed, 185 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ChangeLog diff --git a/emacs.desktop b/emacs.desktop new file mode 100644 index 0000000..103edde --- /dev/null +++ b/emacs.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=GNU Emacs +Comment=Emacs is the extensible, customizable, self-documenting real-time display editor. +Icon=emacs.png +Terminal=0 +Type=Application;TextEditor +Categories=Application;Development; +Exec=/usr/bin/emacs diff --git a/emacs.eselect b/emacs.eselect new file mode 100644 index 0000000..18c05f4 --- /dev/null +++ b/emacs.eselect @@ -0,0 +1,177 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: emacs.eselect,v 1.2 2007/03/15 11:47:15 opfer Exp $ + +DESCRIPTION="Manage /usr/bin/emacs implementations" +MAINTAINER="emacs@gentoo.org" +SVN_DATE='$Date: 2007/03/15 11:47:15 $' +VERSION=$(svn_date_to_version "${SVN_DATE}" ) + +MANPAGELIST="emacs emacsclient etags ctags" +BINARYLIST="${MANPAGELIST} b2m ebrowse rcs-checkin grep-changelog" + +find_targets() { + # gives back the list of available Emacs versions + # + local j + for j in ${ROOT}/usr/bin/emacs.emacs-* + do + if [[ -f ${j} ]] ; then + echo $(basename ${j}|sed 's/^[^\.]*.//' ) + fi + done +} + +set_infopath() { + echo "INFOPATH=/usr/share/info/${1}" > /etc/env.d/50emacs +} + +remove_symlinks() { + local extension=$(echo ${ROOT}/usr/share/man/man1/emacs.emacs-*.1*|sed 's/.*\.1//') + local f + for f in ${BINARYLIST} + do + rm -f "${ROOT}"/usr/bin/${f} &>/dev/null && \ + rm -f "${ROOT}"/usr/share/man/man1/${f}.1${extension} &>/dev/null + done +} + +set_man_symlinks() { + local target="${1}" z + local extension=$(echo ${ROOT}/usr/share/man/man1/emacs.${target}*.1*|sed 's/.*\.1//') + + if [[ -z "${extension}" ]] ; then + echo "Couldn't find a man page for ${target}; skipping." 1>&2 + return 1 + fi + + for z in ${MANPAGELIST} + do + cd /usr/share/man/man1/ + ln -s "${z}.${target}.1${extension}" "${z}.1${extension}" + done +} + +set_symlinks() { + local target="${1}" targets i + if is_number "${target}" && [[ ${target} -ge 1 ]] ; then + targets=( $(find_targets ) ) + target=${targets[$(( ${target} - 1 ))]} + fi + if [[ -f "${ROOT}/usr/bin/${target}" ]] ; then + remove_symlinks + for i in ${BINARYLIST} + do + ln -s "${ROOT}/usr/bin/${i}.${target}" "${ROOT}/usr/bin/${i}" || \ + die "Couldn't set ${i}.${target} /usr/bin/${i} symlink" + done + + set_man_symlinks "${target}" + set_infopath "${target}" + else + die -q "Target \"${1}\" doesn't appear to be valid!" + fi +} + +### show action ### + +describe_show() { + echo "Show the current target of the Emacs symlink" +} + +do_show() { + [[ -z "${@}" ]] || die -q "Too many parameters" + + write_list_start "Current target of symlink:" + if [[ -L "${ROOT}/usr/bin/emacs" ]] ; then + write_kv_list_entry "$(basename $(canonicalise ${ROOT}/usr/bin/emacs )|sed 's/^[^\.]*.//' )" "" + elif [[ -e "${ROOT}/usr/bin/emacs" ]] ; then + write_kv_list_entry "(not a symlink)" "" + else + write_kv_list_entry "(unset)" "" + fi +} + +### list action ### + +describe_list() { + echo "List available Emacs symlink targets" +} + +do_list() { + [[ -z "${@}" ]] || die -q "Too many parameters" + + local i targets + targets=( $(find_targets ) ) + if [[ -n ${targets[@]} ]] ; then + for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do + [[ ${targets[${i}]} == $(basename $(canonicalise ${ROOT}/usr/bin/emacs ) ) ]] && \ + targets[${i}]="${targets[${i}]} $(highlight '*' )" + done + write_list_start "Available Emacs symlink targets:" + write_numbered_list "${targets[@]}" + else + write_kv_list_entry "(none found)" "" + fi +} + +### set action ### + +describe_set() { + echo "Set a new Emacs symlink" +} + +describe_set_options() { + echo "target : Target name or number (from 'list' action)" +} + +describe_set_parameters() { + echo "<target>" +} + +do_set() { + if [[ -z "${1}" ]] ; then + die -q "You didn't give me a provider name" + + elif [[ -n "${2}" ]] ; then + die -q "Too many parameters" + + elif [[ -L "${ROOT}/usr/bin/emacs" ]] ; then + if ! remove_symlinks ; then + die -q "Can't remove existing provider" + elif ! set_symlinks "${1}" ; then + die -q "Can't set new provider" + fi + + elif [[ -e "${ROOT}/usr/bin/emacs" ]] ; then + die -q "Sorry, ${ROOT}/usr/bin/emacs confuses me" + + else + set_symlinks "${1}" || die -q "Can't set a new provider" + fi +} + +### update action ### + +describe_update() { + echo "Automatically update the Emacs symlink" +} + +describe_update_options() { + echo "--if-unset : Do not override existing implementation" +} + +do_update() { + [[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \ + die -q "Usage error" + + if [[ -L "${ROOT}/usr/bin/emacs" ]] ; then + [[ ${1} == "--if-unset" ]] && return + remove_symlinks || die -q "Can't remove existing link" + fi + if [[ -e "${ROOT}/usr/bin/emacs" ]] ; then + die -q "Can't set a new provider" + elif ! [[ -z $(find_targets ) ]] ; then + set_symlinks 1 || die -q "Can't set a new provider" + fi +} diff --git a/emacs.png b/emacs.png Binary files differnew file mode 100644 index 0000000..78f866e --- /dev/null +++ b/emacs.png |