/[gentoo-x86]/eclass/elisp-common.eclass
Gentoo

Diff of /eclass/elisp-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.71 Revision 1.73
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.71 2011/02/19 10:12:42 ulm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.73 2011/08/22 06:13:14 ulm Exp $
4#
5# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
6# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org>
8# Copyright 2007-2008 Christian Faulhammer <fauli@gentoo.org>
9# Copyright 2007-2011 Ulrich Müller <ulm@gentoo.org>
10# 4#
11# @ECLASS: elisp-common.eclass 5# @ECLASS: elisp-common.eclass
12# @MAINTAINER: 6# @MAINTAINER:
13# Feel free to contact the Emacs team through <emacs@gentoo.org> if you 7# Feel free to contact the Emacs team through <emacs@gentoo.org> if you
14# have problems, suggestions or questions. 8# have problems, suggestions or questions.
9# @AUTHOR:
10# Matthew Kennedy <mkennedy@gentoo.org>
11# Jeremy Maitin-Shepard <jbms@attbi.com>
12# Mamoru Komachi <usata@gentoo.org>
13# Christian Faulhammer <fauli@gentoo.org>
14# Ulrich Müller <ulm@gentoo.org>
15# @BLURB: Emacs-related installation utilities 15# @BLURB: Emacs-related installation utilities
16# @DESCRIPTION: 16# @DESCRIPTION:
17# 17#
18# Usually you want to use this eclass for (optional) GNU Emacs support 18# Usually you want to use this eclass for (optional) GNU Emacs support
19# of your package. This is NOT for XEmacs! 19# of your package. This is NOT for XEmacs!
169# @FUNCTION: elisp-emacs-version 169# @FUNCTION: elisp-emacs-version
170# @DESCRIPTION: 170# @DESCRIPTION:
171# Output version of currently active Emacs. 171# Output version of currently active Emacs.
172 172
173elisp-emacs-version() { 173elisp-emacs-version() {
174 local ret
174 # The following will work for at least versions 18-23. 175 # The following will work for at least versions 18-23.
175 echo "(princ emacs-version)" >"${T}"/emacs-version.el 176 echo "(princ emacs-version)" >"${T}"/emacs-version.el
176 ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el 177 ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el
178 ret=$?
177 rm -f "${T}"/emacs-version.el 179 rm -f "${T}"/emacs-version.el
180 if [[ ${ret} -ne 0 ]]; then
181 eerror "elisp-emacs-version: Failed to run ${EMACS}"
182 fi
183 return ${ret}
178} 184}
179 185
180# @FUNCTION: elisp-need-emacs 186# @FUNCTION: elisp-need-emacs
181# @USAGE: <version> 187# @USAGE: <version>
182# @RETURN: 0 if true, 1 otherwise 188# @RETURN: 0 if true, 1 otherwise
183# @DESCRIPTION: 189# @DESCRIPTION:
184# Test if the eselected Emacs version is at least the major version 190# Test if the eselected Emacs version is at least the major version
185# specified as argument. 191# specified as argument.
186 192
187elisp-need-emacs() { 193elisp-need-emacs() {
188 local need_emacs=$1 194 local need_emacs=$1 have_emacs
189 local have_emacs=$(elisp-emacs-version) 195 have_emacs=$(elisp-emacs-version) || return
190 einfo "Emacs version: ${have_emacs}" 196 einfo "Emacs version: ${have_emacs}"
191 if ! [[ ${have_emacs%%.*} -ge ${need_emacs%%.*} ]]; then 197 if ! [[ ${have_emacs%%.*} -ge ${need_emacs%%.*} ]]; then
192 eerror "This package needs at least Emacs ${need_emacs%%.*}." 198 eerror "This package needs at least Emacs ${need_emacs%%.*}."
193 eerror "Use \"eselect emacs\" to select the active version." 199 eerror "Use \"eselect emacs\" to select the active version."
194 return 1 200 return 1

Legend:
Removed from v.1.71  
changed lines
  Added in v.1.73

  ViewVC Help
Powered by ViewVC 1.1.20