annotate lisp/pcmpl-gnu.el @ 52300:2672198e6a12

(vc-ignore-vc-files, vc-master-templates): Better explain obsolescence, and what to use instead.
author André Spiegel <spiegel@gnu.org>
date Sat, 23 Aug 2003 10:06:29 +0000
parents 67b464da13ec
children 695cf19ef79e d7ddb3e565de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 31241
diff changeset
1 ;;; pcmpl-gnu.el --- completions for GNU project tools
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1999, 2000 Free Software Foundation
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; This file is part of GNU Emacs.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; the Free Software Foundation; either version 2, or (at your option)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; any later version.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU General Public License for more details.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; Boston, MA 02111-1307, USA.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 31241
diff changeset
22 ;;; Commentary:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 31241
diff changeset
23
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;;; Code:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 (provide 'pcmpl-gnu)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 (require 'pcomplete)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 (require 'pcmpl-unix)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (defgroup pcmpl-gnu nil
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 "Completions for GNU project tools."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 :group 'pcomplete)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 ;; User Variables:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 (defcustom pcmpl-gnu-makefile-regexps
31241
3099993cba0f See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 29959
diff changeset
38 '("\\`GNUmakefile" "\\`Makefile" "\\.mak\\'")
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 "*A list of regexps that will match Makefile names."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 :type '(repeat regexp)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 :group 'pcmpl-gnu)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 ;; Functions:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 (defun pcomplete/gzip ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 "Completion for `gzip'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 (let ((pcomplete-help "(gzip)"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 (pcomplete-opt "cdfhlLnNqrStvV123456789")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (while (pcomplete-here
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 (pcmpl-gnu-zipped-files
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (catch 'has-d-flag
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (let ((args pcomplete-args))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (while args
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (if (string-match "\\`-.*[dt]" (car args))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (throw 'has-d-flag t))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (setq args (cdr args))))))))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (defun pcmpl-gnu-zipped-files (unzip-p)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 "Find all zipped or unzipped files: the inverse of UNZIP-P."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (pcomplete-entries
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 nil
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (function
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (lambda (entry)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 (when (and (file-readable-p entry)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 (file-regular-p entry))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 (let ((zipped (string-match "\\.\\(t?gz\\|\\(ta\\)?Z\\)\\'"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 entry)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (or (and unzip-p zipped)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (and (not unzip-p) (not zipped)))))))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (defun pcomplete/bzip2 ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 "Completion for `bzip2'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (pcomplete-opt "hdzkftcqvLVs123456789")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (while (pcomplete-here
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (pcmpl-gnu-bzipped-files
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (catch 'has-d-flag
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (let ((args pcomplete-args))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (while args
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 (if (string-match "\\`-.*[dt]" (car args))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (throw 'has-d-flag t))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (setq args (cdr args)))))))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (defun pcmpl-gnu-bzipped-files (unzip-p)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 "Find all zipped or unzipped files: the inverse of UNZIP-P."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (pcomplete-entries
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 nil
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (function
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (lambda (entry)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (when (and (file-readable-p entry)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (file-regular-p entry))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 (let ((zipped (string-match "\\.\\(t?z2\\|bz2\\)\\'" entry)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (or (and unzip-p zipped)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (and (not unzip-p) (not zipped)))))))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (defun pcomplete/make ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 "Completion for GNU `make'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (let ((pcomplete-help "(make)Top"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (pcomplete-opt "bmC/def(pcmpl-gnu-makefile-names)hiI/j?kl?no.pqrsStvwW.")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (while (pcomplete-here (pcmpl-gnu-make-rule-names) nil 'identity))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (defun pcmpl-gnu-makefile-names ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 "Return a list of possible makefile names."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (let ((names (list t))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (reg pcmpl-gnu-makefile-regexps))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (while reg
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (nconc names (pcomplete-entries (car reg)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (setq reg (cdr reg)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (cdr names)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (defun pcmpl-gnu-make-rule-names ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 "Return a list of possible make rule names in MAKEFILE."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (let* ((minus-f (member "-f" pcomplete-args))
31241
3099993cba0f See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 29959
diff changeset
116 (makefile (or (cadr minus-f)
3099993cba0f See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 29959
diff changeset
117 (if (file-exists-p "GNUmakefile")
3099993cba0f See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 29959
diff changeset
118 "GNUmakefile"
3099993cba0f See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 29959
diff changeset
119 "Makefile")))
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 rules)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (if (not (file-readable-p makefile))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (unless minus-f (list "-f"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (insert-file-contents-literally makefile)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (while (re-search-forward
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (concat "^\\s-*\\([^\n#%.$][^:=\n]*\\)\\s-*:[^=]") nil t)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (setq rules (append (split-string (match-string 1)) rules))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (pcomplete-uniqify-list rules))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (defcustom pcmpl-gnu-tarfile-regexp
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 "\\.t\\(ar\\(\\.\\(gz\\|bz2\\|Z\\)\\)?\\|gz\\|a[zZ]\\|z2\\)\\'"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 "*A regexp which matches any tar archive."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 :type 'regexp
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 :group 'pcmpl-gnu)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (defvar pcmpl-gnu-tar-buffer nil)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (defun pcomplete/tar ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 "Completion for the GNU tar utility."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 ;; options that end in an equal sign will want further completion...
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (let (saw-option complete-within)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (setq pcomplete-suffix-list (cons ?= pcomplete-suffix-list))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 (while (pcomplete-match "^-" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 (setq saw-option t)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (if (pcomplete-match "^--" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (if (pcomplete-match "^--\\([^= \t\n\f]*\\)\\'" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (pcomplete-here*
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 '("--absolute-names"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 "--after-date="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 "--append"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 "--atime-preserve"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 "--backup"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 "--block-number"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 "--blocking-factor="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 "--catenate"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 "--checkpoint"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 "--compare"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 "--compress"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 "--concatenate"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 "--confirmation"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 "--create"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 "--delete"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 "--dereference"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 "--diff"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 "--directory="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 "--exclude="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 "--exclude-from="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 "--extract"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 "--file="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 "--files-from="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172 "--force-local"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 "--get"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 "--group="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 "--gzip"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 "--help"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 "--ignore-failed-read"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 "--ignore-zeros"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 "--incremental"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 "--info-script="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 "--interactive"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 "--keep-old-files"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 "--label="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 "--list"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 "--listed-incremental"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 "--mode="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 "--modification-time"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 "--multi-volume"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 "--new-volume-script="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 "--newer="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 "--newer-mtime"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 "--no-recursion"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 "--null"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 "--numeric-owner"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 "--old-archive"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 "--one-file-system"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 "--owner="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 "--portability"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 "--posix"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 "--preserve"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 "--preserve-order"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 "--preserve-permissions"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 "--read-full-records"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 "--record-size="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 "--recursive-unlink"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 "--remove-files"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 "--rsh-command="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 "--same-order"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 "--same-owner"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 "--same-permissions"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 "--sparse"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 "--starting-file="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 "--suffix="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 "--tape-length="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 "--to-stdout"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 "--totals"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 "--uncompress"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 "--ungzip"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 "--unlink-first"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 "--update"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 "--use-compress-program="
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 "--verbose"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 "--verify"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 "--version"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 "--volno-file=")))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226 (pcomplete-opt "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
227 (cond
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 ((pcomplete-match "\\`--after-date=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 ((pcomplete-match "\\`--backup=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 ((pcomplete-match "\\`--blocking-factor=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 ((pcomplete-match "\\`--directory=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
235 (pcomplete-here* (pcomplete-dirs)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237 ((pcomplete-match "\\`--exclude-from=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 (pcomplete-here* (pcomplete-entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240 ((pcomplete-match "\\`--exclude=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 ((pcomplete-match "\\`--\\(extract\\|list\\)\\'" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 (setq complete-within t))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 ((pcomplete-match "\\`--file=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 (pcomplete-here* (pcomplete-dirs-or-entries pcmpl-gnu-tarfile-regexp)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
246 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 ((pcomplete-match "\\`--files-from=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 (pcomplete-here* (pcomplete-entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 ((pcomplete-match "\\`--group=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251 (pcomplete-here* (pcmpl-unix-group-names)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 ((pcomplete-match "\\`--info-script=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (pcomplete-here* (pcomplete-entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 ((pcomplete-match "\\`--label=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258 ((pcomplete-match "\\`--mode=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 ((pcomplete-match "\\`--new-volume-script=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 (pcomplete-here* (pcomplete-entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 ((pcomplete-match "\\`--newer=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 ((pcomplete-match "\\`--owner=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (pcomplete-here* (pcmpl-unix-user-names)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 ((pcomplete-match "\\`--record-size=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270 ((pcomplete-match "\\`--rsh-command=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 (pcomplete-here* (funcall pcomplete-command-completion-function)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273 ((pcomplete-match "\\`--starting-file=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 (pcomplete-here* (pcomplete-entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 ((pcomplete-match "\\`--suffix=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 ((pcomplete-match "\\`--tape-length=" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
279 (pcomplete-here*))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280 ((pcomplete-match "\\`--use-compress-program=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
281 (pcomplete-here* (funcall pcomplete-command-completion-function)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (pcomplete-match-string 1 0)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 ((pcomplete-match "\\`--volno-file=\\(.*\\)" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (pcomplete-here* (pcomplete-entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 (pcomplete-match-string 1 0)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (setq pcomplete-suffix-list (cdr pcomplete-suffix-list))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (unless saw-option
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (pcomplete-here
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 (mapcar 'char-to-string
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 (string-to-list
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 "01234567ABCFGIKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz")))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 (if (pcomplete-match "[xt]" 'first 1)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 (setq complete-within t)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 (pcomplete-here (pcomplete-dirs-or-entries pcmpl-gnu-tarfile-regexp))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 (setq pcmpl-gnu-tar-buffer (find-file-noselect (pcomplete-arg 1)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 (while (pcomplete-here
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 (if complete-within
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (with-current-buffer pcmpl-gnu-tar-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 (mapcar
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (function
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (lambda (entry)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 (tar-header-name (cdr entry))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 tar-parse-info))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (pcomplete-entries))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 nil 'identity))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 (defalias 'pcomplete/gdb 'pcomplete/xargs)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 ;;; pcmpl-gnu.el ends here