blob: c126f7a22d6afa0af9b9f0cd54c2911d144ebe2d (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
;;; company-ebuild-keywords.el --- Company-Ebuild keywords -*- lexical-binding: t -*-
;; Copyright 2022 Gentoo Authors
;; This file is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 2 of the License, or
;; (at your option) any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Company-Ebuild keywords. Boilerplate. ;^)
;;; Code:
(require 'ebuild-mode)
(require 'ebuild-mode-keywords)
;; Keywords from ebuild-mode font lock.
(defconst company-ebuild--constant-keywords-architectures
ebuild-mode-arch-list)
(defconst company-ebuild--constant-keywords-restrict
ebuild-mode-restrict-list)
(defconst company-ebuild--constant-keywords-phases
(car ebuild-mode-keywords-functions))
(defconst company-ebuild--constant-keywords-sandbox
(car ebuild-mode-keywords-sandbox))
(defconst company-ebuild--constant-keywords-doc
(append (car ebuild-mode-keywords-eclass-documentation)
(car ebuild-mode-keywords-eclassdoc-warn)))
(defconst company-ebuild--constant-keywords-functions
(append (car (car ebuild-mode-keywords-eclass))
(car ebuild-mode-keywords-0)))
;; See: https://devmanual.gentoo.org/ebuild-writing/variables/
(defconst company-ebuild--constant-keywords-variables-predefined
'("P"
"PN"
"PV"
"PR"
"PVR"
"PF"
"A"
"CATEGORY"
"FILESDIR"
"WORKDIR"
"T"
"D"
"HOME"
"ROOT"
"DISTDIR"
"EPREFIX"
"ED"
"EROOT"
"SYSROOT"
"ESYSROOT"
"BROOT"
"MERGE_TYPE"
"REPLACING_VERSIONS"
"REPLACED_BY_VERSION"))
(defconst company-ebuild--constant-keywords-variables-ebuild-defined
'("EAPI"
"DESCRIPTION"
"HOMEPAGE"
"SRC_URI"
"LICENSE"
"SLOT"
"KEYWORDS"
"IUSE"
"REQUIRED_USE"
"PROPERTIES"
"RESTRICT"
"S"
"DOCS"
"HTML_DOCS"))
(defconst company-ebuild--constant-keywords-variables-dependencies
'("DEPEND"
"BDEPEND"
"RDEPEND"
"PDEPEND"))
(defconst company-ebuild--constant-keywords-variables-user-environment
'("AR"
"ARFLAGS"
"AS"
"ASFLAGS"
"CC"
"CFLAGS"
"CPPFLAGS"
"CXX"
"CXXFLAGS"
"LD"
"LDFLAGS"
"LEX"
"LFLAGS"
"NM"
"RANLIB"
"YACC"
"YFLAGS"))
(defconst company-ebuild--constant-keywords
(append company-ebuild--constant-keywords-architectures
company-ebuild--constant-keywords-restrict
company-ebuild--constant-keywords-phases
company-ebuild--constant-keywords-sandbox
company-ebuild--constant-keywords-doc
company-ebuild--constant-keywords-functions
company-ebuild--constant-keywords-variables-predefined
company-ebuild--constant-keywords-variables-ebuild-defined
company-ebuild--constant-keywords-variables-dependencies
company-ebuild--constant-keywords-variables-user-environment))
;; Dynamically collected keywords.
(defvar company-ebuild--dynamic-keywords-eclasses nil)
(make-variable-buffer-local 'company-ebuild--dynamic-keywords-eclasses)
(defvar company-ebuild--dynamic-keywords-functions nil)
(make-variable-buffer-local 'company-ebuild--dynamic-keywords-functions)
(defvar company-ebuild--dynamic-keywords-licenses nil)
(make-variable-buffer-local 'company-ebuild--dynamic-keywords-licenses)
(defvar company-ebuild--dynamic-keywords-packages nil)
;; ‘company-ebuild--dynamic-keywords-packages’ is left global.
(defvar company-ebuild--dynamic-keywords-use-flags nil)
(make-variable-buffer-local 'company-ebuild--dynamic-keywords-use-flags)
(defvar company-ebuild--dynamic-keywords-variables nil)
(make-variable-buffer-local 'company-ebuild--dynamic-keywords-variables)
(defun company-ebuild--dynamic-keywords ()
"Return a list of all dynamic Ebuild keywords."
(append company-ebuild--dynamic-keywords-eclasses
company-ebuild--dynamic-keywords-functions
company-ebuild--dynamic-keywords-variables
company-ebuild--dynamic-keywords-use-flags
company-ebuild--dynamic-keywords-packages
company-ebuild--dynamic-keywords-licenses))
(defun company-ebuild--executables (arg)
"Return a list of available executables matching ARG on current system."
(locate-file-completion-table exec-path exec-suffixes arg 'identity t))
(provide 'company-ebuild-keywords)
;;; company-ebuild-keywords.el ends here
|