summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2010-11-23 20:56:08 +0000
committerUlrich Müller <ulm@gentoo.org>2010-11-23 20:56:08 +0000
commit10a88ce17b38c8aae2ecc5453fdf11ba7d1fefea (patch)
tree751d52db1c3139b0a771ef069c4778db7e10f3c0 /eclass/elisp-common.eclass
parentRestore prefix keywords that were dropped for no reason (diff)
downloadhistorical-10a88ce17b38c8aae2ecc5453fdf11ba7d1fefea.tar.gz
historical-10a88ce17b38c8aae2ecc5453fdf11ba7d1fefea.tar.bz2
historical-10a88ce17b38c8aae2ecc5453fdf11ba7d1fefea.zip
Sync eclasses from Emacs overlay (revision 1542).
elisp-common.eclass: Remove dead function elisp-comp; it has been deprecated more than two years ago in bug 235442. New function elisp-need-emacs, tests if the eselected Emacs version is at least the major version specified as argument. elisp.eclass: Use function elisp-need-emacs in elisp_pkg_setup.
Diffstat (limited to 'eclass/elisp-common.eclass')
-rw-r--r--eclass/elisp-common.eclass43
1 files changed, 33 insertions, 10 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 9e530f3375af..8c73a3acf4da 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.68 2010/10/09 15:30:43 ulm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.69 2010/11/23 20:56:08 ulm Exp $
#
# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
@@ -29,6 +29,19 @@
# to your DEPEND/RDEPEND line and use the functions provided here to
# bring the files to the correct locations.
#
+# If your package requires a minimum Emacs version, e.g. Emacs 23, then
+# the dependency should be on >=virtual/emacs-23 instead. Because the
+# user can select the Emacs executable with eselect, you should also
+# make sure that the active Emacs version is sufficient. This can be
+# tested with function elisp-need-emacs(), which would typically be
+# called from pkg_setup(), as in the following example:
+#
+# elisp-need-emacs 23 || die "Emacs version too low"
+#
+# Please note that such tests should be limited to packages that are
+# known to fail with lower Emacs versions; the standard case is to
+# depend on virtual/emacs without version.
+#
# .SS
# src_compile() usage:
#
@@ -126,11 +139,6 @@
# the emacs USE flag is taken from the package database and not from the
# environment, so it is no problem when you unset USE=emacs between
# merge and unmerge of a package.
-#
-# .SS
-# Miscellaneous functions:
-#
-# elisp-emacs-version() outputs the version of the currently active Emacs.
# @ECLASS-VARIABLE: SITELISP
# @DESCRIPTION:
@@ -177,10 +185,6 @@ elisp-compile() {
eend $? "elisp-compile: batch-byte-compile failed"
}
-elisp-comp() {
- die "Function elisp-comp is not supported any more, see bug 235442"
-}
-
# @FUNCTION: elisp-emacs-version
# @DESCRIPTION:
# Output version of currently active Emacs.
@@ -192,6 +196,25 @@ elisp-emacs-version() {
rm -f "${T}"/emacs-version.el
}
+# @FUNCTION: elisp-need-emacs
+# @USAGE: <version>
+# @RETURN: 0 if true, 1 otherwise
+# @DESCRIPTION:
+# Test if the eselected Emacs version is at least the major version
+# specified as argument.
+
+elisp-need-emacs() {
+ local need_emacs=$1
+ local have_emacs=$(elisp-emacs-version)
+ einfo "Emacs version: ${have_emacs}"
+ 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-make-autoload-file
# @USAGE: [output file] [list of directories]
# @DESCRIPTION: