/[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.28 Revision 1.29
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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.28 2007/09/22 20:25:30 ulm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.29 2007/10/14 22:12:30 ulm Exp $
4# 4#
5# Copyright 2007 Christian Faulhammer <opfer@gentoo.org> 5# Copyright 2007 Christian Faulhammer <opfer@gentoo.org>
6# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org> 6# Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org> 7# Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org>
8# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> 8# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
9# Copyright 2007 Ulrich Mueller <ulm@gentoo.org> 9# Copyright 2007 Ulrich Mueller <ulm@gentoo.org>
10# 10#
11# @ECLASS: elisp-common.eclass 11# @ECLASS: elisp-common.eclass
12# @MAINTAINER: 12# @MAINTAINER:
13# Feel free to contact the Emacs team through emacs@gentoo.org if you have 13# Feel free to contact the Emacs team through <emacs@gentoo.org> if you have
14# problems, suggestions or questions. 14# problems, suggestions or questions.
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 of 18# Usually you want to use this eclass for (optional) GNU Emacs support of
71# (add-to-list 'load-path "@SITELISP@") 71# (add-to-list 'load-path "@SITELISP@")
72# (add-to-list 'auto-mode-alist '("\\.csv\\'" . csv-mode)) 72# (add-to-list 'auto-mode-alist '("\\.csv\\'" . csv-mode))
73# (autoload 'csv-mode "csv-mode" "Major mode for csv files." t) 73# (autoload 'csv-mode "csv-mode" "Major mode for csv files." t)
74# 74#
75# If your Emacs support files are installed in a subdirectory of 75# If your Emacs support files are installed in a subdirectory of
76# /usr/share/emacs/site-lisp/ (which is recommended if more than one file is 76# /usr/share/emacs/site-lisp/ (which is recommended), you need to extend
77# installed), you need to extend Emacs' load-path as shown in the first 77# Emacs' load-path as shown in the first non-comment.
78# non-comment. The elisp-site-file-install() function of this eclass will 78# The elisp-site-file-install() function of this eclass will replace
79# replace "@SITELISP@" by the actual path. 79# "@SITELISP@" by the actual path.
80# 80#
81# The next line tells Emacs to load the mode opening a file ending with 81# The next line tells Emacs to load the mode opening a file ending with
82# ".csv" and load functions depending on the context and needed features. 82# ".csv" and load functions depending on the context and needed features.
83# Be careful though. Commands as "load-library" or "require" bloat the 83# Be careful though. Commands as "load-library" or "require" bloat the
84# editor as they are loaded on every startup. When having a lot of Emacs 84# editor as they are loaded on every startup. When having a lot of Emacs
95# 95#
96# SITEFILE=50${PN}-gentoo.el 96# SITEFILE=50${PN}-gentoo.el
97# 97#
98# Which is then installed by 98# Which is then installed by
99# 99#
100# elisp-site-file-install "${FILESDIR}/${SITEFILE}" 100# elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
101# 101#
102# in src_install(). If your subdirectory is not named ${PN}, give the 102# in src_install(). If your subdirectory is not named ${PN}, give the
103# differing name as second argument. 103# differing name as second argument.
104# 104#
105# .SS 105# .SS
125# .SS 125# .SS
126# Miscellaneous functions: 126# Miscellaneous functions:
127# 127#
128# elisp-emacs-version() outputs the version of the currently active Emacs. 128# elisp-emacs-version() outputs the version of the currently active Emacs.
129 129
130# @ECLASS-VARIABLE: SITELISP
131# @DESCRIPTION:
132# Directory where Emacs Lisp files are installed.
130SITELISP=/usr/share/emacs/site-lisp 133SITELISP=/usr/share/emacs/site-lisp
134
135# @ECLASS-VARIABLE: SITEFILE
136# @DESCRIPTION:
137# Name of package's site-init file.
131SITEFILE=50${PN}-gentoo.el 138SITEFILE=50${PN}-gentoo.el
139
132EMACS=/usr/bin/emacs 140EMACS=/usr/bin/emacs
133# The following works for Emacs versions 18-23, don't change it. 141# The following works for Emacs versions 18--23, don't change it.
134EMACS_BATCH_CLEAN="${EMACS} -batch -q --no-site-file" 142EMACS_BATCH_CLEAN="${EMACS} -batch -q --no-site-file"
135 143
136# @FUNCTION: elisp-compile 144# @FUNCTION: elisp-compile
137# @USAGE: <list of elisp files> 145# @USAGE: <list of elisp files>
138# @DESCRIPTION: 146# @DESCRIPTION:
156# @FUNCTION: elisp-make-autoload-file 164# @FUNCTION: elisp-make-autoload-file
157# @USAGE: [output file] [list of directories] 165# @USAGE: [output file] [list of directories]
158# @DESCRIPTION: 166# @DESCRIPTION:
159# Generate a file with autoload definitions for the lisp functions. 167# Generate a file with autoload definitions for the lisp functions.
160 168
161elisp-make-autoload-file () { 169elisp-make-autoload-file() {
162 local f="${1:-${PN}-autoloads.el}" 170 local f="${1:-${PN}-autoloads.el}"
163 shift 171 shift
164 einfo "Generating autoload file for GNU Emacs ..." 172 einfo "Generating autoload file for GNU Emacs ..."
165 173
166 sed 's/^FF/\f/' >"${f}" <<-EOF 174 sed 's/^FF/\f/' >"${f}" <<-EOF
222# Regenerate site-gentoo.el file. 230# Regenerate site-gentoo.el file.
223 231
224elisp-site-regen() { 232elisp-site-regen() {
225 local sflist sf line 233 local sflist sf line
226 234
235 if [ ! -e "${ROOT}${SITELISP}"/site-gentoo.el ] \
236 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ]; then
237 einfo "Creating default ${SITELISP}/site-start.el ..."
238 cat <<-EOF >"${T}"/site-start.el
239 ;;; site-start.el
240
241 ;;; Commentary:
242 ;; This default site startup file is installed by elisp-common.eclass.
243 ;; You may replace this file by your own site initialisation, or even
244 ;; remove it completely; it will not be recreated.
245
246 ;;; Code:
247 ;; Load site initialisation for Gentoo-installed packages.
248 (require 'site-gentoo)
249
250 ;;; site-start.el ends here
251 EOF
252 fi
253
227 einfon "Regenerating ${SITELISP}/site-gentoo.el ..." 254 einfon "Regenerating ${SITELISP}/site-gentoo.el ..."
228 cat <<-EOF >"${T}"/site-gentoo.el 255 cat <<-EOF >"${T}"/site-gentoo.el
229 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages 256 ;;; site-gentoo.el --- site initialisation for Gentoo-installed packages
230 257
231 ;;; Commentary: 258 ;;; Commentary:
252 ;;; site-gentoo.el ends here 279 ;;; site-gentoo.el ends here
253 EOF 280 EOF
254 281
255 if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${T}"/site-gentoo.el; then 282 if cmp -s "${ROOT}${SITELISP}"/site-gentoo.el "${T}"/site-gentoo.el; then
256 # This prevents outputting unnecessary text when there 283 # This prevents outputting unnecessary text when there
257 # was actually no change 284 # was actually no change.
258 # A case is a remerge where we have doubled output 285 # A case is a remerge where we have doubled output.
259 echo " no changes." 286 echo " no changes."
260 else 287 else
261 mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el 288 mv "${T}"/site-gentoo.el "${ROOT}${SITELISP}"/site-gentoo.el
289 [ -f "${T}"/site-start.el ] \
290 && [ ! -e "${ROOT}${SITELISP}"/site-start.el ] \
291 && mv "${T}"/site-start.el "${ROOT}${SITELISP}"/site-start.el
262 echo; einfo 292 echo; einfo
263 for sf in ${sflist}; do 293 for sf in ${sflist}; do
264 einfo " Adding ${sf} ..." 294 einfo " Adding ${sf} ..."
265 done 295 done
266 while read line; do einfo "${line}"; done <<EOF 296 while read line; do einfo "${line}"; done <<EOF
271site-start.el if there is such a file. 301site-start.el if there is such a file.
272 302
273In order for this site initialisation to be loaded for all users 303In order for this site initialisation to be loaded for all users
274automatically, you can add a line like this: 304automatically, you can add a line like this:
275 305
276 (load "/usr/share/emacs/site-lisp/site-gentoo" nil t) 306 (require 'site-gentoo)
277 307
278to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line 308to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line
279can be added by individual users to their initialisation files, or for 309can be added by individual users to their initialisation files, or for
280greater flexibility, users can select which of the package-specific 310greater flexibility, users can select which of the package-specific
281initialisation files in /usr/share/emacs/site-lisp/ to load. 311initialisation files in /usr/share/emacs/site-lisp/ to load.

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.20