summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2013-07-18 22:37:34 +0200
committerUlrich Müller <ulm@gentoo.org>2013-07-18 22:37:34 +0200
commit0914a69ece4ac510cacd7719a6d7a11de3a8a071 (patch)
tree2f9d20ac343782b45e8b7311640df7ef845e9c75 /eclass
parentAdd app-xemacs to categories. (diff)
downloademacs-0914a69ece4ac510cacd7719a6d7a11de3a8a071.tar.gz
emacs-0914a69ece4ac510cacd7719a6d7a11de3a8a071.tar.bz2
emacs-0914a69ece4ac510cacd7719a6d7a11de3a8a071.zip
Make elisp-emacs-version() more robust.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/elisp-common.eclass17
1 files changed, 14 insertions, 3 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index dcba57b..8f6a826 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -173,16 +173,27 @@ BYTECOMPFLAGS="-L ."
# Output version of currently active Emacs.
elisp-emacs-version() {
- local ret
+ local version ret
# The following will work for at least versions 18-24.
echo "(princ emacs-version)" >"${T}"/emacs-version.el
- ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el
+ version=$(
+ # EMACS could be a microemacs variant that doesn't know our
+ # options and would hang in interactive mode. Redirecting stdin
+ # and unsetting TERM and DISPLAY will make most of them fail.
+ unset TERM DISPLAY
+ ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null
+ )
ret=$?
rm -f "${T}"/emacs-version.el
if [[ ${ret} -ne 0 ]]; then
eerror "elisp-emacs-version: Failed to run ${EMACS}"
+ return ${ret}
+ fi
+ if [[ -z ${version} ]]; then
+ eerror "elisp-emacs-version: Could not determine Emacs version"
+ return 1
fi
- return ${ret}
+ echo "${version}"
}
# @FUNCTION: elisp-need-emacs