Mercurial > emacs
annotate lisp/pcmpl-rpm.el @ 52242:f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
author | Alex Schroeder <alex@gnu.org> |
---|---|
date | Mon, 18 Aug 2003 17:29:23 +0000 |
parents | 67b464da13ec |
children | 695cf19ef79e d7ddb3e565de |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
29959
diff
changeset
|
1 ;;; pcmpl-rpm.el --- functions for dealing with rpm completions |
29959 | 2 |
3 ;; Copyright (C) 1999, 2000 Free Software Foundation | |
4 | |
5 ;; This file is part of GNU Emacs. | |
6 | |
7 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;; it under the terms of the GNU General Public License as published by | |
9 ;; the Free Software Foundation; either version 2, or (at your option) | |
10 ;; any later version. | |
11 | |
12 ;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;; GNU General Public License for more details. | |
16 | |
17 ;; You should have received a copy of the GNU General Public License | |
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 ;; Boston, MA 02111-1307, USA. | |
21 | |
22 ;;; Commentary: | |
23 | |
24 ;; These functions provide completion rules for RedHat's `rpm' tool. | |
25 | |
26 ;;; Code: | |
27 | |
28 (provide 'pcmpl-rpm) | |
29 | |
30 (require 'pcomplete) | |
31 | |
32 (defgroup pcmpl-rpm nil | |
33 "Functions for dealing with CVS completions" | |
34 :group 'pcomplete) | |
35 | |
36 ;; Functions: | |
37 | |
38 (defsubst pcmpl-rpm-packages () | |
39 (split-string (pcomplete-process-result "rpm" "-q" "-a"))) | |
40 | |
41 (defun pcmpl-rpm-all-query (flag) | |
42 (message "Querying all packages with `%s'..." flag) | |
43 (let ((pkgs (pcmpl-rpm-packages)) | |
44 (provs (list t))) | |
45 (while pkgs | |
46 (nconc provs (split-string | |
47 (pcomplete-process-result | |
48 "rpm" "-q" (car pkgs) flag))) | |
49 (setq pkgs (cdr pkgs))) | |
50 (pcomplete-uniqify-list (cdr provs)))) | |
51 | |
52 (defsubst pcmpl-rpm-files () | |
53 (pcomplete-dirs-or-entries "\\.rpm\\'")) | |
54 | |
55 ;;;###autoload | |
56 (defun pcomplete/rpm () | |
57 "Completion for RedHat's `rpm' command. | |
58 These rules were taken from the output of `rpm --help' on a RedHat 6.1 | |
59 system. They follow my interpretation of what followed, but since I'm | |
60 not a major rpm user/builder, please send me any corrections you find. | |
61 You can use \\[eshell-report-bug] to do so." | |
62 (let (mode) | |
63 (while (<= pcomplete-index pcomplete-last) | |
64 (unless mode | |
65 (if (pcomplete-match "^--\\(.*\\)" 0) | |
66 (pcomplete-here* | |
67 '("--addsign" | |
68 "--checksig" | |
69 "--erase" | |
70 "--help" | |
71 "--initdb" | |
72 "--install" | |
73 "--pipe" | |
74 "--querytags" | |
75 "--rebuild" | |
76 "--rebuilddb" | |
77 "--recompile" | |
78 "--resign" | |
79 "--rmsource" | |
80 "--setperms" | |
81 "--setugids" | |
82 "--upgrade" | |
83 "--verify" | |
84 "--version")) | |
85 (pcomplete-opt "vqVyiUebtK"))) | |
86 ; -b<stage> <spec> | |
87 ; -t<stage> <tarball> - build package, where <stage> is one of: | |
88 ; p - prep (unpack sources and apply patches) | |
89 ; l - list check (do some cursory checks on %files) | |
90 ; c - compile (prep and compile) | |
91 ; i - install (prep, compile, install) | |
92 ; b - binary package (prep, compile, install, package) | |
93 ; a - bin/src package (prep, compile, install, package) | |
94 (cond | |
95 ((or (eq mode 'query) | |
96 (pcomplete-match "-[^-]*q")) | |
97 (setq mode 'query) | |
98 (if (pcomplete-match "^--\\(.*\\)" 0) | |
99 (progn | |
100 (pcomplete-here* | |
101 '("--changelog" | |
102 "--dbpath" | |
103 "--dump" | |
104 "--ftpport" ;nyi for the next four | |
105 "--ftpproxy" | |
106 "--httpport" | |
107 "--httpproxy" | |
108 "--provides" | |
109 "--queryformat" | |
110 "--rcfile" | |
111 "--requires" | |
112 "--root" | |
113 "--scripts" | |
114 "--triggeredby" | |
115 "--whatprovides" | |
116 "--whatrequires")) | |
117 (cond | |
118 ((pcomplete-test "--dbpath") | |
119 (pcomplete-here* (pcomplete-dirs))) | |
120 ((pcomplete-test "--queryformat") | |
121 (pcomplete-here*)) | |
122 ((pcomplete-test "--rcfile") | |
123 (pcomplete-here* (pcomplete-entries))) | |
124 ((pcomplete-test "--root") | |
125 (pcomplete-here* (pcomplete-dirs))) | |
126 ((pcomplete-test "--scripts") | |
127 (if (pcomplete-match "^--\\(.*\\)" 0) | |
128 (pcomplete-here* '("--triggers")))) | |
129 ((pcomplete-test "--triggeredby") | |
130 (pcomplete-here* (pcmpl-rpm-packages))) | |
131 ((pcomplete-test "--whatprovides") | |
132 (pcomplete-here* | |
133 (pcmpl-rpm-all-query "--provides"))) | |
134 ((pcomplete-test "--whatrequires") | |
135 (pcomplete-here* | |
136 (pcmpl-rpm-all-query "--requires"))))) | |
137 (if (pcomplete-match "^-" 0) | |
138 (pcomplete-opt "af.p(pcmpl-rpm-files)ilsdcvR") | |
139 (pcomplete-here (pcmpl-rpm-packages))))) | |
140 ((pcomplete-test "--pipe") | |
141 (pcomplete-here* (funcall pcomplete-command-completion-function))) | |
142 ((pcomplete-test "--rmsource") | |
143 (pcomplete-here* (pcomplete-entries)) | |
144 (throw 'pcomplete-completions nil)) | |
145 ((pcomplete-match "\\`--re\\(build\\|compile\\)\\'") | |
146 (pcomplete-here (pcmpl-rpm-files)) | |
147 (throw 'pcomplete-completions nil)) | |
148 ((pcomplete-match "\\`--\\(resign\\|addsign\\)\\'") | |
149 (while (pcomplete-here (pcmpl-rpm-files)))) | |
150 ((or (eq mode 'checksig) | |
151 (pcomplete-test "--checksig")) | |
152 (setq mode 'checksig) | |
153 (if (pcomplete-match "^--\\(.*\\)" 0) | |
154 (progn | |
155 (pcomplete-here* | |
156 '("--nopgp" | |
157 "--nogpg" | |
158 "--nomd5" | |
159 "--rcfile")) | |
160 (cond | |
161 ((pcomplete-test "--rcfile") | |
162 (pcomplete-here* (pcomplete-entries))))) | |
163 (if (pcomplete-match "^-" 0) | |
164 (pcomplete-opt "v") | |
165 (pcomplete-here (pcmpl-rpm-files))))) | |
166 ((or (eq mode 'rebuilddb) | |
167 (pcomplete-test "--rebuilddb")) | |
168 (setq mode 'rebuilddb) | |
169 (if (pcomplete-match "^--\\(.*\\)" 0) | |
170 (progn | |
171 (pcomplete-here* | |
172 '("--dbpath" | |
173 "--root" | |
174 "--rcfile")) | |
175 (cond | |
176 ((pcomplete-test "--dbpath") | |
177 (pcomplete-here* (pcomplete-dirs))) | |
178 ((pcomplete-test "--root") | |
179 (pcomplete-here* (pcomplete-dirs))) | |
180 ((pcomplete-test "--rcfile") | |
181 (pcomplete-here* (pcomplete-entries))))) | |
182 (if (pcomplete-match "^-" 0) | |
183 (pcomplete-opt "v") | |
184 (pcomplete-here)))) | |
185 ((memq mode '(install upgrade)) | |
186 (if (pcomplete-match "^--\\(.*\\)" 0) | |
187 (progn | |
188 (pcomplete-here* | |
189 (append | |
190 '("--allfiles" | |
191 "--badreloc" | |
192 "--dbpath" | |
193 "--excludedocs" | |
194 "--excludepath" | |
195 "--force" | |
196 "--hash" | |
197 "--ignorearch" | |
198 "--ignoreos" | |
199 "--ignoresize" | |
200 "--includedocs" | |
201 "--justdb" | |
202 "--nodeps" | |
203 "--noorder" | |
204 "--noscripts" | |
205 "--notriggers") | |
206 (if (eq mode 'upgrade) | |
207 '("--oldpackage")) | |
208 '("--percent" | |
209 "--prefix" | |
210 "--rcfile" | |
211 "--relocate" | |
212 "--replacefiles" | |
213 "--replacepkgs" | |
214 "--root"))) | |
215 (cond | |
216 ((pcomplete-test "--dbpath") | |
217 (pcomplete-here* (pcomplete-dirs))) | |
218 ((pcomplete-test "--relocate") | |
219 (pcomplete-here*)) | |
220 ((pcomplete-test "--rcfile") | |
221 (pcomplete-here* (pcomplete-entries))) | |
222 ((pcomplete-test "--excludepath") | |
223 (pcomplete-here* (pcomplete-entries))) | |
224 ((pcomplete-test "--root") | |
225 (pcomplete-here* (pcomplete-dirs))) | |
226 ((pcomplete-test "--prefix") | |
227 (pcomplete-here* (pcomplete-dirs))))) | |
228 (if (pcomplete-match "^-" 0) | |
229 (pcomplete-opt "vh") | |
230 (pcomplete-here (pcmpl-rpm-files))))) | |
231 ((or (pcomplete-test "--install") | |
232 (pcomplete-match "-[^-]*i")) | |
233 (setq mode 'install)) | |
234 ((or (pcomplete-test "--upgrade") | |
235 (pcomplete-match "-[^-]*U")) | |
236 (setq mode 'upgrade)) | |
237 ((or (eq mode 'erase) | |
238 (pcomplete-test "--erase") | |
239 (pcomplete-match "-[^-]*e")) | |
240 (setq mode 'erase) | |
241 (if (pcomplete-match "^--\\(.*\\)" 0) | |
242 (progn | |
243 (pcomplete-here* | |
244 '("--allmatches" | |
245 "--dbpath" | |
246 "--justdb" | |
247 "--nodeps" | |
248 "--noorder" | |
249 "--noscripts" | |
250 "--notriggers" | |
251 "--rcfile" | |
252 "--root")) | |
253 (cond | |
254 ((pcomplete-test "--dbpath") | |
255 (pcomplete-here* (pcomplete-dirs))) | |
256 ((pcomplete-test "--rcfile") | |
257 (pcomplete-here* (pcomplete-entries))) | |
258 ((pcomplete-test "--root") | |
259 (pcomplete-here* (pcomplete-dirs))))) | |
260 (if (pcomplete-match "^-" 0) | |
261 (pcomplete-opt "v") | |
262 (pcomplete-here (pcmpl-rpm-packages))))) | |
263 ((or (eq mode 'verify) | |
264 (pcomplete-test "--verify")) | |
265 (setq mode 'verify) | |
266 (if (pcomplete-match "^--\\(.*\\)" 0) | |
267 (progn | |
268 (pcomplete-here* | |
269 '("--dbpath" | |
270 "--nodeps" | |
271 "--nofiles" | |
272 "--nomd5" | |
273 "--rcfile" | |
274 "--root" | |
275 "--triggeredby" | |
276 "--whatprovides" | |
277 "--whatrequires")) | |
278 (cond | |
279 ((pcomplete-test "--dbpath") | |
280 (pcomplete-here* (pcomplete-dirs))) | |
281 ((pcomplete-test "--rcfile") | |
282 (pcomplete-here* (pcomplete-entries))) | |
283 ((pcomplete-test "--root") | |
284 (pcomplete-here* (pcomplete-dirs))) | |
285 ((pcomplete-test "--triggeredby") | |
286 (pcomplete-here* (pcmpl-rpm-packages))) | |
287 ((pcomplete-test "--whatprovides") | |
288 (pcomplete-here* | |
289 (pcmpl-rpm-all-query "--provides"))) | |
290 ((pcomplete-test "--whatrequires") | |
291 (pcomplete-here* | |
292 (pcmpl-rpm-all-query "--requires"))))) | |
293 (if (pcomplete-match "^-" 0) | |
294 (pcomplete-opt "af.p(pcmpl-rpm-files)v") | |
295 (pcomplete-here (pcmpl-rpm-packages))))) | |
296 ((or (memq mode '(build test)) | |
297 (pcomplete-match "\\`-[bt]")) | |
298 (setq mode (if (pcomplete-match "\\`-b") | |
299 'build | |
300 'test)) | |
301 (if (pcomplete-match "^--\\(.*\\)" 0) | |
302 (progn | |
303 (pcomplete-here* | |
304 '("--buildroot" | |
305 "--clean" | |
306 "--nobuild" | |
307 "--rcfile" | |
308 "--rmsource" | |
309 "--short-circuit" | |
310 "--sign" | |
311 "--target" | |
312 "--timecheck")) | |
313 (cond | |
314 ((pcomplete-test "--buildroot") | |
315 (pcomplete-here* (pcomplete-dirs))) | |
316 ((pcomplete-test "--rcfile") | |
317 (pcomplete-here* (pcomplete-entries))) | |
318 ((pcomplete-test "--timecheck") | |
319 (pcomplete-here*)))) | |
320 (if (pcomplete-match "^-" 0) | |
321 (pcomplete-opt "v") | |
322 (pcomplete-here | |
323 (if (eq mode 'test) | |
324 (pcomplete-dirs-or-entries "\\.tar\\'") | |
325 (pcomplete-dirs-or-entries "\\.spec\\'")))))) | |
326 (t | |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
29959
diff
changeset
|
327 (error "You must select a mode: -q, -i, -U, --verify, etc")))))) |
29959 | 328 |
329 ;;; pcmpl-rpm.el ends here |