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

Contents of /eclass/elisp-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Sat Sep 17 01:02:40 2005 UTC (8 years, 10 months ago) by ciaranm
Branch: MAIN
Changes since 1.13: +2 -2 lines
fix utf-8

1 vapier 1.7 # Copyright 1999-2004 Gentoo Foundation
2 mkennedy 1.1 # Distributed under the terms of the GNU General Public License v2
3 ciaranm 1.14 # $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.13 2005/07/11 15:08:06 swegener Exp $
4 mkennedy 1.1 #
5 mkennedy 1.2 # Copyright 2002-2003 Matthew Kennedy <mkennedy@gentoo.org>
6     # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
7 mkennedy 1.1 #
8     # This is not an eclass, but it does provide emacs-related
9     # installation utilities.
10    
11    
12     SITELISP=/usr/share/emacs/site-lisp
13    
14 mkennedy 1.2 elisp-compile() {
15     /usr/bin/emacs --batch -f batch-byte-compile --no-site-file --no-init-file $*
16     }
17    
18 mkennedy 1.1 elisp-install() {
19     local subdir=$1
20     dodir ${SITELISP}/${subdir}
21     insinto ${SITELISP}/${subdir}
22     shift
23     doins $@
24     }
25    
26     elisp-site-file-install() {
27 usata 1.6 local sitefile=$1 my_pn=${2:-${PN}}
28 mkennedy 1.1 pushd ${S}
29 usata 1.6 cp ${sitefile} ${T}
30     sed -i "s:@SITELISP@:${SITELISP}/${my_pn}:g" ${T}/$(basename ${sitefile})
31 mkennedy 1.1 insinto ${SITELISP}
32 usata 1.10 doins ${T}/$(basename ${sitefile}) || die "failed to install site file"
33 mkennedy 1.1 popd
34     }
35    
36     elisp-site-regen() {
37 vapier 1.9 einfo "Regenerating ${SITELISP}/site-gentoo.el ..."
38 mkennedy 1.1 einfo ""
39 jbms 1.4 cat <<EOF >${SITELISP}/site-gentoo.el
40 mkennedy 1.1 ;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE
41     ;;; -----------------------------------------------------------------
42    
43     EOF
44 mkennedy 1.5 ls ${SITELISP}/[0-9][0-9]*-gentoo.el |sort -n | \
45     while read sf
46 mkennedy 1.1 do
47 vapier 1.9 einfo " Adding $(basename $sf) ..."
48 mkennedy 1.1 # Great for debugging, too noisy and slow for users though
49 vapier 1.9 # echo "(message \"Loading $sf ...\")" >>${SITELISP}/site-start.el
50 jbms 1.4 cat $sf >>${SITELISP}/site-gentoo.el
51 mkennedy 1.1 done
52 jbms 1.4 while read line; do einfo "${line}"; done <<EOF
53    
54     All site initialization for Gentoo-installed packages is now added to
55     /usr/share/emacs/site-lisp/site-gentoo.el; site-start.el is no longer
56 usata 1.8 managed by Gentoo. You are responsible for all maintenance of
57     site-start.el if there is such a file.
58 jbms 1.4
59     In order for this site initialization to be loaded for all users
60     automatically, as was done previously, you can add a line like this:
61    
62 mkennedy 1.5 (load "/usr/share/emacs/site-lisp/site-gentoo")
63 jbms 1.4
64     to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line
65     can be added by individual users to their initialization files, or for
66     greater flexibility, users can select which of the package-specific
67     initialization files in /usr/share/emacs/site-lisp to load.
68     EOF
69     echo
70 mkennedy 1.3 }
71    
72     # The following Emacs Lisp compilation routine is taken from GNU
73     # autotools.
74    
75     elisp-comp() {
76     # Copyright 1995 Free Software Foundation, Inc.
77 ciaranm 1.14 # Fran├žois Pinard <pinard@iro.umontreal.ca>, 1995.
78 mkennedy 1.3 #
79     # This program is free software; you can redistribute it and/or modify
80     # it under the terms of the GNU General Public License as published by
81     # the Free Software Foundation; either version 2, or (at your option)
82     # any later version.
83     #
84     # This program is distributed in the hope that it will be useful,
85     # but WITHOUT ANY WARRANTY; without even the implied warranty of
86 mkennedy 1.5 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87 mkennedy 1.3 # GNU General Public License for more details.
88     #
89     # You should have received a copy of the GNU General Public License
90     # along with this program; if not, write to the Free Software
91     # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
92    
93     # As a special exception to the GNU General Public License, if you
94     # distribute this file as part of a program that contains a
95     # configuration script generated by Autoconf, you may include it under
96     # the same distribution terms that you use for the rest of that program.
97    
98     # This script byte-compiles all `.el' files which are part of its
99     # arguments, using GNU Emacs, and put the resulting `.elc' files into
100     # the current directory, so disregarding the original directories used
101     # in `.el' arguments.
102     #
103     # This script manages in such a way that all Emacs LISP files to
104     # be compiled are made visible between themselves, in the event
105     # they require or load-library one another.
106    
107     if test $# = 0; then
108     echo 1>&2 "No files given to $0"
109     exit 1
110     else
111     if test -z "$EMACS" || test "$EMACS" = "t"; then
112 jbms 1.4 # Value of "t" means we are running in a shell under Emacs.
113     # Just assume Emacs is called "emacs".
114 mkennedy 1.3 EMACS=emacs
115     fi
116    
117     tempdir=elc.$$
118     mkdir $tempdir
119     cp $* $tempdir
120     cd $tempdir
121    
122     echo "(add-to-list 'load-path \"../\")" > script
123     $EMACS -batch -q --no-site-file --no-init-file -l script -f batch-byte-compile *.el
124     mv *.elc ..
125    
126     cd ..
127     rm -fr $tempdir
128     fi
129 mkennedy 1.1 }
130    
131     # Local Variables: ***
132     # mode: shell-script ***
133     # tab-width: 4 ***
134     # indent-tabs-mode: t ***
135     # End: ***

  ViewVC Help
Powered by ViewVC 1.1.20