blob: 14164907ea3851dca83a3e9e2db6303683b9082a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/bash
# Copyright 2011-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 or later
# Authors:
# Christian Faulhammer <fauli@gentoo.org>
# Ulrich Müller <ulm@gentoo.org>
#
# Generate a raw list for app-emacs/gentoo-syntax
TMPFILE="$(mktemp ${TMPDIR:-/tmp}/keyword-generation.XXXXXX)"
ECLASSDIR="$(portageq portdir)/eclass"
ECLASSES=$(cd ${ECLASSDIR}; ls *.eclass)
# Obsolete eclasses or ones which contain no functions
OBSOLETE="bash-completion gems git gnome.org gnustep-2 java-mvn-src \
kde4-meta-pkg leechcraft mythtv obs-download qt4 ruby"
has() {
local needle=$1 item
shift
for item in "$@"; do
[[ ${item} = ${needle} ]] && return 0
done
return 1
}
echo "Output in ${TMPFILE}"
for eclass in ${ECLASSES}; do
has ${eclass%.eclass} ${OBSOLETE} && continue
grep -q "^# @DEAD$" "${ECLASSDIR}/${eclass}" && continue
functions=$(env -i bash -c \
". ${ECLASSDIR}/${eclass}; declare -F" 2>/dev/null \
| sed 's/.*[[:space:]]//;/^_/d;s/.*/"&"/')
{
echo "(defvar ebuild-mode-keywords-${eclass%.eclass}"
echo " '(("${functions}")"
echo " font-lock-type-face))"
echo
} >>"${TMPFILE}"
done
emacs -q --batch \
--visit "${TMPFILE}" \
--eval "(emacs-lisp-mode)" \
--eval "(indent-region (point-min) (point-max))" \
--eval "(let ((fill-column 78)
(fill-indent-according-to-mode t)
(paragraph-start \"^.\"))
(fill-region (point-min) (point-max)))" \
--eval "(save-buffer)" --kill
|