/[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.17 Revision 1.21
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.17 2007/04/18 10:45:44 opfer Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.21 2007/05/26 08:34:08 ulm Exp $
4# 4#
5# Copyright 2007 Christian Faulhammer <opfer@gentoo.org> 5# Copyright 2007 Christian Faulhammer <opfer@gentoo.org>
6# Copyright 2002-2007 Matthew Kennedy <mkennedy@gentoo.org> 6# Copyright 2002-2007 Matthew Kennedy <mkennedy@gentoo.org>
7# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> 7# Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
8# Copyright 2007 Ulrich Mueller <ulm@gentoo.org> 8# Copyright 2007 Ulrich Mueller <ulm@gentoo.org>
11# utilities. 11# utilities.
12# 12#
13# USAGE: 13# USAGE:
14# 14#
15# Usually you want to use this eclass for (optional) GNU Emacs support of 15# Usually you want to use this eclass for (optional) GNU Emacs support of
16# your package. This is NOT for XEmacs! 16# your package. This is NOT for XEmacs!
17# Many of the steps here are sometimes done by the build system of your 17# Many of the steps here are sometimes done by the build system of your
18# package (especially compilation), so this is mainly for standalone elisp 18# package (especially compilation), so this is mainly for standalone elisp
19# files you gathered from somewhere else. 19# files you gathered from somewhere else.
20# When relying on the emacs USE flag, you need to add 20# When relying on the emacs USE flag, you need to add
21# 21#
35# elisp-compile *.el || die "elisp-compile failed!" 35# elisp-compile *.el || die "elisp-compile failed!"
36# or 36# or
37# elisp-comp *.el || die "elisp-comp failed!" 37# elisp-comp *.el || die "elisp-comp failed!"
38# 38#
39# Function elisp-make-autoload-file() can be used to generate a file with 39# Function elisp-make-autoload-file() can be used to generate a file with
40# autoload definitions for the lisp functions. It takes the output file name 40# autoload definitions for the lisp functions. It takes the output file name
41# (default: "${PN}-autoloads.el") and a list of directories (default: working 41# (default: "${PN}-autoloads.el") and a list of directories (default: working
42# directory) as its arguments. Use of this function requires that the elisp 42# directory) as its arguments. Use of this function requires that the elisp
43# source files contain magic ";;;###autoload" comments. See the Emacs Lisp 43# source files contain magic ";;;###autoload" comments. See the Emacs Lisp
44# Reference Manual (node "Autoload") for a detailed explanation. 44# Reference Manual (node "Autoload") for a detailed explanation.
45# 45#
46# src_install() usage: 46# src_install() usage:
47# -------------------- 47# --------------------
55# 55#
56# elisp-install ${PN} *.elc *.el || die "elisp-install failed!" 56# elisp-install ${PN} *.elc *.el || die "elisp-install failed!"
57# 57#
58# To let the Emacs support be activated by Emacs on startup, you need 58# To let the Emacs support be activated by Emacs on startup, you need
59# to provide a site file (shipped in ${FILESDIR}) which contains the startup 59# to provide a site file (shipped in ${FILESDIR}) which contains the startup
60# code (have a look in the documentation of your software). Normally this 60# code (have a look in the documentation of your software). Normally this
61# would look like this: 61# would look like this:
62# 62#
63# ;;; csv-mode site-lisp configuration 63# ;;; csv-mode site-lisp configuration
64# 64#
65# (add-to-list 'load-path "@SITELISP@") 65# (add-to-list 'load-path "@SITELISP@")
67# (autoload 'csv-mode "csv-mode" "Major mode for editing csv files." t) 67# (autoload 'csv-mode "csv-mode" "Major mode for editing csv files." t)
68# 68#
69# If your Emacs support files are installed in a subdirectory of 69# If your Emacs support files are installed in a subdirectory of
70# /usr/share/emacs/site-lisp/ (which is recommended if more than one file is 70# /usr/share/emacs/site-lisp/ (which is recommended if more than one file is
71# installed), you need to extend Emacs' load-path as shown in the first 71# installed), you need to extend Emacs' load-path as shown in the first
72# non-comment. The elisp-site-file-install() function of this eclass will 72# non-comment. The elisp-site-file-install() function of this eclass will
73# replace "@SITELISP@" by the actual path. 73# replace "@SITELISP@" by the actual path.
74# The next line tells Emacs to load the mode opening a file ending with 74# The next line tells Emacs to load the mode opening a file ending with
75# ".csv" and load functions depending on the context and needed features. 75# ".csv" and load functions depending on the context and needed features.
76# Be careful though. Commands as "load-library" or "require" bloat the 76# Be careful though. Commands as "load-library" or "require" bloat the
77# editor as they are loaded on every startup. When having a lot of Emacs 77# editor as they are loaded on every startup. When having a lot of Emacs
78# support files, users may be annoyed by the start-up time. Also avoid 78# support files, users may be annoyed by the start-up time. Also avoid
79# keybindings as they might interfere with the user's settings. Give a hint 79# keybindings as they might interfere with the user's settings. Give a hint
80# in pkg_postinst(), which should be enough. 80# in pkg_postinst(), which should be enough.
81# The naming scheme for this site file is "[0-9][0-9]*-gentoo.el", where the 81# The naming scheme for this site file is "[0-9][0-9]*-gentoo.el", where the
82# two digits at the beginning define the loading order. So if you depend on 82# two digits at the beginning define the loading order. So if you depend on
83# another Emacs package, your site file's number must be higher! 83# another Emacs package, your site file's number must be higher!
84# Best practice is to define a SITEFILE variable in the global scope of your 84# Best practice is to define a SITEFILE variable in the global scope of your
85# ebuild (right after DEPEND e.g.): 85# ebuild (right after DEPEND e.g.):
86# 86#
87# SITEFILE=50${PN}-gentoo.el 87# SITEFILE=50${PN}-gentoo.el
88# 88#
89# Which is then installed by 89# Which is then installed by
90# 90#
91# elisp-site-file-install "${FILESDIR}/${SITEFILE}" 91# elisp-site-file-install "${FILESDIR}/${SITEFILE}"
92# 92#
93# in src_install(). If your subdirectory is not named ${PN}, give the 93# in src_install(). If your subdirectory is not named ${PN}, give the
94# differing name as second argument. 94# differing name as second argument.
95# 95#
96# pkg_postinst() / pkg_postrm() usage: 96# pkg_postinst() / pkg_postrm() usage:
97# ------------------------------------ 97# ------------------------------------
98# 98#
116} 116}
117 117
118elisp-make-autoload-file () { 118elisp-make-autoload-file () {
119 local f="${1:-${PN}-autoloads.el}" 119 local f="${1:-${PN}-autoloads.el}"
120 shift 120 shift
121 echo >"${f}" 121 sed 's/^FF/\f/' >"${f}" <<-EOF
122 ;;; ${f##*/} --- autoloads for ${P}
123
124 ;;; Commentary:
125 ;; Automatically generated by elisp-common.eclass
126 ;; DO NOT EDIT THIS FILE
127
128 ;;; Code:
129 FF
130 ;; Local Variables:
131 ;; version-control: never
132 ;; no-byte-compile: t
133 ;; no-update-autoloads: t
134 ;; End:
135 ;;; ${f##*/} ends here
136 EOF
122 emacs --batch -q --no-site-file \ 137 emacs --batch -q --no-site-file \
123 --eval "(setq make-backup-files nil)" \ 138 --eval "(setq make-backup-files nil)" \
124 --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \ 139 --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \
125 -f batch-update-autoloads "${@-.}" 140 -f batch-update-autoloads "${@-.}"
126} 141}
149 cat <<EOF >${ROOT}${SITELISP}/site-gentoo.el 164 cat <<EOF >${ROOT}${SITELISP}/site-gentoo.el
150;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE 165;;; DO NOT EDIT THIS FILE -- IT IS GENERATED AUTOMATICALLY BY PORTAGE
151;;; ----------------------------------------------------------------- 166;;; -----------------------------------------------------------------
152 167
153EOF 168EOF
154 ls ${ROOT}${SITELISP}/[0-9][0-9]*-gentoo.el | sort -n | \ 169 for sf in ${ROOT}${SITELISP}/[0-9][0-9]*-gentoo.el
155 while read sf
156 do 170 do
171 [ -r "${sf}" ] || continue
157 einfo " Adding $(basename $sf) ..." 172 einfo " Adding $(basename ${sf}) ..."
158 # Great for debugging, too noisy and slow for users though
159# echo "(message \"Loading $sf ...\")" >>${ROOT}${SITELISP}/site-start.el
160 cat $sf >>${ROOT}${SITELISP}/site-gentoo.el 173 cat "${sf}" >>${ROOT}${SITELISP}/site-gentoo.el
161 done 174 done
162 while read line; do einfo "${line}"; done <<EOF 175 while read line; do einfo "${line}"; done <<EOF
163 176
164All site initialization for Gentoo-installed packages is now added to 177All site initialization for Gentoo-installed packages is now added to
165/usr/share/emacs/site-lisp/site-gentoo.el; site-start.el is no longer 178/usr/share/emacs/site-lisp/site-gentoo.el; site-start.el is no longer
167site-start.el if there is such a file. 180site-start.el if there is such a file.
168 181
169In order for this site initialization to be loaded for all users 182In order for this site initialization to be loaded for all users
170automatically, as was done previously, you can add a line like this: 183automatically, as was done previously, you can add a line like this:
171 184
172 (load "/usr/share/emacs/site-lisp/site-gentoo") 185 (load "/usr/share/emacs/site-lisp/site-gentoo" nil t)
173 186
174to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line 187to /usr/share/emacs/site-lisp/site-start.el. Alternatively, that line
175can be added by individual users to their initialization files, or for 188can be added by individual users to their initialization files, or for
176greater flexibility, users can select which of the package-specific 189greater flexibility, users can select which of the package-specific
177initialization files in /usr/share/emacs/site-lisp to load. 190initialization files in /usr/share/emacs/site-lisp to load.

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20