/[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.59 Revision 1.60
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.59 2009/04/08 10:47:42 ulm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.60 2009/04/14 15:45:45 ulm Exp $
4# 4#
5# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org> 5# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
6# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> 6# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org> 7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org>
8# Copyright 2007-2008 Christian Faulhammer <fauli@gentoo.org> 8# Copyright 2007-2008 Christian Faulhammer <fauli@gentoo.org>
258 258
259 [[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \ 259 [[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \
260 || ewarn "elisp-site-file-install: bad name of site-init file" 260 || ewarn "elisp-site-file-install: bad name of site-init file"
261 sf="${T}/${sf/%-gentoo*.el/-gentoo.el}" 261 sf="${T}/${sf/%-gentoo*.el/-gentoo.el}"
262 ebegin "Installing site initialisation file for GNU Emacs" 262 ebegin "Installing site initialisation file for GNU Emacs"
263 cp "$1" "${sf}" 263 [[ $1 = ${sf} ]] || cp "$1" "${sf}"
264 sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \ 264 sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \
265 -e "s:@SITELISP@:${SITELISP}/${my_pn}:g" \ 265 -e "s:@SITELISP@:${SITELISP}/${my_pn}:g" \
266 -e "s:@SITEETC@:${SITEETC}/${my_pn}:g;\$q" "${sf}" 266 -e "s:@SITEETC@:${SITEETC}/${my_pn}:g;\$q" "${sf}"
267 ( # subshell to avoid pollution of calling environment 267 ( # subshell to avoid pollution of calling environment
268 insinto "${SITELISP}/site-gentoo.d" 268 insinto "${SITELISP}/site-gentoo.d"
282# Note: Before December 2007, site initialisation files were installed 282# Note: Before December 2007, site initialisation files were installed
283# in /usr/share/emacs/site-lisp/. For backwards compatibility, this 283# in /usr/share/emacs/site-lisp/. For backwards compatibility, this
284# location is still supported when generating site-gentoo.el. 284# location is still supported when generating site-gentoo.el.
285 285
286elisp-site-regen() { 286elisp-site-regen() {
287 local i sf line firstrun obsolete 287 local i sf line obsolete
288 local -a sflist 288 local -a sflist
289 289
290 if [ ! -d "${ROOT}${SITELISP}" ]; then 290 if [ ! -d "${ROOT}${SITELISP}" ]; then
291 eerror "elisp-site-regen: Directory ${SITELISP} does not exist" 291 eerror "elisp-site-regen: Directory ${SITELISP} does not exist"
292 return 1 292 return 1
295 if [ ! -d "${T}" ]; then 295 if [ ! -d "${T}" ]; then
296 eerror "elisp-site-regen: Temporary directory ${T} does not exist" 296 eerror "elisp-site-regen: Temporary directory ${T} does not exist"
297 return 1 297 return 1
298 fi 298 fi
299 299
300 [ -e "${ROOT}${SITELISP}"/site-gentoo.el ] \
301 || [ "${PN}" = emacs-common-gentoo ] || firstrun=t
302
303 if [ "${firstrun}" ] && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then
304 einfo "Creating default site-start.el ..."
305 cat <<-EOF >"${T}"/site-start.el
306 ;;; site-start.el
307
308 ;;; Commentary:
309 ;; This default site startup file is installed by elisp-common.eclass.
310 ;; You may replace this file by your own site initialisation, or even
311 ;; remove it completely; it will not be recreated.
312
313 ;;; Code:
314 ;; Load site initialisation for Gentoo-installed packages.
315 (require 'site-gentoo)
316
317 ;;; site-start.el ends here
318 EOF
319 fi
320
321 einfon "Regenerating site-gentoo.el (${EBUILD_PHASE}) ..." 300 einfon "Regenerating site-gentoo.el for GNU Emacs (${EBUILD_PHASE}) ..."
322 301
323 # Until January 2009, elisp-common.eclass sometimes created an 302 # Until January 2009, elisp-common.eclass sometimes created an
324 # auxiliary file for backwards compatibility. Remove any such file. 303 # auxiliary file for backwards compatibility. Remove any such file.
325 rm -f "${ROOT}${SITELISP}"/00site-gentoo.el 304 rm -f "${ROOT}${SITELISP}"/00site-gentoo.el
326 305
371 # was actually no change. 350 # was actually no change.
372 # A case is a remerge where we have doubled output. 351 # A case is a remerge where we have doubled output.
373 echo " no changes." 352 echo " no changes."
374 else 353 else
375 mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el 354 mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el
376 [ -f "${T}"/site-start.el ] \
377 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \
378 && mv "${T}"/site-start.el "${ROOT}${SITELISP}"/site-start.el
379 echo 355 echo
380 einfo "... ${#sflist[@]} site initialisation file(s) included." 356 einfo "... ${#sflist[@]} site initialisation file(s) included."
381 fi
382
383 if [ "${firstrun}" ]; then
384 echo
385 while read line; do einfo "${line:- }"; done <<-EOF
386 All site initialisation for Gentoo-installed packages is added to
387 /usr/share/emacs/site-lisp/site-gentoo.el; site-start.el is not
388 managed by Gentoo. You are responsible for all maintenance of
389 site-start.el if there is such a file.
390
391 In order for this site initialisation to be loaded for all users
392 automatically, you can add a line like this:
393
394 (require 'site-gentoo)
395
396 to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line
397 can be added by individual users to their initialisation files, or,
398 for greater flexibility, users can load individual package-specific
399 initialisation files from /usr/share/emacs/site-lisp/site-gentoo.d/.
400 EOF
401 echo
402 fi 357 fi
403 358
404 if [ "${obsolete}" ]; then 359 if [ "${obsolete}" ]; then
405 echo 360 echo
406 while read line; do ewarn "${line}"; done <<-EOF 361 while read line; do ewarn "${line}"; done <<-EOF
410 Emacs packages. 365 Emacs packages.
411 EOF 366 EOF
412 fi 367 fi
413 368
414 # cleanup 369 # cleanup
415 rm -f "${T}"/site-{gentoo,start}.el 370 rm -f "${T}"/site-gentoo.el
416 371
417 return 0 372 return 0
418} 373}

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

  ViewVC Help
Powered by ViewVC 1.1.20