annotate lisp/pcmpl-cvs.el @ 87159:bcf59f3d73d7

* net/dbus.el (dbus-hash-table=): Fix for new hash table key structure. (dbus-list-hash-table, dbus-name-owner-changed-handler): New defuns. (dbus-check-event, dbus-handle-event, dbus-event-bus-name) (dbus-event-service-name, dbus-event-path-name) (dbus-event-interface-name, dbus-event-member-name): Fix for new event structure. (dbus-list-activatable-names, dbus-list-names) (dbus-list-queued-owners, dbus-get-name-owner, dbus-introspect): Reorder `dbus-call-method' arguments.
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 07 Dec 2007 04:47:19 +0000
parents 9355f9b7bbff
children 73661ddc7ac7 f55f9811f5d7
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: 29959
diff changeset
1 ;;; pcmpl-cvs.el --- functions for dealing with cvs completions
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
74442
b2e5081b9320 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74442
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
46081
e0672852f9dd Added my name as the maintainer of this file.
John Wiegley <johnw@newartisans.com>
parents: 38414
diff changeset
5
e0672852f9dd Added my name as the maintainer of this file.
John Wiegley <johnw@newartisans.com>
parents: 38414
diff changeset
6 ;; Author: John Wiegley <johnw@gnu.org>
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
78236
9355f9b7bbff Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
12 ;; the Free Software Foundation; either version 3, or (at your option)
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; any later version.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 64016
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 64016
diff changeset
23 ;; Boston, MA 02110-1301, USA.
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;; These functions provide completion rules for the `cvs' tool.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;;; Code:
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 (provide 'pcmpl-cvs)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (require 'pcomplete)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 (require 'executable)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (defgroup pcmpl-cvs nil
64016
a32551e9db34 (pcmpl-cvs): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
37 "Functions for dealing with CVS completions."
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 :group 'pcomplete)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 ;; User Variables:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 (defcustom pcmpl-cvs-binary (or (executable-find "cvs") "cvs")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 "*The full path of the 'cvs' binary."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 :type 'file
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 :group 'pcmpl-cvs)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 ;; Functions:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (defun pcomplete/cvs ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 "Completion rules for the `cvs' command."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (let ((pcomplete-help "(cvs)Invoking CVS"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (pcomplete-opt "HQqrwlntvfab/T/e*d/z?s")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (pcomplete-here* (pcmpl-cvs-commands))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (cond ((pcomplete-test "add")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (setq pcomplete-help "(cvs)Adding files")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (pcomplete-opt "k?m?")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 (while (pcomplete-here (pcmpl-cvs-entries '(??)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 ((pcomplete-test "remove")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 (setq pcomplete-help "(cvs)Removing files")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (pcomplete-opt "flR")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 (while (pcomplete-here (pcmpl-cvs-entries '(?U)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 ((pcomplete-test "init")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (setq pcomplete-help "(cvs)Creating a repository"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 ((pcomplete-test '("login" "logout"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 (setq pcomplete-help "(cvs)Password authentication client"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 ((pcomplete-test "import")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (setq pcomplete-help "(cvs)import")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (pcomplete-opt "dk?I(pcmpl-cvs-entries '(??))b?m?W?"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 ((pcomplete-test "checkout")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (setq pcomplete-help "(cvs)checkout")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (pcomplete-opt "ANPRcflnpsr?D?d/k?j?")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (pcomplete-here (pcmpl-cvs-modules)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 ((pcomplete-test "rtag")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (setq pcomplete-help "(cvs)Creating a branch")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (pcomplete-opt "aflRndbr?DF")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (pcomplete-here (pcmpl-cvs-modules)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 ((pcomplete-test "release")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (setq pcomplete-help "(cvs)release")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (pcomplete-opt "d")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 (while (pcomplete-here (pcomplete-dirs))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 ((pcomplete-test "export")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (setq pcomplete-help "(cvs)export")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (pcomplete-opt "NflRnr?D?d/k?")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (pcomplete-here (pcmpl-cvs-modules)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 ((pcomplete-test "commit")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (setq pcomplete-help "(cvs)commit files")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 (pcomplete-opt "nRlfF.m?r(pcmpl-cvs-tags '(?M ?R ?A))")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (while (pcomplete-here (pcmpl-cvs-entries '(?M ?R ?A)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 ((pcomplete-test "diff")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (setq pcomplete-help "(cvs)Viewing differences")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (let ((opt-index pcomplete-index)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 saw-backdate)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (pcomplete-opt "lRD?Nr(pcmpl-cvs-tags)")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (while (< opt-index pcomplete-index)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (if (pcomplete-match "^-[Dr]" (- pcomplete-index opt-index))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (setq saw-backdate t opt-index pcomplete-index)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (setq opt-index (1+ opt-index))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (while (pcomplete-here
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (pcmpl-cvs-entries (unless saw-backdate '(?M)))))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 ((pcomplete-test "unedit")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (setq pcomplete-help "(cvs)Editing files")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (pcomplete-opt "lR")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (while (pcomplete-here (pcmpl-cvs-entries '(?M ?R ?A)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 ((pcomplete-test "update")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (setq pcomplete-help "(cvs)update")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (pcomplete-opt
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (concat "APdflRpk?r(pcmpl-cvs-tags '(?U ?P))D?"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 "j(pcmpl-cvs-tags '(?U ?P))"
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 "I(pcmpl-cvs-entries '(??))W?"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (while (pcomplete-here (pcmpl-cvs-entries '(?U ?P)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (t
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (while (pcomplete-here (pcmpl-cvs-entries)))))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (defun pcmpl-cvs-commands ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 "Return a list of available CVS commands."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (call-process pcmpl-cvs-binary nil t nil "--help-commands")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 (goto-char (point-min))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (let (cmds)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (while (re-search-forward "^\\s-+\\([a-z]+\\)" nil t)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (setq cmds (cons (match-string 1) cmds)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (pcomplete-uniqify-list cmds))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (defun pcmpl-cvs-modules ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 "Return a list of available modules under CVS."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (call-process pcmpl-cvs-binary nil t nil "checkout" "-c")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (goto-char (point-min))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (let (entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (while (re-search-forward "\\(\\S-+\\)$" nil t)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 (setq entries (cons (match-string 1) entries)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (pcomplete-uniqify-list entries))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (defun pcmpl-cvs-tags (&optional opers)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 "Return all the tags which could apply to the files related to OPERS."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 (let ((entries (pcmpl-cvs-entries opers))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 tags)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (apply 'call-process pcmpl-cvs-binary nil t nil
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 "status" "-v" entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (goto-char (point-min))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (while (re-search-forward "Existing Tags:" nil t)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 (forward-line)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 (while (not (looking-at "^$"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (unless (looking-at "^\\s-+\\(\\S-+\\)\\s-+")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (error "Error in output from `cvs status -v'"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (setq tags (cons (match-string 1) tags))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 (forward-line))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 (pcomplete-uniqify-list tags)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 (defun pcmpl-cvs-entries (&optional opers)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 "Return the Entries for the current directory.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 If OPERS is a list of characters, return entries for which that
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 operation character applies, as displayed by 'cvs -n update'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 (let* ((arg (pcomplete-arg))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 (dir (file-name-as-directory
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (or (file-name-directory arg) "")))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 (nondir (or (file-name-nondirectory arg) ""))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 entries)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (if opers
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (and dir (cd dir))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 (call-process pcmpl-cvs-binary nil t nil
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 "-q" "-n" "-f" "update"); "-l")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (goto-char (point-min))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 (while (re-search-forward "^\\(.\\) \\(.+\\)$" nil t)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (if (memq (string-to-char (match-string 1)) opers)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 (setq entries (cons (match-string 2) entries)))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 (insert-file-contents (concat dir "CVS/Entries"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172 (goto-char (point-min))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 (while (not (eobp))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (let* ((line (buffer-substring (line-beginning-position)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 (line-end-position)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 (fields (split-string line "/"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 text)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 (if (eq (aref line 0) ?/)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (setq fields (cons "" fields)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 (setq text (nth 1 fields))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 (when text
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (if (string= (nth 0 fields) "D")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 (setq text (file-name-as-directory text)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 (setq entries (cons text entries))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 (forward-line))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (setq pcomplete-stub nondir)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (pcomplete-uniqify-list entries)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46081
diff changeset
189 ;;; arch-tag: d2aeac43-4bf5-4509-a496-74b863c6642b
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 ;;; pcmpl-cvs.el ends here