summaryrefslogtreecommitdiff
path: root/eclass/elisp-common.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/elisp-common.eclass')
-rw-r--r--eclass/elisp-common.eclass40
1 files changed, 11 insertions, 29 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 832fc19e4675..bce3fd0cec02 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -10,6 +10,7 @@
# Mamoru Komachi <usata@gentoo.org>
# Christian Faulhammer <fauli@gentoo.org>
# Ulrich Müller <ulm@gentoo.org>
+# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Emacs-related installation utilities
# @DESCRIPTION:
#
@@ -165,7 +166,7 @@
# to above calls of elisp-site-regen().
case ${EAPI:-0} in
- 4|5|6) inherit eapi7-ver ;;
+ 5|6) inherit eapi7-ver ;;
7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -219,7 +220,9 @@ _ELISP_EMACS_VERSION=""
# Output version of currently active Emacs.
elisp-emacs-version() {
- local version ret
+ local version ret tmout="timeout -k 5 55"
+ # Run without timeout if the command is not available
+ ${tmout} true &>/dev/null || tmout=""
# The following will work for at least versions 18-24.
echo "(princ emacs-version)" >"${T}"/emacs-version.el
version=$(
@@ -228,7 +231,7 @@ elisp-emacs-version() {
# Redirecting stdin and unsetting TERM and DISPLAY will cause
# most of them to exit with an error.
unset TERM DISPLAY
- ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null
+ ${tmout} ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null
)
ret=$?
rm -f "${T}"/emacs-version.el
@@ -274,27 +277,6 @@ elisp-check-emacs-version() {
fi
}
-# Test if the eselected Emacs version is at least the major version
-# of GNU Emacs specified as argument.
-# Return 0 if true, 1 if false, 2 if trouble.
-# Deprecated, use elisp-check-emacs-version instead.
-
-elisp-need-emacs() {
- local need_emacs=$1 have_emacs
- have_emacs=$(elisp-emacs-version) || return 2
- einfo "Emacs version: ${have_emacs}"
- if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then
- eerror "This package needs GNU Emacs."
- return 1
- fi
- if ! [[ ${have_emacs%%.*} -ge ${need_emacs%%.*} ]]; then
- eerror "This package needs at least Emacs ${need_emacs%%.*}."
- eerror "Use \"eselect emacs\" to select the active version."
- return 1
- fi
- return 0
-}
-
# @FUNCTION: elisp-compile
# @USAGE: <list of elisp files>
# @DESCRIPTION:
@@ -380,7 +362,7 @@ elisp-modules-install() {
shift
# Don't bother inheriting multilib.eclass for get_libdir(), but
# error out in old EAPIs that don't support it natively.
- [[ ${EAPI} == [45] ]] \
+ [[ ${EAPI} == 5 ]] \
&& die "${ECLASS}: Dynamic modules not supported in EAPI ${EAPI}"
ebegin "Installing dynamic modules for GNU Emacs support"
( # subshell to avoid pollution of calling environment
@@ -408,8 +390,8 @@ elisp-site-file-install() {
[[ ${sf%-gentoo*.el} != "${sf}" ]] && sf="${sf%-gentoo*.el}-gentoo.el"
sf="${T}/${sf}"
ebegin "Installing site initialisation file for GNU Emacs"
- [[ $1 = "${sf}" ]] || cp "$1" "${sf}"
- if [[ ${EAPI} == [45] ]]; then
+ [[ $1 == "${sf}" ]] || cp "$1" "${sf}"
+ if [[ ${EAPI} == 5 ]]; then
grep -q "@EMACSMODULES@" "${sf}" \
&& die "${ECLASS}: Dynamic modules not supported in EAPI ${EAPI}"
else
@@ -439,7 +421,7 @@ elisp-site-regen() {
local sf i ret=0 null="" page=$'\f'
local -a sflist
- if [[ ${EBUILD_PHASE} = *rm && ! -e ${sitelisp}/site-gentoo.el ]]; then
+ if [[ ${EBUILD_PHASE} == *rm && ! -e ${sitelisp}/site-gentoo.el ]]; then
ewarn "Refusing to create site-gentoo.el in ${EBUILD_PHASE} phase."
return 0
fi
@@ -494,7 +476,7 @@ elisp-site-regen() {
mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el
eend $? "elisp-site-regen: Replacing site-gentoo.el failed" || die
case ${#sflist[@]} in
- 0) [[ ${PN} = emacs-common ]] \
+ 0) [[ ${PN} == emacs-common ]] \
|| ewarn "... Huh? No site initialisation files found." ;;
1) einfo "... ${#sflist[@]} site initialisation file included." ;;
*) einfo "... ${#sflist[@]} site initialisation files included." ;;