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:21 +0000 (UTC) [thread overview]
Message-ID: <1180432925.0431fb90618d96dadbe153a3a51841149f23218b.ulm@gentoo> (raw)
commit: 0431fb90618d96dadbe153a3a51841149f23218b
Author: Christian Faulhammer <opfer <AT> gentoo <DOT> org>
AuthorDate: Tue May 29 10:02:05 2007 +0000
Commit: Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue May 29 10:02:05 2007 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=0431fb90
* Took a check for modification right from do_update() to own
function and use them in do_set(), too
* Made a ndash out of a divis
* Added quotes around use of ROOT variable in remove_infopath(),
set_man_symlinks(), set_infopath(), find_targets(), do_list()
* Commented functions remove_infopath()
* Moved the comment for find_targets(), set_infopath(),
remove_symlinks(), set_bin_symlinks(), set_man_symlinks(),set_symlinks()
* Brief overview of functions completed in the header of the module
* Change wording: implementation -> version
svn path=/emacs-extra/eselect-emacs/; revision=344
---
emacs.eselect | 46 ++++++++++++++++++++++++++--------------------
1 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/emacs.eselect b/emacs.eselect
index 7adf8ff..f884daf 100644
--- a/emacs.eselect
+++ b/emacs.eselect
@@ -8,7 +8,7 @@
# * show do_show()
# * list do_list()
# * set do_set()
-# * update do_update()
+# * update do_update()
#
# Behaviour:
# do_show():
@@ -16,11 +16,11 @@
# 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():
+# do_list(): List all available versions of GNU Emacs
+# do_set(): Set a version to be target of the symlink.
+# do_update(): Check if the target is still valid and reset it
-DESCRIPTION="Manage /usr/bin/emacs implementations"
+DESCRIPTION="Manage /usr/bin/emacs version"
MAINTAINER="emacs@gentoo.org"
SVN_DATE='$Date$'
VERSION=$(svn_date_to_version "${SVN_DATE}" )
@@ -28,26 +28,27 @@ 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() {
+ # Return the list of available Emacs binaries
local j
- for j in ${ROOT}/usr/bin/emacs-[0-9]*; do
+ for j in "${ROOT}"/usr/bin/emacs-[0-9]*; do
[[ -f ${j} ]] && basename ${j}
done
}
remove_infopath() {
- rm -f ${ROOT}/etc/env.d/50emacs
+ # When cleaning symlinks this takes care of the info documentation settings
+ 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
+ [[ -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() {
+ # Remove existing symlinks to binaries, man pages, and the env file (own function)
local f
rm -f "${ROOT}"/usr/bin/emacs
for f in ${BINARYLIST}; do
@@ -59,8 +60,8 @@ remove_symlinks() {
remove_infopath
}
-# Set symlinks to binaries in /usr/bin
set_bin_symlinks() {
+ # Set symlinks to binaries in /usr/bin/
local target=${1} f
for f in ${BINARYLIST}; do
# set symlink only if target binary actually exists
@@ -71,11 +72,11 @@ set_bin_symlinks() {
done
}
-# Set symlinks to man pages
set_man_symlinks() {
+ # Set symlinks to man pages
local target=${1} extension f i
for f in ${MANPAGELIST}; do
- for i in ${ROOT}/usr/share/man/man1/${f}-${target}.1*; 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}
@@ -86,8 +87,8 @@ set_man_symlinks() {
done
}
-# Set symlinks to binaries and man pages, update info path
set_symlinks() {
+ # Set symlinks to binaries and man pages, update info path
local target="${1}" targets
# target may be specified by its name or its index
if is_number "${target}"; then
@@ -130,6 +131,11 @@ xemacs_info() {
fi
}
+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() {
@@ -168,7 +174,7 @@ do_list() {
if [[ -n ${targets[@]} ]]; then
for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do
[[ ${targets[${i}]} = \
- $(basename $(canonicalise ${ROOT}/usr/bin/emacs) ) ]] &&
+ $(basename $(canonicalise "${ROOT}/usr/bin/emacs") ) ]] &&
# Display a star to indicate the currently chosen version
targets[${i}]="${targets[${i}]} $(highlight '*')"
done
@@ -197,7 +203,7 @@ describe_set_parameters() {
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!"
+ test_for_root
if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
remove_symlinks || die -q "Couldn't remove existing symlink"
@@ -215,13 +221,13 @@ describe_update() {
}
describe_update_options() {
- echo "--if-unset : Do not override existing implementation"
+ echo "--if-unset : Do not override currently set version"
}
do_update() {
[[ -z "${1}" || ( -z "${2}" && "${1}" == "--if-unset" ) ]] ||
die -q "Usage error"
- [[ -w "${ROOT}/usr/bin" ]] || die -q "You need to be root!"
+ test_for_root
if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
[[ ${1} == "--if-unset" \
@@ -235,7 +241,7 @@ do_update() {
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
+ # no Emacs target found -- link ctags, etags etc. to XEmacs versions
set_symlinks xemacs
fi
}
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=1180432925.0431fb90618d96dadbe153a3a51841149f23218b.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