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.16 2007/04/16 15:41:02 opfer Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.17 2007/04/18 10:45:44 opfer 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 | # |
… | |
… | |
114 | elisp-compile() { |
114 | elisp-compile() { |
115 | /usr/bin/emacs --batch -f batch-byte-compile --no-site-file --no-init-file $* |
115 | /usr/bin/emacs --batch -f batch-byte-compile --no-site-file --no-init-file $* |
116 | } |
116 | } |
117 | |
117 | |
118 | elisp-make-autoload-file () { |
118 | elisp-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 | echo >"${f}" |
122 | emacs --batch -q --no-site-file \ |
122 | emacs --batch -q --no-site-file \ |
123 | --eval "(setq make-backup-files nil)" \ |
123 | --eval "(setq make-backup-files nil)" \ |
124 | --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \ |
124 | --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \ |