summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'emacs.eselect')
-rw-r--r--emacs.eselect226
1 files changed, 0 insertions, 226 deletions
diff --git a/emacs.eselect b/emacs.eselect
deleted file mode 100644
index 084461e..0000000
--- a/emacs.eselect
+++ /dev/null
@@ -1,226 +0,0 @@
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-# DOCUMENTATION
-# Following actions possible
-# * show do_show()
-# * list do_list()
-# * set do_set()
-# * update do_update()
-#
-# Behaviour:
-# do_show():
-# Checks if /usr/bin/emacs is a link and if the target exists,
-# if yes, it outputs the currently linked Emacs version.
-# If it is no symlink, the user is told so, the same if there is
-# no /usr/bin/emacs or the target does not exist.
-# do_list():
-# do_set():
-# do_update():
-
-DESCRIPTION="Manage /usr/bin/emacs implementations"
-MAINTAINER="emacs@gentoo.org"
-SVN_DATE='$Date$'
-VERSION=$(svn_date_to_version "${SVN_DATE}" )
-
-BINARYLIST="emacsclient etags ctags b2m ebrowse rcs-checkin grep-changelog"
-MANPAGELIST="emacs emacsclient etags ctags gfdl"
-
-# Return the list of available Emacs binaries
-find_targets() {
- local j
- for j in ${ROOT}/usr/bin/emacs-[0-9]*; do
- [[ -f ${j} ]] && basename ${j}
- done
-}
-
-remove_infopath() {
- rm -f ${ROOT}/etc/env.d/50emacs
-}
-
-# Define INFOPATH environment variable in env file
-set_infopath() {
- [[ -d ${ROOT}/usr/share/info/${1} ]] || return 1
- echo "INFOPATH=/usr/share/info/${1}" >${ROOT}/etc/env.d/50emacs
-}
-
-# Remove existing symlinks to binaries, man pages, and the env file
-remove_symlinks() {
- local f
- rm -f "${ROOT}"/usr/bin/emacs
- for f in ${BINARYLIST}; do
- rm -f "${ROOT}"/usr/bin/${f}
- done
- for f in ${MANPAGELIST}; do
- rm -f "${ROOT}"/usr/share/man/man1/${f}.1*
- done
- remove_infopath
-}
-
-# Set symlinks to binaries in /usr/bin
-set_bin_symlinks() {
- local target=${1} f
- for f in ${BINARYLIST}; do
- # set symlink only if target binary actually exists
- if [[ -f "${ROOT}/usr/bin/${f}-${target}" ]]; then
- ln -s "${f}-${target}" "${ROOT}/usr/bin/${f}" ||
- die "Couldn't set ${f}-${target} /usr/bin/${f} symlink"
- fi
- done
-}
-
-# Set symlinks to man pages
-set_man_symlinks() {
- local target=${1} extension f i
- for f in ${MANPAGELIST}; do
- for i in ${ROOT}/usr/share/man/man1/${f}-${target}.1*; do
- if [[ -f ${i} ]]; then
- # target file exists; determine compress extension
- extension=${i##*/${f}-${target}.1}
- ln -s "${f}-${target}.1${extension}" \
- "${ROOT}/usr/share/man/man1/${f}.1${extension}"
- fi
- done
- done
-}
-
-# Set symlinks to binaries and man pages, update info path
-set_symlinks() {
- local target="${1}" targets
- # target may be specified by its name or its index
- if is_number "${target}" && [[ ${target} -ge 1 ]]; then
- # numeric index, find the target's name
- targets=( $(find_targets) )
- target=${targets[$(( ${target} - 1 ))]}
- fi
-
- # is the target valid, i.e. does an Emacs 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
- # the main /usr/bin/emacs symlink is only set for Emacs binaries
- # (but not for other providers of auxiliary programs, e.g., XEmacs)
- if [[ ${target} == emacs-* ]]; then
- ln -s "${target}" "${ROOT}/usr/bin/emacs" \
- || die "Couldn't set ${target} /usr/bin/emacs symlink"
- fi
- set_bin_symlinks "${target}"
- set_man_symlinks "${target}"
- set_infopath "${target}"
-
- # update /etc/profile.env from /etc/env.d files
- #do_action env update >/dev/null
- env-update --no-ldconfig
-
- return 0
-}
-
-### 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" && \
- -e $(canonicalise "${ROOT}/usr/bin/emacs") ]]; then
- write_kv_list_entry \
- "$(basename $(canonicalise ${ROOT}/usr/bin/emacs) )" ""
- elif [[ -e "${ROOT}/usr/bin/emacs" ]]; 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 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() {
- [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to"
- [[ -n "${2}" ]] && die -q "Too many parameters"
- [[ -w "${ROOT}/usr/bin" ]] || die -q "You need to be root!"
-
- if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
- remove_symlinks || die -q "Couldn't remove existing symlink"
- elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
- die -q "Sorry, ${ROOT}/usr/bin/emacs confuses me"
- fi
-
- set_symlinks "${1}" || die -q "Couldn't set a new symlink"
-}
-
-### 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"
- [[ -w "${ROOT}/usr/bin" ]] || die -q "You need to be root!"
-
- if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
- [[ ${1} == "--if-unset" \
- && -e "$(canonicalise ${ROOT}/usr/bin/emacs)" ]] && return
- remove_symlinks || die -q "Couldn't remove existing symlink"
- elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
- die -q "Sorry, ${ROOT}/usr/bin/emacs confuses me"
- fi
-
- local targets=( $(find_targets) )
- if [[ ${#targets[@]} -gt 0 ]]; then
- set_symlinks ${#targets[@]} || die -q "Couldn't set a new symlink"
- elif [[ -f "${ROOT}/usr/bin/xemacs" ]]; then
- # no Emacs target found - link ctags, etags etc. to XEmacs versions
- set_symlinks xemacs
- fi
-}