1 |
ulm 09/04/08 10:47:43 |
2 |
|
3 |
Modified: elisp-common.eclass |
4 |
Log: |
5 |
Partial sync from Emacs overlay: |
6 |
In elisp-site-file-install, allow for extra version identifier in the |
7 |
name of the source file; output a warning if the file name doesn't match |
8 |
a valid pattern; automagically insert a header comment. |
9 |
|
10 |
Revision Changes Path |
11 |
1.59 eclass/elisp-common.eclass |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/elisp-common.eclass?rev=1.59&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/elisp-common.eclass?rev=1.59&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/elisp-common.eclass?r1=1.58&r2=1.59 |
16 |
|
17 |
Index: elisp-common.eclass |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v |
20 |
retrieving revision 1.58 |
21 |
retrieving revision 1.59 |
22 |
diff -u -r1.58 -r1.59 |
23 |
--- elisp-common.eclass 26 Mar 2009 14:14:22 -0000 1.58 |
24 |
+++ elisp-common.eclass 8 Apr 2009 10:47:42 -0000 1.59 |
25 |
@@ -1,6 +1,6 @@ |
26 |
# Copyright 1999-2009 Gentoo Foundation |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.58 2009/03/26 14:14:22 ulm Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.59 2009/04/08 10:47:42 ulm Exp $ |
30 |
# |
31 |
# Copyright 2002-2004 Matthew Kennedy <mkennedy@g.o> |
32 |
# Copyright 2003 Jeremy Maitin-Shepard <jbms@×××××.com> |
33 |
@@ -86,7 +86,7 @@ |
34 |
# settings. Give a hint in pkg_postinst(), which should be enough. |
35 |
# |
36 |
# The naming scheme for this site-init file matches the shell pattern |
37 |
-# "[1-8][0-9]*-gentoo.el", where the two digits at the beginning define |
38 |
+# "[1-8][0-9]*-gentoo*.el", where the two digits at the beginning define |
39 |
# the loading order (numbers below 10 or above 89 are reserved for |
40 |
# internal use). So if your initialisation depends on another Emacs |
41 |
# package, your site file's number must be higher! |
42 |
@@ -100,8 +100,11 @@ |
43 |
# |
44 |
# elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die |
45 |
# |
46 |
-# in src_install(). If your subdirectory is not named ${PN}, give the |
47 |
-# differing name as second argument. |
48 |
+# in src_install(). Any characters after the "-gentoo" part and before |
49 |
+# the extension will be stripped from the destination file's name. |
50 |
+# For example, a file "50${PN}-gentoo-${PV}.el" will be installed as |
51 |
+# "50${PN}-gentoo.el". If your subdirectory is not named ${PN}, give |
52 |
+# the differing name as second argument. |
53 |
# |
54 |
# .SS |
55 |
# pkg_postinst() / pkg_postrm() usage: |
56 |
@@ -243,13 +246,23 @@ |
57 |
# @FUNCTION: elisp-site-file-install |
58 |
# @USAGE: <site-init file> [subdirectory] |
59 |
# @DESCRIPTION: |
60 |
-# Install Emacs site-init file in SITELISP directory. |
61 |
+# Install Emacs site-init file in SITELISP directory. Automatically |
62 |
+# inserts a standard comment header with the name of the package (unless |
63 |
+# it is already present). Tokens @SITELISP@ and @SITEETC@ are replaced |
64 |
+# by the path to the package's subdirectory in SITELISP and SITEETC, |
65 |
+# respectively. |
66 |
|
67 |
elisp-site-file-install() { |
68 |
- local sf="${T}/${1##*/}" my_pn="${2:-${PN}}" ret |
69 |
+ local sf="${1##*/}" my_pn="${2:-${PN}}" ret |
70 |
+ local header=";;; ${PN} site-lisp configuration" |
71 |
+ |
72 |
+ [[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \ |
73 |
+ || ewarn "elisp-site-file-install: bad name of site-init file" |
74 |
+ sf="${T}/${sf/%-gentoo*.el/-gentoo.el}" |
75 |
ebegin "Installing site initialisation file for GNU Emacs" |
76 |
cp "$1" "${sf}" |
77 |
- sed -i -e "s:@SITELISP@:${SITELISP}/${my_pn}:g" \ |
78 |
+ sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \ |
79 |
+ -e "s:@SITELISP@:${SITELISP}/${my_pn}:g" \ |
80 |
-e "s:@SITEETC@:${SITEETC}/${my_pn}:g;\$q" "${sf}" |
81 |
( # subshell to avoid pollution of calling environment |
82 |
insinto "${SITELISP}/site-gentoo.d" |