Mercurial > emacs
annotate lisp/pcvs.el @ 34042:f933093476c2
*** empty log message ***
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 30 Nov 2000 13:01:40 +0000 |
parents | 19782a8038a3 |
children | dd613770eb0f |
rev | line source |
---|---|
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; pcvs.el -- A Front-end to CVS. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
3 ;; Copyright (C) 1991-2000 Free Software Foundation, Inc. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
4 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 ;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; (Per Cederqvist) ceder@lysator.liu.se |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 ;; (Greg A. Woods) woods@weird.com |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 ;; (Jim Blandy) jimb@cyclic.com |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; (Karl Fogel) kfogel@floss.red-bean.com |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 ;; (Jim Kingdon) kingdon@cyclic.com |
31977
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
11 ;; (Stefan Monnier) monnier@cs.yale.edu |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
12 ;; (Greg Klanderman) greg@alphatech.com |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
13 ;; (Jari Aalto+mail.emacs) jari.aalto@poboxes.com |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 ;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 ;; Keywords: CVS, version control, release management |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; Version: $Name: $ |
33701
19782a8038a3
* pcvs.el (uniquify-buffer-file-name): Remove advice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33359
diff
changeset
|
17 ;; Revision: $Id: pcvs.el,v 1.17 2000/11/09 23:55:05 monnier Exp $ |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; This file is part of GNU Emacs. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; GNU Emacs is free software; you can redistribute it and/or modify |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
22 ;; it under the terms of the GNU General Public License as published by |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 ;; the Free Software Foundation; either version 2, or (at your option) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;; any later version. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 ;; GNU Emacs is distributed in the hope that it will be useful, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29 ;; GNU General Public License for more details. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 ;; You should have received a copy of the GNU General Public License |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 ;; Boston, MA 02111-1307, USA. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 ;;; Commentary: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
38 ;; PCL-CVS is a front-end to the CVS version control system. For people |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
39 ;; familiar with VC, it is somewhat like VC-dired: it presents the status of |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
40 ;; all the files in your working area and allows you to commit/update several |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
41 ;; of them at a time. Compared to VC-dired, it is considerably better and |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
42 ;; faster (but only for CVS). |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
43 |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
44 ;; PCL-CVS was originally written by Per Cederqvist many years ago. This |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
45 ;; version derives from the XEmacs-21 version, itself based on the 2.0b2 |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
46 ;; version (last release from Per). It is a thorough rework. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
47 |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
48 ;; Contrary to what you'd expect, PCL-CVS is not a replacement for VC but only |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
49 ;; for VC-dired. As such, I've tried to make PCL-CVS and VC interoperate |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
50 ;; seamlessly (I also use VC). |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
51 |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
52 ;; To use PCL-CVS just use `M-x cvs-examine RET <dir> RET'. |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
53 ;; There is a TeXinfo manual, which can be helpful to get started. |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
54 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 ;;; Todo: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56 |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
57 ;; ******** FIX THE DOCUMENTATION ********* |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
58 ;; |
32187
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
59 ;; - use UP-TO-DATE rather than DEAD when cleaning before `examine'. |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
60 ;; - allow to flush messages only |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
61 ;; - allow to protect files like ChangeLog from flushing |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
62 ;; - automatically cvs-mode-insert files from find-file-hook |
33195
d296e0e3cf43
(cvs-mode-add-change-log-entry-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32488
diff
changeset
|
63 ;; (and don't flush them as long as they are visited) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
64 ;; - query the user for cvs-get-marked (for some cmds or if nothing's selected) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
65 ;; - don't return the first (resp last) FI if the cursor is before |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
66 ;; (resp after) it. |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
67 ;; - allow cvs-confirm-removals to force always confirmation. |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
68 ;; - cvs-checkout should ask for a revision (with completion). |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
69 ;; - removal confirmation should allow specifying another file name. |
32187
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
70 ;; |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
71 ;; - hide fileinfos without getting rid of them (will require ewok work). |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
72 ;; - add toolbar entries |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
73 ;; - marking |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
74 ;; marking directories should jump to just after the dir. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
75 ;; allow (un)marking directories at a time with the mouse. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
76 ;; - liveness indicator |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
77 ;; - indicate in docstring if the cmd understands the `b' prefix(es). |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
78 ;; - call smerge-mode when opening CONFLICT files. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
79 ;; - have vc-checkin delegate to cvs-mode-commit when applicable |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
80 ;; - higher-level CVS operations |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
81 ;; cvs-mode-rename |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
82 ;; cvs-mode-branch |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
83 ;; - module-level commands |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
84 ;; add support for parsing 'modules' file ("cvs co -c") |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
85 ;; cvs-mode-rcs2log |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
86 ;; cvs-rdiff |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
87 ;; cvs-release |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
88 ;; cvs-import |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
89 ;; C-u M-x cvs-checkout should ask for a cvsroot |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
90 ;; cvs-mode-handle-new-vendor-version |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 ;; - checks out module, or alternately does update join |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
92 ;; - does "cvs -n tag LAST_VENDOR" to find old files into *cvs* |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
93 ;; cvs-export |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
94 ;; (with completion on tag names and hooks to help generate full releases) |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
95 ;; - allow cvs-cmd-do to either clear the marks or not. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
96 ;; - display stickiness information. And current CVS/Tag as well. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
97 ;; - write 'cvs-mode-admin' to do arbitrary 'cvs admin' commands |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
98 ;; Most interesting would be version removal and log message replacement. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
99 ;; The last one would be neat when called from log-view-mode. |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
100 ;; - cvs-mode-incorporate |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
101 ;; It would merge in the status from one *cvs* buffer into another. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 ;; This would be used to populate such a buffer that had been created with |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 ;; a `cvs {update,status,checkout} -l'. |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
104 ;; - cvs-mode-(i)diff-other-{file,buffer,cvs-buffer} |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
105 ;; - offer the choice to kill the process when the user kills the cvs buffer. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 ;; right now, it's killed without further ado. |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
107 ;; - make `cvs-mode-ignore' allow manually entering a pattern. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 ;; to which dir should it apply ? |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
109 ;; - cvs-mode-ignore should try to remove duplicate entries. |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
110 ;; - maybe poll/check CVS/Entries files to react to external `cvs' commands ? |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
111 ;; - some kind of `cvs annotate' support ? |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
112 ;; but vc-annotate can be used instead. |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
113 ;; - proper `g' that passes safe args and uses either cvs-status or cvs-examine |
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
114 ;; maybe also use cvs-update depending on I-don't-know-what. |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
115 ;; - add message-levels so that we can hide some levels of messages |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
116 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 ;;; Code: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 |
30612
a019ed819488
(require): Require `cl' during compilation, only.
Gerd Moellmann <gerd@gnu.org>
parents:
30569
diff
changeset
|
119 (eval-when-compile (require 'cl)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 (require 'ewoc) ;Ewoc was once cookie |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 (require 'pcvs-defs) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
122 (require 'pcvs-util) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 (require 'pcvs-parse) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 (require 'pcvs-info) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
128 ;;;; global vars |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 (defvar cvs-cookies) ;;nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 ;;"Handle for the cookie structure that is displayed in the *cvs* buffer.") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 ;;(make-variable-buffer-local 'cvs-cookies) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
134 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
135 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 ;;;; Dynamically scoped variables |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 (defvar cvs-from-vc nil "Bound to t inside VC advice.") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
140 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
141 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 ;;;; flags variables |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
143 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
145 (defun cvs-defaults (&rest defs) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 (let ((defs (cvs-first defs cvs-shared-start))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 (append defs |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
148 (make-list (- cvs-shared-start (length defs)) (car defs)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 cvs-shared-flags))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
151 ;; For cvs flags, we need to add "-f" to override the cvsrc settings |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
152 ;; we also want to evict the annoying -q and -Q options that hide useful |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
153 ;; information from pcl-cvs. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 (cvs-flags-define cvs-cvs-flags '(("-f"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
155 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 (cvs-flags-define cvs-checkout-flags (cvs-defaults '("-P"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 (cvs-flags-define cvs-status-flags (cvs-defaults '("-v") nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 (cvs-flags-define cvs-log-flags (cvs-defaults nil)) |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
159 (cvs-flags-define cvs-diff-flags (cvs-defaults '("-u" "-N") '("-c" "-N") '("-u" "-b"))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 (cvs-flags-define cvs-tag-flags (cvs-defaults nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
161 (cvs-flags-define cvs-add-flags (cvs-defaults nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
162 (cvs-flags-define cvs-commit-flags (cvs-defaults nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
163 (cvs-flags-define cvs-remove-flags (cvs-defaults nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
164 ;;(cvs-flags-define cvs-undo-flags (cvs-defaults nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
165 (cvs-flags-define cvs-update-flags (cvs-defaults '("-d" "-P"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
166 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
167 (defun cvs-reread-cvsrc () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 "Reset the default arguments to those in the `cvs-cvsrc-file'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 (let ((cvsrc (cvs-file-to-string cvs-cvsrc-file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 (when (stringp cvsrc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 ;; fetch the values |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173 (dolist (cmd '("cvs" "checkout" "status" "log" "diff" "tag" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
174 "add" "commit" "remove" "update")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
175 (let* ((sym (intern (concat "cvs-" cmd "-flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 (val (when (string-match (concat "^" cmd "\\s-\\(.*\\)$") cvsrc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 (cvs-string->strings (match-string 1 cvsrc))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 (cvs-flags-set sym 0 val))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
179 ;; ensure that cvs doesn't have -q or -Q |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
180 (cvs-flags-set 'cvs-cvs-flags 0 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
181 (cons "-f" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
182 (cdr (cvs-partition |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
183 (lambda (x) (member x '("-q" "-Q"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
184 (cvs-flags-query 'cvs-cvs-flags |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
185 nil 'noquery)))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
186 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187 ;; initialize to cvsrc's default values |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
188 (cvs-reread-cvsrc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
189 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
190 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
191 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
192 ;;;; Mouse bindings and mode motion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
193 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
194 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
195 (defun cvs-menu (e) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
196 "Popup the CVS menu." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
197 (interactive "e") |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
198 (let ((cvs-minor-current-files |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
199 (list (ewoc-data (ewoc-locate |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
200 cvs-cookies (posn-point (event-end e))))))) |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
201 (popup-menu cvs-menu-map e))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
202 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
203 (defvar cvs-mode-line-process nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
204 "Mode-line control for displaying info on cvs process status.") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
205 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
206 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
207 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
208 ;;;; Query-Type-Descriptor for Tags |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
209 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
210 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
211 (autoload 'cvs-status-get-tags "cvs-status") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
212 (defun cvs-tags-list () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
213 "Return a list of acceptable tags, ready for completions." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
214 (assert (cvs-buffer-p)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
215 (let ((marked (cvs-get-marked))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
216 (list* '("BASE") '("HEAD") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
217 (when marked |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
218 (with-temp-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
219 (call-process cvs-program |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
220 nil ;no input |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
221 t ;output to current-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
222 nil ;don't update display while running |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
223 "status" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
224 "-v" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
225 (cvs-fileinfo->full-path (car marked))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
226 (goto-char (point-min)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
227 (let ((tags (cvs-status-get-tags))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
228 (when (listp tags) tags))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
229 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
230 (defvar cvs-tag-history nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
231 (defconst cvs-qtypedesc-tag |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
232 (cvs-qtypedesc-create 'identity 'identity 'cvs-tags-list 'cvs-tag-history)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
233 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
234 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
236 (defun cvs-mode! (&optional -cvs-mode!-fun -cvs-mode!-noerror) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
237 "Switch to the *cvs* buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
238 If -CVS-MODE!-FUN is provided, it is executed *cvs* being the current buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
239 and with its window selected. Else, the *cvs* buffer is simply selected. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
240 If -CVS-MODE!-NOERROR is non-nil, then failure to find a *cvs* buffer does |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
241 not generate an error and the current buffer is kept selected. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
242 -CVS-MODE!-FUN is called interactively if applicable and else with no argument." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
243 (let* ((-cvs-mode!-buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
244 (cvsbuf (cond ((cvs-buffer-p) (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
245 ((and cvs-buffer (cvs-buffer-p cvs-buffer)) cvs-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
246 (-cvs-mode!-noerror (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
247 (t (error "can't find the *cvs* buffer.")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
248 (-cvs-mode!-wrapper cvs-minor-wrap-function) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
249 (-cvs-mode!-cont (lambda () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
250 (save-current-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
251 (if (commandp -cvs-mode!-fun) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
252 (call-interactively -cvs-mode!-fun) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
253 (funcall -cvs-mode!-fun)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
254 (if (not -cvs-mode!-fun) (set-buffer cvsbuf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
255 (let ((cvs-mode!-buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 (cvs-mode!-owin (selected-window)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 (cvs-mode!-nwin (get-buffer-window cvsbuf 'visible))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258 (unwind-protect |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 (progn |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 (set-buffer cvsbuf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
261 (when cvs-mode!-nwin (select-window cvs-mode!-nwin)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 (if -cvs-mode!-wrapper |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
263 (funcall -cvs-mode!-wrapper -cvs-mode!-buf -cvs-mode!-cont) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
264 (funcall -cvs-mode!-cont))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
265 (set-buffer cvs-mode!-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266 (when (and cvs-mode!-nwin (eq cvs-mode!-nwin (selected-window))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
267 ;; the selected window has not been changed by FUN |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
268 (select-window cvs-mode!-owin))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
269 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
270 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
271 ;;;; Prefixes |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
272 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 (defvar cvs-branches (list cvs-vendor-branch "HEAD" "HEAD")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
275 (cvs-prefix-define cvs-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
276 "Current selected branch." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277 "version" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 (cons cvs-vendor-branch cvs-branches) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 cvs-qtypedesc-tag) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
281 (defun cvs-set-branch-prefix (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
282 "Set the branch prefix to take action at the next command. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 See `cvs-prefix-set' for a further the description of the behavior. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
284 \\[universal-argument] 1 selects the vendor branch |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
285 and \\[universal-argument] 2 selects the HEAD." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 (interactive "P") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
287 (cvs-mode!) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
288 (cvs-prefix-set 'cvs-branch-prefix arg)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
289 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
290 (defun cvs-add-branch-prefix (flags &optional arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
291 "Add branch selection argument if the branch prefix was set. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 The argument is added (or not) to the list of FLAGS and is constructed |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 by appending the branch to ARG which defaults to \"-r\"." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 (let ((branch (cvs-prefix-get 'cvs-branch-prefix))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
295 ;; deactivate the secondary prefix, even if not used. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
296 (cvs-prefix-get 'cvs-secondary-branch-prefix) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
297 (if branch (cons (concat (or arg "-r") branch) flags) flags))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
298 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
299 (cvs-prefix-define cvs-secondary-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
300 "Current secondary selected branch." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 "version" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
302 (cons cvs-vendor-branch cvs-branches) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
303 cvs-qtypedesc-tag) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
304 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
305 (defun cvs-set-secondary-branch-prefix (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
306 "Set the branch prefix to take action at the next command. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
307 See `cvs-prefix-set' for a further the description of the behavior. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
308 \\[universal-argument] 1 selects the vendor branch |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
309 and \\[universal-argument] 2 selects the HEAD." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
310 (interactive "P") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
311 (cvs-mode!) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
312 (cvs-prefix-set 'cvs-secondary-branch-prefix arg)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
313 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
314 (defun cvs-add-secondary-branch-prefix (flags &optional arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
315 "Add branch selection argument if the secondary branch prefix was set. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
316 The argument is added (or not) to the list of FLAGS and is constructed |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
317 by appending the branch to ARG which defaults to \"-r\". |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
318 Since the `cvs-secondary-branch-prefix' is only active if the primary |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
319 prefix is active, it is important to read the secondary prefix before |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
320 the primay since reading the primary can deactivate it." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
321 (let ((branch (and (cvs-prefix-get 'cvs-branch-prefix 'read-only) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 (cvs-prefix-get 'cvs-secondary-branch-prefix)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
323 (if branch (cons (concat (or arg "-r") branch) flags) flags))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
324 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
325 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
326 |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
327 (define-minor-mode cvs-minor-mode |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
328 "This mode is used for buffers related to a main *cvs* buffer. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 All the `cvs-mode' buffer operations are simply rebound under |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
330 the \\[cvs-mode-map] prefix." |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
331 nil " CVS") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
332 (put 'cvs-minor-mode 'permanent-local t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
333 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
334 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
335 (defvar cvs-temp-buffers nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
336 (defun cvs-temp-buffer (&optional cmd normal nosetup) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
337 "Create a temporary buffer to run CMD in. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
338 If CMD is a string, use it to lookup `cvs-buffer-name-alist' to find |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
339 the buffer name to be used and its `major-mode'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
340 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
341 The selected window will not be changed. The new buffer will not maintain undo |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
342 information and will be read-only unless NORMAL is non-nil. It will be emptied |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
343 \(unless NOSETUP is non-nil\) and its `default-directory' will be inherited |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
344 from the current buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
345 (let* ((cvs-buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
346 (info (cdr (assoc cmd cvs-buffer-name-alist))) |
30618
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
347 (name (eval (nth 0 info))) |
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
348 (mode (nth 1 info)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
349 (dir default-directory) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
350 (buf (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
351 (name (cvs-get-buffer-create name)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
352 ((and (bufferp cvs-temp-buffer) (buffer-name cvs-temp-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
353 cvs-temp-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
354 (t |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 (set (make-local-variable 'cvs-temp-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356 (cvs-get-buffer-create |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
357 (eval cvs-temp-buffer-name) 'noreuse)))))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
358 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
359 ;; handle the potential pre-existing process |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
360 (let ((proc (get-buffer-process buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
361 (when (and (not normal) (processp proc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
362 (memq (process-status proc) '(run stop))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
363 (error "Can not run two cvs processes simultaneously"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
364 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 (if (not name) (kill-local-variable 'other-window-scroll-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366 ;; Strangely, if no window is created, `display-buffer' ends up |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 ;; doing a `switch-to-buffer' which does a `set-buffer', hence |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
368 ;; the need for `save-excursion'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 (unless nosetup (save-excursion (display-buffer buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
370 ;; FIXME: this doesn't do the right thing if the user later on |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
371 ;; does a `find-file-other-window' and `scroll-other-window' |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
372 (set (make-local-variable 'other-window-scroll-buffer) buf)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
374 (add-to-list 'cvs-temp-buffers buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
376 (with-current-buffer buf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
377 (setq buffer-read-only nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
378 (setq default-directory dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
379 (unless nosetup (erase-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
380 (set (make-local-variable 'cvs-buffer) cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
381 ;;(cvs-minor-mode 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
382 (let ((lbd list-buffers-directory)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
383 (if (fboundp mode) (funcall mode) (fundamental-mode)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
384 (when lbd (set (make-local-variable 'list-buffers-directory) lbd))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
385 (cvs-minor-mode 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
386 ;;(set (make-local-variable 'cvs-buffer) cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
387 (unless normal |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
388 (setq buffer-read-only t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
389 (buffer-disable-undo)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
390 buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
391 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
392 (defun cvs-mode-kill-buffers () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
393 "Kill all the \"temporary\" buffers created by the *cvs* buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
394 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
395 (dolist (buf cvs-temp-buffers) (ignore-errors (kill-buffer buf)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
396 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
397 (defun cvs-make-cvs-buffer (dir &optional new) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
398 "Create the *cvs* buffer for directory DIR. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
399 If non-nil, NEW means to create a new buffer no matter what." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
400 ;; the real cvs-buffer creation |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
401 (setq dir (cvs-expand-dir-name dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
402 (let* ((buffer-name (eval cvs-buffer-name)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
403 (buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
404 (or (and (not new) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
405 (eq cvs-reuse-cvs-buffer 'current) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
406 (cvs-buffer-p) ;reuse the current buffer if possible |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
407 (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
408 ;; look for another cvs buffer visiting the same directory |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
409 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
410 (unless new |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
411 (dolist (buffer (cons (current-buffer) (buffer-list))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
412 (set-buffer buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
413 (and (cvs-buffer-p) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
414 (case cvs-reuse-cvs-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
415 (always t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
416 (subdir |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
417 (or (cvs-string-prefix-p default-directory dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
418 (cvs-string-prefix-p dir default-directory))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
419 (samedir (string= default-directory dir))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
420 (return buffer))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
421 ;; we really have to create a new buffer: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
422 ;; we temporarily bind cwd to "" to prevent |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
423 ;; create-file-buffer from using directory info |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
424 ;; unless it is explicitly in the cvs-buffer-name. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
425 (cvs-get-buffer-create buffer-name new)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
426 (with-current-buffer buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
427 (or |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
428 (and (string= dir default-directory) (cvs-buffer-p) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
429 ;; just a refresh |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
430 (ignore-errors |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
431 (cvs-cleanup-collection cvs-cookies nil nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
432 (current-buffer))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
433 ;; setup from scratch |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
434 (progn |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
435 (setq default-directory dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
436 (setq buffer-read-only nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
437 (erase-buffer) |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
438 (insert "\ |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
439 Repository : " (directory-file-name (cvs-get-cvsroot)) " |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
440 Module : " (cvs-get-module) " |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
441 Working dir: " (abbreviate-file-name dir) " |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
442 |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
443 ") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
444 (setq buffer-read-only t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
445 (cvs-mode) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
446 (set (make-local-variable 'list-buffers-directory) buffer-name) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
447 ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer)) |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
448 (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n" ""))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
449 (set (make-local-variable 'cvs-cookies) cookies) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
450 (add-hook 'kill-buffer-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
451 (lambda () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
452 (ignore-errors (kill-buffer cvs-temp-buffer))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
453 nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
454 ;;(set-buffer buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
455 buffer)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
456 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
457 (defun* cvs-cmd-do (cmd dir flags fis new |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
458 &key cvsargs noexist dont-change-disc noshow) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
459 (let* ((dir (file-name-as-directory |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
460 (abbreviate-file-name (expand-file-name dir)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
461 (cvsbuf (cvs-make-cvs-buffer dir new))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
462 ;; Check that dir is under CVS control. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
463 (unless (file-directory-p dir) |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
464 (error "%s is not a directory" dir)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
465 (unless (or noexist (file-directory-p (expand-file-name "CVS" dir))) |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
466 (error "%s does not contain CVS controlled files" dir)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
467 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
468 (set-buffer cvsbuf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
469 (cvs-mode-run cmd flags fis |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
470 :cvsargs cvsargs :dont-change-disc dont-change-disc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
471 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
472 (if noshow cvsbuf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
473 (let ((pop-up-windows nil)) (pop-to-buffer cvsbuf))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
474 ;; (funcall (if (and (boundp 'pop-up-frames) pop-up-frames) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
475 ;; 'pop-to-buffer 'switch-to-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
476 ;; cvsbuf)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
477 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
478 (defun cvs-run-process (args fis postprocess &optional single-dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
479 (assert (cvs-buffer-p cvs-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
480 (save-current-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
481 (let ((procbuf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
482 (cvsbuf cvs-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
483 (single-dir (or single-dir (eq cvs-execute-single-dir t)))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
484 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
485 (set-buffer procbuf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
486 (goto-char (point-max)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
487 (unless (bolp) (let ((inhibit-read-only t)) (insert "\n"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
488 ;; find the set of files we'll process in this round |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
489 (let* ((dir+files+rest |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
490 (if (or (null fis) (not single-dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
491 ;; not single-dir mode: just process the whole thing |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
492 (list "" (mapcar 'cvs-fileinfo->full-path fis) nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
493 ;; single-dir mode: extract the same-dir-elements |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
494 (let ((dir (cvs-fileinfo->dir (car fis)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
495 ;; output the concerned dir so the parser can translate paths |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
496 (let ((inhibit-read-only t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
497 (insert "pcl-cvs: descending directory " dir "\n")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
498 ;; loop to find the same-dir-elems |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
499 (do* ((files () (cons (cvs-fileinfo->file fi) files)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
500 (fis fis (cdr fis)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
501 (fi (car fis) (car fis))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
502 ((not (and fis (string= dir (cvs-fileinfo->dir fi)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
503 (list dir files fis)))))) |
30618
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
504 (dir (nth 0 dir+files+rest)) |
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
505 (files (nth 1 dir+files+rest)) |
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
506 (rest (nth 2 dir+files+rest))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
507 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
508 ;; setup the (current) process buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
509 (set (make-local-variable 'cvs-postprocess) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
510 (if (null rest) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
511 ;; this is the last invocation |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
512 postprocess |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
513 ;; else, we have to register ourselves to be rerun on the rest |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
514 `(cvs-run-process ',args ',rest ',postprocess ',single-dir))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
515 (add-hook 'kill-buffer-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
516 (lambda () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
517 (let ((proc (get-buffer-process (current-buffer)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
518 (when (processp proc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
519 (set-process-filter proc nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
520 (set-process-sentinel proc nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
521 (delete-process proc)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
522 nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
523 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
524 ;; create the new process and setup the procbuffer correspondingly |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
525 (let* ((args (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
526 (if cvs-cvsroot (list "-d" cvs-cvsroot)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
527 args |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
528 files)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
529 (process-connection-type nil) ; Use a pipe, not a pty. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
530 (process |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
531 ;; the process will be run in the selected dir |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
532 (let ((default-directory (cvs-expand-dir-name dir))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
533 (apply 'start-process "cvs" procbuf cvs-program args)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
534 (set-process-sentinel process 'cvs-sentinel) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 (set-process-filter process 'cvs-update-filter) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 (set-marker (process-mark process) (point-max)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
537 (ignore-errors (process-send-eof process)) ;close its stdin to avoid hangs |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
538 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
539 ;; now finish setting up the cvs-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
540 (set-buffer cvsbuf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
541 (setq cvs-mode-line-process (symbol-name (process-status process))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
542 (force-mode-line-update))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
543 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
544 ;; The following line is said to improve display updates on some |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
545 ;; emacsen. It shouldn't be needed, but it does no harm. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
546 (sit-for 0)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
547 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
548 (defun cvs-update-header (args fis) ; inline |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
549 (let* ((lastarg nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
550 ;; filter out the largish commit message |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
551 (args (mapcar (lambda (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
552 (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
553 ((and (eq lastarg nil) (string= arg "commit")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
554 (setq lastarg 'commit) arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
555 ((and (eq lastarg 'commit) (string= arg "-m")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
556 (setq lastarg '-m) arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
557 ((eq lastarg '-m) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
558 (setq lastarg 'done) "<log message>") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
559 (t arg))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
560 args)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 ;; turn them into a string |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
562 (arg (cvs-strings->string |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
564 (if cvs-cvsroot (list "-d" cvs-cvsroot)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 args |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
566 (mapcar 'cvs-fileinfo->full-path fis)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
567 (str (if args (concat "-- Running " cvs-program " " arg " ...\n") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
568 "\n"))) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
569 (if nil (insert str) ;inline |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 ;;(with-current-buffer cvs-buffer |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
571 (let* ((prev-msg (car (ewoc-get-hf cvs-cookies))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
572 (tin (ewoc-nth cvs-cookies 0))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
573 ;; look for the first *real* fileinfo (to determine emptyness) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
574 (while |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
575 (and tin |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
576 (memq (cvs-fileinfo->type (ewoc-data tin)) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
577 '(MESSAGE DIRCHANGE))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
578 (setq tin (ewoc-next cvs-cookies tin))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
579 ;; cleanup the prev-msg |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
580 (when (string-match "Running \\(.*\\) ...\n" prev-msg) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
581 (setq prev-msg |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
582 (concat |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
583 "-- last cmd: " |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
584 (match-string 1 prev-msg) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
585 " --"))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
586 ;; set the new header and footer |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
587 (ewoc-set-hf cvs-cookies |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
588 str (concat "\n--------------------- " |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
589 (if tin "End" "Empty") |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
590 " ---------------------\n" |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
591 prev-msg)))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
592 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
593 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
594 (defun cvs-sentinel (proc msg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
595 "Sentinel for the cvs update process. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
596 This is responsible for parsing the output from the cvs update when |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
597 it is finished." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
598 (when (memq (process-status proc) '(signal exit)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
599 (if (null (buffer-name (process-buffer proc))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
600 ;;(set-process-buffer proc nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
601 (error "cvs' process buffer was killed") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
602 (let* ((obuf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
603 (procbuffer (process-buffer proc))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
604 (set-buffer (with-current-buffer procbuffer cvs-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
605 (setq cvs-mode-line-process (symbol-name (process-status proc))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
606 (force-mode-line-update) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
607 (set-buffer procbuffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
608 (let ((cvs-postproc cvs-postprocess)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
609 ;; Since the buffer and mode line will show that the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
610 ;; process is dead, we can delete it now. Otherwise it |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
611 ;; will stay around until M-x list-processes. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
612 (delete-process proc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
613 (setq cvs-postprocess nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
614 ;; do the postprocessing like parsing and such |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
615 (save-excursion (eval cvs-postproc)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
616 ;; check whether something is left |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
617 (unless cvs-postprocess |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
618 (buffer-enable-undo) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
619 (with-current-buffer cvs-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
620 (cvs-update-header nil nil) ;FIXME: might need to be inline |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
621 (message "CVS process has completed")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
622 ;; This might not even be necessary |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
623 (set-buffer obuf))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
624 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
625 (defun cvs-parse-process (dcd &optional subdir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
626 "FIXME: bad name, no doc" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
627 (let* ((from-buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
628 (fileinfos (cvs-parse-buffer 'cvs-parse-table dcd subdir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
629 (_ (set-buffer cvs-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
630 last |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
631 (from-pt (point))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
632 ;; add the new fileinfos |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
633 (dolist (fi fileinfos) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
634 (setq last (cvs-addto-collection cvs-cookies fi last))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
635 (cvs-cleanup-collection cvs-cookies |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
636 (eq cvs-auto-remove-handled t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
637 cvs-auto-remove-directories |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
638 nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
639 ;; update the display (might be unnecessary) |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
640 ;;(ewoc-refresh cvs-cookies) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
641 ;; revert buffers if necessary |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
642 (when (and cvs-auto-revert (not dcd) (not cvs-from-vc)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
643 (cvs-revert-if-needed fileinfos)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
644 ;; get back to where we were. `save-excursion' doesn't seem to |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
645 ;; work in this case, probably because the buffer is reconstructed |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
646 ;; by the cookie code. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
647 (goto-char from-pt) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
648 (set-buffer from-buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
649 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
650 (defmacro defun-cvs-mode (fun args docstring interact &rest body) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
651 "Define a function to be used in a *cvs* buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
652 This will look for a *cvs* buffer and execute BODY in it. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
653 Since the interactive arguments might need to be queried after |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
654 switching to the *cvs* buffer, the generic code is rather ugly, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
655 but luckily we can often use simpler alternatives. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
656 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
657 FUN can be either a symbol (i.e. STYLE is nil) or a cons (FUN . STYLE). |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
658 ARGS and DOCSTRING are the normal argument list. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
659 INTERACT is the interactive specification or nil for non-commands. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
660 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
661 STYLE can be either SIMPLE, NOARGS or DOUBLE. It's an error for it |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
662 to have any other value, unless other details of the function make it |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
663 clear what alternative to use. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
664 - SIMPLE will get all the interactive arguments from the original buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
665 - NOARGS will get all the arguments from the *cvs* buffer and will |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
666 always behave as if called interactively. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
667 - DOUBLE is the generic case." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
668 (let ((style (cvs-cdr fun)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
669 (fun (cvs-car fun))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
670 (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
671 ;; a trivial interaction, no need to move it |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
672 ((or (eq style 'SIMPLE) |
30618
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
673 (null (nth 1 interact)) |
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
674 (stringp (nth 1 interact))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
675 `(defun ,fun ,args ,docstring ,interact |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
676 (cvs-mode! (lambda () ,@body)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
677 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
678 ;; fun is only called interactively: move all the args to the inner fun |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
679 ((eq style 'NOARGS) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
680 `(defun ,fun () ,docstring (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
681 (cvs-mode! (lambda ,args ,interact ,@body)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
682 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
683 ;; bad case |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
684 ((eq style 'DOUBLE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
685 (string-match ".*" docstring) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
686 (let ((line1 (match-string 0 docstring)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
687 (restdoc (substring docstring (match-end 0))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
688 (fun-1 (intern (concat (symbol-name fun) "-1")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
689 `(progn |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
690 (defun ,fun-1 ,args |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
691 ,(concat docstring "\nThis function only works within a *cvs* buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
692 For interactive use, use `" (symbol-name fun) "' instead.") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
693 ,interact |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
694 ,@body) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
695 (defun ,fun () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
696 ,(concat line1 "\nWrapper function that switches to a *cvs* buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
697 before calling the real function `" (symbol-name fun-1) "'.\n") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
698 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
699 (cvs-mode! ',fun-1))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
700 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
701 (t (error "unknown style %s in `defun-cvs-mode'" style))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
702 (def-edebug-spec defun-cvs-mode (&define sexp lambda-list stringp ("interactive" interactive) def-body)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
703 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
704 (defun-cvs-mode cvs-mode-kill-process () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
705 "Kill the temporary buffer and associated process." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
706 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
707 (when (and (bufferp cvs-temp-buffer) (buffer-name cvs-temp-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
708 (let ((proc (get-buffer-process cvs-temp-buffer))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
709 (when proc (delete-process proc))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
710 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
711 ;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
712 ;;; Maintaining the collection in the face of updates |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
713 ;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
714 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
715 (defun cvs-addto-collection (c fi &optional tin) |
32488
1fd2c9a94ec3
* pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32309
diff
changeset
|
716 "Add FI to C and return FI's corresponding tin. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
717 FI is inserted in its proper place or maybe even merged with a preexisting |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
718 fileinfo if applicable. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
719 TIN specifies an optional starting point." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
720 (unless tin (setq tin (ewoc-nth c 0))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
721 (while (and tin (cvs-fileinfo< fi (ewoc-data tin))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
722 (setq tin (ewoc-prev c tin))) |
32488
1fd2c9a94ec3
* pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32309
diff
changeset
|
723 (if (null tin) (ewoc-enter-first c fi) ;empty collection |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
724 (assert (not (cvs-fileinfo< fi (ewoc-data tin)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
725 (let ((next-tin (ewoc-next c tin))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
726 (while (not (or (null next-tin) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
727 (cvs-fileinfo< fi (ewoc-data next-tin)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
728 (setq tin next-tin next-tin (ewoc-next c next-tin))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
729 (if (cvs-fileinfo< (ewoc-data tin) fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
730 ;; tin < fi < next-tin |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
731 (ewoc-enter-after c tin fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
732 ;; fi == tin |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
733 (cvs-fileinfo-update (ewoc-data tin) fi) |
32488
1fd2c9a94ec3
* pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32309
diff
changeset
|
734 (ewoc-invalidate c tin) |
1fd2c9a94ec3
* pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32309
diff
changeset
|
735 tin)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
736 |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
737 (defcustom cvs-cleanup-functions nil |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
738 "Functions to tweak the cleanup process. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
739 The functions are called with a single argument (a FILEINFO) and should |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
740 return a non-nil value if that fileinfo should be removed." |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
741 :group 'pcl-cvs |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
742 :type '(hook :options (cvs-cleanup-removed))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
743 |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
744 (defun cvs-cleanup-removed (fi) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
745 "Non-nil if FI has been cvs-removed but still exists. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
746 This is intended for use on `cvs-cleanup-functions' when you have cvs-removed |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
747 automatically generated files (which should hence not be under CVS control) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
748 but can't commit the removal because the repository's owner doesn't understand |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
749 the problem." |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
750 (and (or (eq (cvs-fileinfo->type fi) 'REMOVED) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
751 (and (eq (cvs-fileinfo->type fi) 'CONFLICT) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
752 (eq (cvs-fileinfo->subtype fi) 'REMOVED))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
753 (file-exists-p (cvs-fileinfo->full-path fi)))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
754 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
755 ;; called at the following times: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
756 ;; - postparse ((eq cvs-auto-remove-handled t) cvs-auto-remove-directories nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
757 ;; - pre-run ((eq cvs-auto-remove-handled 'delayed) nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
758 ;; - remove-handled (t (or cvs-auto-remove-directories 'handled) t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
759 ;; - cvs-cmd-do (nil nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
760 ;; - post-ignore (nil nil nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
761 ;; - acknowledge (nil nil nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
762 ;; - remove (nil nil nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
763 (defun cvs-cleanup-collection (c rm-handled rm-dirs rm-msgs) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
764 "Remove undesired entries. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
765 C is the collection |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
766 RM-HANDLED if non-nil means remove handled entries. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
767 RM-DIRS behaves like `cvs-auto-remove-directories'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
768 RM-MSGS if non-nil means remove messages." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
769 (let (last-fi first-dir (rerun t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
770 (while rerun |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
771 (setq rerun nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
772 (setq first-dir t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
773 (setq last-fi (cvs-create-fileinfo 'DEAD "../" "" "")) ;place-holder |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
774 (ewoc-filter |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
775 c (lambda (fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
776 (let* ((type (cvs-fileinfo->type fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
777 (subtype (cvs-fileinfo->subtype fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
778 (keep |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
779 (case type |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
780 ;; remove temp messages and keep the others |
28862
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
781 (MESSAGE (not (or rm-msgs (eq subtype 'TEMP)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
782 ;; remove entries |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
783 (DEAD nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
784 ;; handled also? |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
785 (UP-TO-DATE (not rm-handled)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
786 ;; keep the rest |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
787 (t (not (run-hook-with-args-until-success |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
788 'cvs-cleanup-functions fi)))))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
789 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
790 ;; mark dirs for removal |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
791 (when (and keep rm-dirs |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
792 (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
793 (not (when first-dir (setq first-dir nil) t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
794 (or (eq rm-dirs 'all) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
795 (not (cvs-string-prefix-p |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
796 (cvs-fileinfo->dir last-fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
797 (cvs-fileinfo->dir fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
798 (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
799 (eq subtype 'FOOTER))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
800 (setf (cvs-fileinfo->type last-fi) 'DEAD) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
801 (setq rerun t)) |
28862
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
802 (when keep (setq last-fi fi))))) |
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
803 ;; remove empty last dir |
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
804 (when (and rm-dirs |
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
805 (not first-dir) |
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
806 (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE)) |
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
807 (setf (cvs-fileinfo->type last-fi) 'DEAD) |
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
808 (setq rerun t))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
809 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
810 (defun cvs-get-cvsroot () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
811 "Gets the CVSROOT for DIR." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
812 (let ((cvs-cvsroot-file (expand-file-name "Root" "CVS"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
813 (or (cvs-file-to-string cvs-cvsroot-file t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
814 cvs-cvsroot |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
815 (getenv "CVSROOT") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
816 "?????"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
817 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
818 (defun cvs-get-module () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
819 "Return the current CVS module. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
820 This usually doesn't really work but is a handy initval in a prompt." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
821 (let* ((repfile (expand-file-name "Repository" "CVS")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
822 (rep (cvs-file-to-string repfile t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
823 (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
824 ((null rep) "") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
825 ((not (file-name-absolute-p rep)) rep) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
826 (t |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
827 (let* ((root (cvs-get-cvsroot)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
828 (str (concat (file-name-as-directory (or root "/")) " || " rep))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
829 (if (and root (string-match "\\(.*\\) || \\1\\(.*\\)\\'" str)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
830 (match-string 2 str) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
831 (file-name-nondirectory rep))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
832 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
833 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
834 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
835 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
836 ;;;; running a "cvs checkout". |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
837 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
838 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
839 ;;;###autoload |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
840 (defun cvs-checkout (modules dir flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
841 "Run a 'cvs checkout MODULES' in DIR. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
842 Feed the output to a *cvs* buffer, display it in the current window, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
843 and run `cvs-mode' on it. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
844 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
845 With a prefix argument, prompt for cvs FLAGS to use." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
846 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
847 (list (cvs-string->strings (read-string "Module(s): " (cvs-get-module))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
848 (read-file-name "CVS Checkout Directory: " |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
849 nil default-directory nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
850 (cvs-add-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
851 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
852 (when (eq flags t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
853 (setf flags (cvs-flags-query 'cvs-checkout-flags nil 'noquery))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
854 (cvs-cmd-do "checkout" (or dir default-directory) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
855 (append flags modules) nil 'new |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
856 :noexist t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
857 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
858 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
859 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
860 ;;;; The code for running a "cvs update" and friends in various ways. |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
861 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
862 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
863 (defun-cvs-mode (cvs-mode-revert-buffer . SIMPLE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
864 (&optional ignore-auto noconfirm) |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
865 "Rerun `cvs-examine' on the current directory with the defauls flags." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
866 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
867 (cvs-examine default-directory t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
868 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
869 (defun cvs-query-directory (msg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
870 ;; last-command-char = ?\r hints that the command was run via M-x |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
871 (if (and (cvs-buffer-p) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
872 (not current-prefix-arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
873 (not (eq last-command-char ?\r))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
874 default-directory |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
875 (read-file-name msg nil default-directory nil))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
876 |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
877 ;;;###autoload |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
878 (defun cvs-quickdir (dir &optional flags noshow) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
879 "Open a *cvs* buffer on DIR without running cvs. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
880 With a prefix argument, prompt for a directory to use. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
881 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]), |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
882 prevents reuse of an existing *cvs* buffer. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
883 Optional argument NOSHOW if non-nil means not to display the buffer. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
884 FLAGS is ignored." |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
885 (interactive (list (cvs-query-directory "CVS quickdir (directory): "))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
886 ;; FIXME: code duplication with cvs-cmd-do and cvs-parse-process |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
887 (let* ((dir (file-name-as-directory |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
888 (abbreviate-file-name (expand-file-name dir)))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
889 (new (> (prefix-numeric-value current-prefix-arg) 8)) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
890 (cvsbuf (cvs-make-cvs-buffer dir new)) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
891 last) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
892 ;; Check that dir is under CVS control. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
893 (unless (file-directory-p dir) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
894 (error "%s is not a directory" dir)) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
895 (unless (file-directory-p (expand-file-name "CVS" dir)) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
896 (error "%s does not contain CVS controlled files" dir)) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
897 (set-buffer cvsbuf) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
898 (dolist (fi (cvs-fileinfo-from-entries "")) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
899 (setq last (cvs-addto-collection cvs-cookies fi last))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
900 (cvs-cleanup-collection cvs-cookies |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
901 (eq cvs-auto-remove-handled t) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
902 cvs-auto-remove-directories |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
903 nil) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
904 (if noshow cvsbuf |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
905 (let ((pop-up-windows nil)) (pop-to-buffer cvsbuf))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
906 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
907 ;;;###autoload |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
908 (defun cvs-examine (directory flags &optional noshow) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
909 "Run a `cvs -n update' in the specified DIRECTORY. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
910 That is, check what needs to be done, but don't change the disc. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
911 Feed the output to a *cvs* buffer and run `cvs-mode' on it. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
912 With a prefix argument, prompt for a directory and cvs FLAGS to use. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
913 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]), |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
914 prevents reuse of an existing *cvs* buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
915 Optional argument NOSHOW if non-nil means not to display the buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
916 (interactive (list (cvs-query-directory "CVS Examine (directory): ") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
917 (cvs-flags-query 'cvs-update-flags "cvs -n update flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
918 (when (eq flags t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
919 (setf flags (cvs-flags-query 'cvs-update-flags nil 'noquery))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
920 (cvs-cmd-do "update" directory flags nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
921 (> (prefix-numeric-value current-prefix-arg) 8) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
922 :cvsargs '("-n") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
923 :noshow noshow |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
924 :dont-change-disc t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
925 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
926 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
927 ;;;###autoload |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
928 (defun cvs-update (directory flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
929 "Run a `cvs update' in the current working DIRECTORY. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
930 Feed the output to a *cvs* buffer and run `cvs-mode' on it. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
931 With a prefix argument, prompt for a directory and cvs FLAGS to use. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
932 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]), |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
933 prevents reuse of an existing *cvs* buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
934 (interactive (list (cvs-query-directory "CVS Update (directory): ") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
935 (cvs-flags-query 'cvs-update-flags "cvs update flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
936 (when (eq flags t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
937 (setf flags (cvs-flags-query 'cvs-update-flags nil 'noquery))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
938 (cvs-cmd-do "update" directory flags nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
939 (> (prefix-numeric-value current-prefix-arg) 8))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
940 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
941 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
942 ;;;###autoload |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
943 (defun cvs-status (directory flags &optional noshow) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
944 "Run a `cvs status' in the current working DIRECTORY. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
945 Feed the output to a *cvs* buffer and run `cvs-mode' on it. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
946 With a prefix argument, prompt for a directory and cvs FLAGS to use. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
947 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]), |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
948 prevents reuse of an existing *cvs* buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
949 Optional argument NOSHOW if non-nil means not to display the buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
950 (interactive (list (cvs-query-directory "CVS Status (directory): ") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
951 (cvs-flags-query 'cvs-status-flags "cvs status flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
952 (when (eq flags t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
953 (setf flags (cvs-flags-query 'cvs-status-flags nil 'noquery))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
954 (cvs-cmd-do "status" directory flags nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
955 (> (prefix-numeric-value current-prefix-arg) 8) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
956 :noshow noshow :dont-change-disc t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
957 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
958 (defun cvs-update-filter (proc string) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
959 "Filter function for pcl-cvs. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
960 This function gets the output that CVS sends to stdout. It inserts |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
961 the STRING into (process-buffer PROC) but it also checks if CVS is waiting |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
962 for a lock file. If so, it inserts a message cookie in the *cvs* buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
963 (save-match-data |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
964 (with-current-buffer (process-buffer proc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
965 (let ((inhibit-read-only t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
966 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
967 ;; Insert the text, moving the process-marker. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
968 (goto-char (process-mark proc)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
969 (insert string) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
970 (set-marker (process-mark proc) (point)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
971 ;; FIXME: Delete any old lock message |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
972 ;;(if (tin-nth cookies 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
973 ;; (tin-delete cookies |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
974 ;; (tin-nth cookies 1))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
975 ;; Check if CVS is waiting for a lock. |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
976 (beginning-of-line 0) ;Move to beginning of last complete line. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
977 (when (looking-at "^[ a-z]+: \\(.*waiting for .*lock in \\(.*\\)\\)$") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
978 (let ((msg (match-string 1)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
979 (lock (match-string 2))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
980 (with-current-buffer cvs-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
981 (set (make-local-variable 'cvs-lock-file) lock) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
982 ;; display the lock situation in the *cvs* buffer: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
983 (ewoc-enter-last |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
984 cvs-cookies |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
985 (cvs-create-fileinfo |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
986 'MESSAGE "" " " |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
987 (concat msg |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
988 (substitute-command-keys |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
989 "\n\t(type \\[cvs-mode-delete-lock] to delete it)")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
990 :subtype 'TEMP)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
991 (pop-to-buffer (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
992 (goto-char (point-max)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
993 (beep))))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
994 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
995 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
996 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
997 ;;;; The cvs-mode and its associated commands. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
998 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
999 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1000 (cvs-prefix-define cvs-force-command "" "" '("/F") cvs-qtypedesc-string1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1001 (defun-cvs-mode cvs-mode-force-command (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1002 "Force the next cvs command to operate on all the selected files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1003 By default, cvs commands only operate on files on which the command |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1004 \"makes sense\". This overrides the safety feature on the next cvs command. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1005 It actually behaves as a toggle. If prefixed by \\[universal-argument] \\[universal-argument], |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1006 the override will persist until the next toggle." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1007 (interactive "P") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1008 (cvs-prefix-set 'cvs-force-command arg)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1009 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1010 (put 'cvs-mode 'mode-class 'special) |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1011 (define-derived-mode cvs-mode fundamental-mode "CVS" |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1012 "Mode used for PCL-CVS, a frontend to CVS. |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1013 Full documentation is in the Texinfo file." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1014 (setq mode-line-process |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1015 '("" cvs-force-command cvs-ignore-marks-modif |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1016 ":" (cvs-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1017 ("" cvs-branch-prefix (cvs-secondary-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1018 ("->" cvs-secondary-branch-prefix)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1019 " " cvs-mode-line-process)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1020 (buffer-disable-undo (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1021 ;;(set (make-local-variable 'goal-column) cvs-cursor-column) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1022 (set (make-local-variable 'revert-buffer-function) 'cvs-mode-revert-buffer) |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1023 (setq truncate-lines t) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1024 (cvs-prefix-make-local 'cvs-branch-prefix) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1025 (cvs-prefix-make-local 'cvs-secondary-branch-prefix) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1026 (cvs-prefix-make-local 'cvs-force-command) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1027 (cvs-prefix-make-local 'cvs-ignore-marks-modif) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1028 (make-local-variable 'cvs-mode-line-process) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1029 (make-local-variable 'cvs-temp-buffers)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1030 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1031 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1032 (defun cvs-buffer-p (&optional buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1033 "Return whether the (by default current) BUFFER is a `cvs-mode' buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1034 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1035 (if buffer (set-buffer buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1036 (and (eq major-mode 'cvs-mode)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1037 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1038 (defun cvs-buffer-check () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1039 "Check that the current buffer follows cvs-buffer's conventions." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1040 (let ((buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1041 (check 'none)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1042 (or (and (setq check 'collection) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1043 (eq (ewoc-buffer cvs-cookies) buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1044 (setq check 'cvs-temp-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1045 (or (null cvs-temp-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1046 (null (buffer-name cvs-temp-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1047 (and (eq (with-current-buffer cvs-temp-buffer cvs-buffer) buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1048 (equal (with-current-buffer cvs-temp-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1049 default-directory) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1050 default-directory))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1051 t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1052 (error "Inconsistent %s in buffer %s" check (buffer-name buf))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1053 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1054 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1055 (defun-cvs-mode cvs-mode-quit () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1056 "Quit PCL-CVS, killing the *cvs* buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1057 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1058 (and (y-or-n-p "Quit pcl-cvs? ") (kill-buffer (current-buffer)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1059 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1060 ;; Give help.... |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1061 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1062 (defun cvs-help () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1063 "Display help for various PCL-CVS commands." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1064 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1065 (if (eq last-command 'cvs-help) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1066 (describe-function 'cvs-mode) ; would need minor-mode for cvs-edit-mode |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1067 (message |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1068 (substitute-command-keys |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1069 "`\\[cvs-help]':help `\\[cvs-mode-add]':add `\\[cvs-mode-commit]':commit \ |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1070 `\\[cvs-mode-diff-map]':diff* `\\[cvs-mode-log]':log \ |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1071 `\\[cvs-mode-remove]':remove `\\[cvs-mode-status]':status \ |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1072 `\\[cvs-mode-undo]':undo")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1073 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1074 (defun cvs-mode-diff-help () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1075 "Display help for various PCL-CVS diff commands." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1076 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1077 (if (eq last-command 'cvs-mode-diff-help) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1078 (describe-function 'cvs-mode) ; no better docs for diff stuff? |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1079 (message |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1080 (substitute-command-keys |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1081 "`\\[cvs-mode-diff]':diff `\\[cvs-mode-idiff]':idiff \ |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1082 `\\[cvs-mode-diff-head]':head `\\[cvs-mode-diff-vendor]':vendor \ |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1083 `\\[cvs-mode-diff-backup]':backup `\\[cvs-mode-idiff-other]':other \ |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1084 `\\[cvs-mode-imerge]':imerge")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1085 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1086 ;; Move around in the buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1087 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1088 (defun-cvs-mode cvs-mode-previous-line (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1089 "Go to the previous line. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1090 If a prefix argument is given, move by that many lines." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1091 (interactive "p") |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1092 (ewoc-goto-prev cvs-cookies arg)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1093 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1094 (defun-cvs-mode cvs-mode-next-line (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1095 "Go to the next line. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1096 If a prefix argument is given, move by that many lines." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1097 (interactive "p") |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1098 (ewoc-goto-next cvs-cookies arg)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1099 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1100 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1101 ;;;; Mark handling |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1102 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1103 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1104 (defun-cvs-mode cvs-mode-mark (&optional arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1105 "Mark the fileinfo on the current line. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1106 If the fileinfo is a directory, all the contents of that directory are |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1107 marked instead. A directory can never be marked." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1108 (interactive) |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1109 (let* ((tin (ewoc-locate cvs-cookies)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1110 (fi (ewoc-data tin))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1111 (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1112 ;; it's a directory: let's mark all files inside |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1113 (ewoc-map |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1114 (lambda (f dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1115 (when (cvs-dir-member-p f dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1116 (setf (cvs-fileinfo->marked f) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1117 (not (if (eq arg 'toggle) (cvs-fileinfo->marked f) arg))) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1118 t)) ;Tell cookie to redisplay this cookie. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1119 cvs-cookies |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1120 (cvs-fileinfo->dir fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1121 ;; not a directory: just do the obvious |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1122 (setf (cvs-fileinfo->marked fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1123 (not (if (eq arg 'toggle) (cvs-fileinfo->marked fi) arg))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1124 (ewoc-invalidate cvs-cookies tin) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1125 (cvs-mode-next-line 1)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1126 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1127 (defun cvs-mouse-toggle-mark (e) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1128 "Toggle the mark of the entry under the mouse." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1129 (interactive "e") |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1130 (save-excursion |
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1131 (mouse-set-point e) |
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1132 (cvs-mode-mark 'toggle))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1133 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1134 (defun-cvs-mode cvs-mode-unmark () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1135 "Unmark the fileinfo on the current line." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1136 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1137 (cvs-mode-mark t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1138 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1139 (defun-cvs-mode cvs-mode-mark-all-files () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1140 "Mark all files." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1141 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1142 (ewoc-map (lambda (cookie) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1143 (unless (eq (cvs-fileinfo->type cookie) 'DIRCHANGE) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1144 (setf (cvs-fileinfo->marked cookie) t))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1145 cvs-cookies)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1146 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1147 (defun-cvs-mode cvs-mode-mark-matching-files (regex) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1148 "Mark all files matching REGEX." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1149 (interactive "sMark files matching: ") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1150 (ewoc-map (lambda (cookie) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1151 (when (and (not (eq (cvs-fileinfo->type cookie) 'DIRCHANGE)) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1152 (string-match regex (cvs-fileinfo->file cookie))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1153 (setf (cvs-fileinfo->marked cookie) t))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1154 cvs-cookies)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1155 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1156 (defun-cvs-mode cvs-mode-unmark-all-files () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1157 "Unmark all files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1158 Directories are also unmarked, but that doesn't matter, since |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1159 they should always be unmarked." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1160 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1161 (ewoc-map (lambda (cookie) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1162 (setf (cvs-fileinfo->marked cookie) nil) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1163 t) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1164 cvs-cookies)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1165 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1166 (defun-cvs-mode cvs-mode-unmark-up () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1167 "Unmark the file on the previous line." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1168 (interactive) |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1169 (let ((tin (ewoc-goto-prev cvs-cookies 1))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1170 (when tin |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1171 (setf (cvs-fileinfo->marked (ewoc-data tin)) nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1172 (ewoc-invalidate cvs-cookies tin)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1173 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1174 (defconst cvs-ignore-marks-alternatives |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1175 '(("toggle-marks" . "/TM") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1176 ("force-marks" . "/FM") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1177 ("ignore-marks" . "/IM"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1178 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1179 (cvs-prefix-define cvs-ignore-marks-modif |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1180 "Prefix to decide whether to ignore marks or not." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1181 "active" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1182 (mapcar 'cdr cvs-ignore-marks-alternatives) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1183 (cvs-qtypedesc-create |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1184 (lambda (str) (cdr (assoc str cvs-ignore-marks-alternatives))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1185 (lambda (obj) (caar (member* obj cvs-ignore-marks-alternatives :key 'cdr))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1186 (lambda () cvs-ignore-marks-alternatives) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1187 nil t)) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1188 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1189 (defun-cvs-mode cvs-mode-toggle-marks (arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1190 "Toggle whether the next CVS command uses marks. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1191 See `cvs-prefix-set' for further description of the behavior. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1192 \\[universal-argument] 1 selects `force-marks', |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1193 \\[universal-argument] 2 selects `ignore-marks', |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1194 \\[universal-argument] 3 selects `toggle-marks'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1195 (interactive "P") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1196 (cvs-prefix-set 'cvs-ignore-marks-modif arg)) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1197 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1198 (defun cvs-ignore-marks-p (cmd &optional read-only) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1199 (let ((default (if (member cmd cvs-invert-ignore-marks) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1200 (not cvs-default-ignore-marks) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1201 cvs-default-ignore-marks)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1202 (modif (cvs-prefix-get 'cvs-ignore-marks-modif read-only))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1203 (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1204 ((equal modif "/IM") t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1205 ((equal modif "/TM") (not default)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1206 ((equal modif "/FM") nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1207 (t default)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1208 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1209 (defun cvs-mode-mark-get-modif (cmd) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1210 (if (cvs-ignore-marks-p cmd 'read-only) "/IM" "/FM")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1211 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1212 (defvar cvs-minor-current-files) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1213 (defun cvs-get-marked (&optional ignore-marks ignore-contents) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1214 "Return a list of all selected fileinfos. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1215 If there are any marked tins, and IGNORE-MARKS is nil, return them. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1216 Otherwise, if the cursor selects a directory, and IGNORE-CONTENTS is |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1217 nil, return all files in it, else return just the directory. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1218 Otherwise return (a list containing) the file the cursor points to, or |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1219 an empty list if it doesn't point to a file at all. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1220 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1221 Args: &optional IGNORE-MARKS IGNORE-CONTENTS." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1222 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1223 (let ((fis nil)) |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1224 (dolist (fi (if (and (boundp 'cvs-minor-current-files) |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1225 (consp cvs-minor-current-files)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1226 (mapcar |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1227 (lambda (f) |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1228 (if (cvs-fileinfo-p f) f |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1229 (let ((f (file-relative-name f))) |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1230 (if (file-directory-p f) |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1231 (cvs-create-fileinfo |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1232 'DIRCHANGE (file-name-as-directory f) "." "") |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1233 (let ((dir (file-name-directory f)) |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1234 (file (file-name-nondirectory f))) |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1235 (cvs-create-fileinfo |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1236 'UNKNOWN (or dir "") file "")))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1237 cvs-minor-current-files) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1238 (or (and (not ignore-marks) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1239 (ewoc-collect cvs-cookies 'cvs-fileinfo->marked)) |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1240 (list (ewoc-data (ewoc-locate cvs-cookies)))))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1241 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1242 (if (or ignore-contents (not (eq (cvs-fileinfo->type fi) 'DIRCHANGE))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1243 (push fi fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1244 ;; If a directory is selected, return members, if any. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1245 (setq fis |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1246 (append (ewoc-collect cvs-cookies |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1247 'cvs-dir-member-p |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1248 (cvs-fileinfo->dir fi)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1249 fis)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1250 (nreverse fis))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1251 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1252 (defun* cvs-mode-marked (filter &optional (cmd (symbol-name filter)) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1253 &key read-only one file noquery) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1254 "Get the list of marked FIS. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1255 CMD is used to determine whether to use the marks or not. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1256 Only files for which FILTER is applicable are returned. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1257 If READ-ONLY is non-nil, the current toggling is left intact. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1258 If ONE is non-nil, marks are ignored and a single FI is returned. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1259 If FILE is non-nil, directory entries won't be selected." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1260 (let* ((fis (cvs-get-marked (or one (cvs-ignore-marks-p cmd read-only)) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1261 (and (not file) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1262 (cvs-applicable-p 'DIRCHANGE filter)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1263 (force (cvs-prefix-get 'cvs-force-command)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1264 (fis (car (cvs-partition |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1265 (lambda (fi) (cvs-applicable-p fi (and (not force) filter))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1266 fis)))) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1267 (when (and (or (null fis) (and one (cdr fis))) (not noquery)) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1268 (message (if (null fis) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1269 "`%s' is not applicable to any of the selected files." |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1270 "`%s' is only applicable to a single file.") cmd) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1271 (sit-for 0.5) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1272 (setq fis (list (cvs-insert-file |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1273 (read-file-name (format "File to %s: " cmd)))))) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1274 (if one (car fis) fis))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1275 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1276 (defun cvs-enabledp (filter) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1277 "Determine whether FILTER applies to at least one of the selected files." |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1278 (ignore-errors (cvs-mode-marked filter nil :read-only t :noquery t))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1279 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1280 (defun cvs-mode-files (&rest -cvs-mode-files-args) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1281 (cvs-mode! |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1282 (lambda () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1283 (mapcar 'cvs-fileinfo->full-path |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1284 (apply 'cvs-mode-marked -cvs-mode-files-args))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1285 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1286 ;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1287 ;;; Interface between CVS-Edit and PCL-CVS |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1288 ;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1289 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1290 (defun cvs-mode-commit-setup () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1291 "Run `cvs-mode-commit' with setup." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1292 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1293 (cvs-mode-commit 'force)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1294 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1295 (defun cvs-mode-commit (setup) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1296 "Check in all marked files, or the current file. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1297 The user will be asked for a log message in a buffer. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1298 The buffer's mode and name is determined by the \"message\" setting |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1299 of `cvs-buffer-name-alist'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1300 The POSTPROC specified there (typically `cvs-edit') is then called, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1301 passing it the SETUP argument." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1302 (interactive "P") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1303 ;; It seems that the save-excursion that happens if I use the better |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1304 ;; form of `(cvs-mode! (lambda ...))' screws up a couple things which |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1305 ;; end up being rather annoying (like cvs-edit-mode's message being |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1306 ;; displayed in the wrong minibuffer). |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1307 (cvs-mode!) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1308 (pop-to-buffer (cvs-temp-buffer "message" 'normal 'nosetup)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1309 (set (make-local-variable 'cvs-minor-wrap-function) 'cvs-commit-minor-wrap) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1310 (let ((lbd list-buffers-directory) |
30618
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
1311 (setupfun (or (nth 2 (cdr (assoc "message" cvs-buffer-name-alist))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1312 'cvs-edit))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1313 (funcall setupfun 'cvs-do-commit setup 'cvs-commit-filelist) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1314 (set (make-local-variable 'list-buffers-directory) lbd))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1315 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1316 (defun cvs-commit-minor-wrap (buf f) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1317 (let ((cvs-ignore-marks-modif (cvs-mode-mark-get-modif "commit"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1318 (funcall f))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1319 |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1320 (defun cvs-commit-filelist () |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1321 (cvs-mode-files 'commit nil :read-only t :file t :noquery t)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1322 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1323 (defun cvs-do-commit (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1324 "Do the actual commit, using the current buffer as the log message." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1325 (interactive (list (cvs-flags-query 'cvs-commit-flags "cvs commit flags"))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1326 (let ((msg (buffer-substring-no-properties (point-min) (point-max)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1327 (cvs-mode!) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1328 ;;(pop-to-buffer cvs-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1329 (cvs-mode-do "commit" (list* "-m" msg flags) 'commit))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1330 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1331 |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1332 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1333 ;;;; CVS Mode commands |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1334 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1335 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1336 (defun-cvs-mode (cvs-mode-insert . NOARGS) (file) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1337 "Insert an entry for a specific file." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1338 (interactive |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1339 (list (read-file-name "File to insert: " |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1340 ;; Can't use ignore-errors here because interactive |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1341 ;; specs aren't byte-compiled. |
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1342 (condition-case nil |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1343 (file-name-as-directory |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1344 (expand-file-name |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1345 (cvs-fileinfo->dir |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1346 (car (cvs-mode-marked nil nil :read-only t))))) |
30717
e6e5480e5b25
(cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30618
diff
changeset
|
1347 (error nil))))) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1348 (cvs-insert-file file)) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1349 |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1350 (defun cvs-insert-file (file) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1351 "Insert FILE (and its contents if it's a dir) and return its FI." |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1352 (let ((file (file-relative-name (directory-file-name file))) last) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1353 (dolist (fi (cvs-fileinfo-from-entries file)) |
32488
1fd2c9a94ec3
* pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32309
diff
changeset
|
1354 (setq last (cvs-addto-collection cvs-cookies fi last))) |
1fd2c9a94ec3
* pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32309
diff
changeset
|
1355 ;; There should have been at least one entry. |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1356 (goto-char (ewoc-location last)) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1357 (ewoc-data last))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1358 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1359 (defun-cvs-mode (cvs-mode-add . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1360 "Add marked files to the cvs repository. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1361 With prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1362 (interactive (list (cvs-flags-query 'cvs-add-flags "cvs add flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1363 (let ((fis (cvs-mode-marked 'add)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1364 (needdesc nil) (dirs nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1365 ;; find directories and look for fis needing a description |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1366 (dolist (fi fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1367 (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1368 ((file-directory-p (cvs-fileinfo->full-path fi)) (push fi dirs)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1369 ((eq (cvs-fileinfo->type fi) 'UNKNOWN) (setq needdesc t)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1370 ;; prompt for description if necessary |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1371 (let* ((msg (if (and needdesc |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1372 (or current-prefix-arg (not cvs-add-default-message))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1373 (read-from-minibuffer "Enter description: ") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1374 (or cvs-add-default-message ""))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1375 (flags (list* "-m" msg flags)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1376 (postproc |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1377 ;; setup postprocessing for the directory entries |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1378 (when dirs |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1379 `((cvs-run-process (list "-n" "update") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1380 ',dirs |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1381 '(cvs-parse-process t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1382 (dolist (fi ',dirs) (setf (cvs-fileinfo->type fi) 'DEAD)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1383 (cvs-mode-run "add" flags fis :postproc postproc)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1384 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1385 (defun-cvs-mode (cvs-mode-diff . DOUBLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1386 "Diff the selected files against the repository. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1387 This command compares the files in your working area against the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1388 revision which they are based upon." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1389 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1390 (list (cvs-add-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1391 (cvs-add-secondary-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1392 (cvs-flags-query 'cvs-diff-flags "cvs diff flags"))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1393 (cvs-mode-do "diff" flags 'diff |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1394 :show t)) ;; :ignore-exit t |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1395 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1396 (defun-cvs-mode (cvs-mode-diff-head . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1397 "Diff the selected files against the head of the current branch. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1398 See ``cvs-mode-diff'' for more info." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1399 (interactive (list (cvs-flags-query 'cvs-diff-flags "cvs diff flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1400 (cvs-mode-diff-1 (cons "-rHEAD" flags))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1401 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1402 (defun-cvs-mode (cvs-mode-diff-vendor . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1403 "Diff the selected files against the head of the vendor branch. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1404 See ``cvs-mode-diff'' for more info." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1405 (interactive (list (cvs-flags-query 'cvs-diff-flags "cvs diff flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1406 (cvs-mode-diff-1 (cons (concat "-r" cvs-vendor-branch) flags))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1407 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1408 ;; sadly, this is not provided by cvs, so we have to roll our own |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1409 (defun-cvs-mode (cvs-mode-diff-backup . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1410 "Diff the files against the backup file. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1411 This command can be used on files that are marked with \"Merged\" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1412 or \"Conflict\" in the *cvs* buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1413 (interactive (list (cvs-flags-query 'cvs-diff-flags "diff flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1414 (unless (listp flags) (error "flags should be a list of strings.")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1415 (save-some-buffers) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1416 (let* ((filter 'diff) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1417 (marked (cvs-get-marked (cvs-ignore-marks-p "diff"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1418 ;;(tins (cvs-filter-applicable filter marked)) |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1419 (fis (car (cvs-partition 'cvs-fileinfo->backup-file marked)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1420 (unless (consp fis) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1421 (error "No files with a backup file selected!")) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1422 ;; let's extract some info into the environment for `buffer-name' |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1423 (let* ((dir (cvs-fileinfo->dir (car fis))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1424 (file (cvs-fileinfo->file (car fis)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1425 (set-buffer (cvs-temp-buffer "diff"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1426 (message "cvs diff backup...") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1427 (cvs-execute-single-file-list fis 'cvs-diff-backup-extractor |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1428 cvs-diff-program flags)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1429 (message "cvs diff backup... Done.")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1430 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1431 (defun cvs-diff-backup-extractor (fileinfo) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1432 "Return the filename and the name of the backup file as a list. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1433 Signal an error if there is no backup file." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1434 (let ((backup-file (cvs-fileinfo->backup-file fileinfo))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1435 (unless backup-file |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1436 (error "%s has no backup file." (cvs-fileinfo->full-path fileinfo))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1437 (list backup-file (cvs-fileinfo->file fileinfo)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1438 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1439 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1440 ;; Emerge support |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1441 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1442 (defun cvs-emerge-diff (b1 b2) (emerge-buffers b1 b2 b1)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1443 (defun cvs-emerge-merge (b1 b2 base out) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1444 (emerge-buffers-with-ancestor b1 b2 base (find-file-noselect out))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1445 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1446 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1447 ;; Ediff support |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1448 ;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1449 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1450 (defvar ediff-after-quit-destination-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1451 (defvar cvs-transient-buffers) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1452 (defun cvs-ediff-startup-hook () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1453 (add-hook 'ediff-after-quit-hook-internal |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1454 `(lambda () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1455 (cvs-ediff-exit-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1456 ',ediff-after-quit-destination-buffer ',cvs-transient-buffers)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1457 nil 'local)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1458 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1459 (defun cvs-ediff-exit-hook (cvs-buf tmp-bufs) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1460 ;; kill the temp buffers (and their associated windows) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1461 (dolist (tb tmp-bufs) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1462 (when (and tb (buffer-live-p tb) (not (buffer-modified-p tb))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1463 (let ((win (get-buffer-window tb t))) |
31977
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
1464 (kill-buffer tb) |
32187
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1465 (when (window-live-p win) (ignore-errors (delete-window win)))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1466 ;; switch back to the *cvs* buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1467 (when (and cvs-buf (buffer-live-p cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1468 (not (get-buffer-window cvs-buf t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1469 (ignore-errors (switch-to-buffer cvs-buf)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1470 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1471 (defun cvs-ediff-diff (b1 b2) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1472 (let ((ediff-after-quit-destination-buffer (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1473 (startup-hook '(cvs-ediff-startup-hook))) |
31977
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
1474 (ediff-buffers b1 b2 startup-hook 'ediff-revision))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1475 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1476 (defun cvs-ediff-merge (b1 b2 base out) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1477 (let ((ediff-after-quit-destination-buffer (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1478 (startup-hook '(cvs-ediff-startup-hook))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1479 (ediff-merge-buffers-with-ancestor |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1480 b1 b2 base startup-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1481 'ediff-merge-revisions-with-ancestor |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1482 out))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1483 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1484 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1485 ;; Interactive merge/diff support. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1486 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1487 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1488 (defun cvs-retrieve-revision (fileinfo rev) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1489 "Retrieve the given REVision of the file in FILEINFO into a new buffer." |
32187
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1490 (let* ((file (cvs-fileinfo->full-path fileinfo)) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1491 (buffile (concat file "." rev))) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1492 (or (find-buffer-visiting buffile) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1493 (with-current-buffer (create-file-buffer buffile) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1494 (message "Retrieving revision %s..." rev) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1495 (let ((res (call-process cvs-program nil t nil |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1496 "-q" "update" "-p" "-r" rev file))) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1497 (when (and res (not (and (equal 0 res)))) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1498 (error "Something went wrong retrieving revision %s: %s" rev res)) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1499 (set-buffer-modified-p nil) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1500 (let ((buffer-file-name (expand-file-name file))) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1501 (after-find-file)) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1502 (toggle-read-only 1) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1503 (message "Retrieving revision %s... Done" rev) |
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
1504 (current-buffer)))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1505 |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1506 (eval-and-compile (autoload 'smerge-ediff "smerge-mode")) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1507 |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1508 ;; FIXME: The user should be able to specify ancestor/head/backup and we should |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1509 ;; provide sensible defaults when merge info is unavailable (rather than rely |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1510 ;; on smerge-ediff). Also provide sane defaults for need-merge files. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1511 (defun-cvs-mode cvs-mode-imerge () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1512 "Merge interactively appropriate revisions of the selected file." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1513 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1514 (let ((fi (cvs-mode-marked 'merge nil :one t :file t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1515 (let ((merge (cvs-fileinfo->merge fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1516 (file (cvs-fileinfo->full-path fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1517 (backup-file (cvs-fileinfo->backup-file fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1518 (if (not (and merge backup-file)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1519 (let ((buf (find-file-noselect file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1520 (message "Missing merge info or backup file, using VC.") |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1521 (with-current-buffer buf |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1522 (smerge-ediff))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1523 (let* ((ancestor-buf (cvs-retrieve-revision fi (car merge))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1524 (head-buf (cvs-retrieve-revision fi (cdr merge))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1525 (backup-buf (let ((auto-mode-alist nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1526 (find-file-noselect backup-file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1527 ;; this binding is used by cvs-ediff-startup-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1528 (cvs-transient-buffers (list ancestor-buf backup-buf head-buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1529 (with-current-buffer backup-buf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1530 (let ((buffer-file-name (expand-file-name file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1531 (after-find-file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1532 (funcall (cdr cvs-idiff-imerge-handlers) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1533 backup-buf head-buf ancestor-buf file)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1534 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1535 (cvs-flags-define cvs-idiff-version |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1536 (list "BASE" cvs-vendor-branch cvs-vendor-branch "BASE" "BASE") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1537 "version: " cvs-qtypedesc-tag) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1538 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1539 (defun-cvs-mode (cvs-mode-idiff . NOARGS) (&optional rev1 rev2) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1540 "Diff interactively current file to revisions." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1541 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1542 (let* ((rev1 (cvs-prefix-get 'cvs-branch-prefix)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1543 (rev2 (and rev1 (cvs-prefix-get 'cvs-secondary-branch-prefix)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1544 (list (or rev1 (cvs-flags-query 'cvs-idiff-version)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1545 rev2))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1546 (let ((fi (cvs-mode-marked 'diff "idiff" :one t :file t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1547 (let* ((file (cvs-fileinfo->full-path fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1548 (rev1-buf (cvs-retrieve-revision fi (or rev1 "BASE"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1549 (rev2-buf (if rev2 (cvs-retrieve-revision fi rev2))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1550 ;; this binding is used by cvs-ediff-startup-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1551 (cvs-transient-buffers (list rev1-buf rev2-buf))) |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1552 (funcall (car cvs-idiff-imerge-handlers) |
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1553 rev1-buf (or rev2-buf (find-file-noselect file)))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1554 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1555 (defun-cvs-mode (cvs-mode-idiff-other . NOARGS) () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1556 "Diff interactively current file to revisions." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1557 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1558 (let* ((rev1 (cvs-prefix-get 'cvs-branch-prefix)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1559 (rev2 (and rev1 (cvs-prefix-get 'cvs-secondary-branch-prefix))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1560 (fis (cvs-mode-marked 'diff "idiff" :file t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1561 (when (> (length fis) 2) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1562 (error "idiff-other cannot be applied to more than 2 files at a time.")) |
30879
3a1ff1caafe2
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30717
diff
changeset
|
1563 (let* ((fi1 (car fis)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1564 (rev1-buf (if rev1 (cvs-retrieve-revision fi1 rev1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1565 (find-file-noselect (cvs-fileinfo->full-path fi1)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1566 rev2-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1567 (if (cdr fis) |
30618
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
1568 (let ((fi2 (nth 1 fis))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1569 (setq rev2-buf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1570 (if rev2 (cvs-retrieve-revision fi2 rev2) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1571 (find-file-noselect (cvs-fileinfo->full-path fi2))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1572 (error "idiff-other doesn't know what other file/buffer to use.")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1573 (let* (;; this binding is used by cvs-ediff-startup-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1574 (cvs-transient-buffers (list rev1-buf rev2-buf))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1575 (funcall (car cvs-idiff-imerge-handlers) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1576 rev1-buf rev2-buf))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1577 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1578 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1579 (defun cvs-fileinfo-kill (c fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1580 "Mark a fileinfo xor its members (in case of a directory) as dead." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1581 (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1582 (dolist (fi (ewoc-collect c 'cvs-dir-member-p |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1583 (cvs-fileinfo->dir fi))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1584 (setf (cvs-fileinfo->type fi) 'DEAD)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1585 (setf (cvs-fileinfo->type fi) 'DEAD))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1586 |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1587 (defun cvs-is-within-p (fis dir) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1588 "Non-nil is buffer is inside one of FIS (in DIR)." |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1589 (when (stringp buffer-file-name) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1590 (setq buffer-file-name (expand-file-name buffer-file-name)) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1591 (let (ret) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1592 (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1593 (when (cvs-string-prefix-p |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1594 (expand-file-name (cvs-fileinfo->full-path fi) dir) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1595 buffer-file-name) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1596 (setq ret t))) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1597 ret))) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1598 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1599 (defun* cvs-mode-run (cmd flags fis |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1600 &key (buf (cvs-temp-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1601 dont-change-disc cvsargs postproc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1602 "Generic cvs-mode-<foo> function. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1603 Executes `cvs CVSARGS CMD FLAGS FIS'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1604 BUF is the buffer to be used for cvs' output. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1605 DONT-CHANGE-DISC non-nil indicates that the command will not change the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1606 contents of files. This is only used by the parser. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1607 POSTPROC is a list of expressions to be evaluated at the very end (after |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1608 parsing if applicable). It will be prepended with `progn' is necessary." |
28256
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1609 (let ((def-dir default-directory)) |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1610 ;; Save the relevant buffers |
06cfa273543d
* pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
1611 (save-some-buffers nil (lambda () (cvs-is-within-p fis def-dir)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1612 (unless (listp flags) (error "flags should be a list of strings")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1613 (let* ((cvs-buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1614 (single-dir (or (not (listp cvs-execute-single-dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1615 (member cmd cvs-execute-single-dir))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1616 (parse (member cmd cvs-parse-known-commands)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1617 (args (append cvsargs (list cmd) flags)) |
30618
9dd1a6504bdd
Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents:
30612
diff
changeset
|
1618 (after-mode (nth 2 (cdr (assoc cmd cvs-buffer-name-alist))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1619 (cvs-cleanup-collection cvs-cookies ;cleanup remaining messages |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1620 (eq cvs-auto-remove-handled 'delayed) nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1621 (when (fboundp after-mode) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1622 (setq postproc (append postproc `((,after-mode))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1623 (when parse (push `(cvs-parse-process ',dont-change-disc) postproc)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1624 (when (member cmd '("status" "update")) ;FIXME: Yuck!! |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1625 ;; absence of `cvs update' output has a specific meaning. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1626 (push |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1627 `(dolist (fi ',(or fis |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1628 (list (cvs-create-fileinfo 'DIRCHANGE "" "." "")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1629 (cvs-fileinfo-kill ',cvs-cookies fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1630 postproc)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1631 (setq postproc (if (cdr postproc) (cons 'progn postproc) (car postproc))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1632 (cvs-update-header args fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1633 (with-current-buffer buf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1634 ;;(set (make-local-variable 'cvs-buffer) cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1635 (let ((inhibit-read-only t)) (erase-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1636 (message "Running cvs %s ..." cmd) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1637 (cvs-run-process args fis postproc single-dir)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1638 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1639 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1640 (defun* cvs-mode-do (cmd flags filter |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1641 &key show dont-change-disc parse cvsargs postproc) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1642 "Generic cvs-mode-<foo> function. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1643 Executes `cvs CVSARGS CMD FLAGS' on the selected files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1644 FILTER is passed to `cvs-applicable-p' to only apply the command to |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1645 files for which it makes sense. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1646 SHOW indicates that CMD should be not be run in the default temp buffer and |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1647 should be shown to the user. The buffer and mode to be used is determined |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1648 by `cvs-buffer-name-alist'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1649 DONT-CHANGE-DISC non-nil indicates that the command will not change the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1650 contents of files. This is only used by the parser." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1651 (cvs-mode-run cmd flags (cvs-mode-marked filter cmd) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1652 :buf (cvs-temp-buffer (when show cmd)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1653 :dont-change-disc dont-change-disc |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1654 :cvsargs cvsargs |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1655 :postproc postproc)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1656 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1657 (defun-cvs-mode (cvs-mode-status . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1658 "Show cvs status for all marked files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1659 With prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1660 (interactive (list (cvs-flags-query 'cvs-status-flags "cvs status flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1661 (cvs-mode-do "status" flags nil :dont-change-disc t :show t |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1662 :postproc (when (eq cvs-auto-remove-handled 'status) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1663 '((with-current-buffer ,(current-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1664 (cvs-mode-remove-handled)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1665 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1666 (defun-cvs-mode (cvs-mode-tree . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1667 "Call cvstree using the file under the point as a keyfile." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1668 (interactive (list (cvs-flags-query 'cvs-status-flags "cvs status flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1669 (cvs-mode-run "status" (cons "-v" flags) (cvs-mode-marked nil "status") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1670 :buf (cvs-temp-buffer "tree") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1671 :dont-change-disc t |
33234
39c359a5c419
(cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33195
diff
changeset
|
1672 :postproc '((cvs-status-cvstrees)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1673 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1674 ;; cvs log |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1675 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1676 (defun-cvs-mode (cvs-mode-log . NOARGS) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1677 "Display the cvs log of all selected files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1678 With prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1679 (interactive (list (cvs-add-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1680 (cvs-flags-query 'cvs-log-flags "cvs log flags")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1681 (cvs-mode-do "log" flags nil :show t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1682 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1683 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1684 (defun-cvs-mode (cvs-mode-update . NOARGS) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1685 "Update all marked files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1686 With a prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1687 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1688 (list (cvs-add-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1689 (cvs-add-secondary-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1690 (cvs-flags-query 'cvs-update-flags "cvs update flags") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1691 "-j") "-j"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1692 (cvs-mode-do "update" flags 'update)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1693 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1694 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1695 (defun-cvs-mode (cvs-mode-examine . NOARGS) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1696 "Re-examine all marked files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1697 With a prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1698 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1699 (list (cvs-add-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1700 (cvs-add-secondary-branch-prefix |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1701 (cvs-flags-query 'cvs-update-flags "cvs -n update flags") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1702 "-j") "-j"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1703 (cvs-mode-do "update" flags nil :cvsargs '("-n") :dont-change-disc t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1704 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1705 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1706 (defun-cvs-mode cvs-mode-ignore (&optional pattern) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1707 "Arrange so that CVS ignores the selected files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1708 This command ignores files that are not flagged as `Unknown'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1709 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1710 (dolist (fi (cvs-mode-marked 'ignore)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1711 (cvs-append-to-ignore (cvs-fileinfo->dir fi) (cvs-fileinfo->file fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1712 (setf (cvs-fileinfo->type fi) 'DEAD)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1713 (cvs-cleanup-collection cvs-cookies nil nil nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1714 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1715 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1716 (defun cvs-append-to-ignore (dir str) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1717 "Add STR to the .cvsignore file in DIR." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1718 (save-window-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1719 (set-buffer (find-file-noselect (expand-file-name ".cvsignore" dir))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1720 (when (ignore-errors |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1721 (and buffer-read-only |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1722 (eq 'CVS (vc-backend buffer-file-name)) |
32309
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
1723 (not (vc-editable-p buffer-file-name)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1724 ;; CVSREAD=on special case |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1725 (vc-toggle-read-only)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1726 (goto-char (point-max)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1727 (unless (zerop (current-column)) (insert "\n")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1728 (insert str "\n") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1729 (if cvs-sort-ignore-file (sort-lines nil (point-min) (point-max))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1730 (save-buffer))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1731 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1732 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1733 (defun cvs-mode-find-file-other-window (e) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1734 "Select a buffer containing the file in another window." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1735 (interactive (list last-input-event)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1736 (cvs-mode-find-file e t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1737 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1738 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1739 (defun cvs-find-modif (fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1740 (with-temp-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1741 (call-process cvs-program nil (current-buffer) nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1742 "-f" "diff" (cvs-fileinfo->file fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1743 (goto-char (point-min)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1744 (if (re-search-forward "^\\([0-9]+\\)" nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1745 (string-to-number (match-string 1)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1746 1))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1747 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1748 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1749 (defun cvs-mode-find-file (e &optional other) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1750 "Select a buffer containing the file. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1751 With a prefix, opens the buffer in an OTHER window." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1752 (interactive (list last-input-event current-prefix-arg)) |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1753 (when (ignore-errors (mouse-set-point e) t) ;for invocation via the mouse |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1754 (unless (memq (get-text-property (point) 'face) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1755 '(cvs-dirname-face cvs-filename-face)) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
1756 (error "Not a file name"))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1757 (cvs-mode! |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1758 (lambda (&optional rev) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1759 (interactive (list (cvs-prefix-get 'cvs-branch-prefix))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1760 (let* ((cvs-buf (current-buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1761 (fi (cvs-mode-marked nil nil :one t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1762 (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1763 (let ((odir default-directory)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1764 (setq default-directory |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1765 (cvs-expand-dir-name (cvs-fileinfo->dir fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1766 (if other |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1767 (dired-other-window default-directory) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1768 (dired default-directory)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1769 (set-buffer cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1770 (setq default-directory odir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1771 (let ((buf (if rev (cvs-retrieve-revision fi rev) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1772 (find-file-noselect (cvs-fileinfo->full-path fi))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1773 (funcall (if other 'switch-to-buffer-other-window 'switch-to-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1774 buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1775 (when (and cvs-find-file-and-jump (cvs-applicable-p fi 'diff-base)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1776 (goto-line (cvs-find-modif fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1777 buf)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1778 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1779 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1780 (defun-cvs-mode (cvs-mode-undo . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1781 "Undo local changes to all marked files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1782 The file is removed and `cvs update FILE' is run." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1783 ;;"With prefix argument, prompt for cvs FLAGS." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1784 (interactive (list nil));; (cvs-flags-query 'cvs-undo-flags "undo flags") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1785 (if current-prefix-arg (call-interactively 'cvs-mode-revert-to-rev) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1786 (let* ((fis (cvs-do-removal 'undo "update" 'all)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1787 (removedp (lambda (fi) (eq (cvs-fileinfo->type fi) 'REMOVED))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1788 (fis-split (cvs-partition removedp fis)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1789 (fis-removed (car fis-split)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1790 (fis-other (cdr fis-split))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1791 (if (null fis-other) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1792 (when fis-removed (cvs-mode-run "add" nil fis-removed)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1793 (cvs-mode-run "update" flags fis-other |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1794 :postproc |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1795 (when fis-removed |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1796 `((with-current-buffer ,(current-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1797 (cvs-mode-run "add" nil ',fis-removed))))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1798 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1799 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1800 (defun-cvs-mode (cvs-mode-revert-to-rev . NOARGS) (rev) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1801 "Revert the selected files to an old revision." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1802 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1803 (list (or (cvs-prefix-get 'cvs-branch-prefix) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1804 (let ((current-prefix-arg '(4))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1805 (cvs-flags-query 'cvs-idiff-version))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1806 (let* ((fis (cvs-mode-marked 'revert "revert" :file t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1807 (tag (concat "tmp_pcl_tag_" (make-temp-name ""))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1808 (untag `((with-current-buffer ,(current-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1809 (cvs-mode-run "tag" (list "-d" ',tag) ',fis)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1810 (update `((with-current-buffer ,(current-buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1811 (cvs-mode-run "update" (list "-j" ',tag "-j" ',rev) ',fis |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1812 :postproc ',untag))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1813 (cvs-mode-run "tag" (list tag) fis :postproc update))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1814 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1815 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1816 (defun-cvs-mode cvs-mode-delete-lock () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1817 "Delete the lock file that CVS is waiting for. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1818 Note that this can be dangerous. You should only do this |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1819 if you are convinced that the process that created the lock is dead." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1820 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1821 (let* ((default-directory (cvs-expand-dir-name cvs-lock-file)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1822 (locks (directory-files default-directory nil cvs-lock-file-regexp))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1823 (cond |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1824 ((not locks) (error "No lock files found.")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1825 ((yes-or-no-p (concat "Really delete locks in " cvs-lock-file "? ")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1826 (dolist (lock locks) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1827 (cond ((file-directory-p lock) (delete-directory lock)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1828 ((file-exists-p lock) (delete-file lock)))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1829 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1830 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1831 (defun-cvs-mode cvs-mode-remove-handled () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1832 "Remove all lines that are handled. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1833 Empty directories are removed." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1834 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1835 (cvs-cleanup-collection cvs-cookies |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1836 t (or cvs-auto-remove-directories 'handled) t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1837 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1838 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1839 (defun-cvs-mode cvs-mode-acknowledge () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1840 "Remove all marked files from the buffer." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1841 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1842 (dolist (fi (cvs-get-marked (cvs-ignore-marks-p "acknowledge") t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1843 (setf (cvs-fileinfo->type fi) 'DEAD)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1844 (cvs-cleanup-collection cvs-cookies nil nil nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1845 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1846 (defun cvs-do-removal (filter &optional cmd all) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1847 "Remove files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1848 Returns a list of FIS that should be `cvs remove'd." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1849 (let* ((files (cvs-mode-marked filter cmd :file t :read-only t)) |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1850 (fis (cdr (cvs-partition (lambda (fi) |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1851 (eq (cvs-fileinfo->type fi) 'UNKNOWN)) |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1852 (cvs-mode-marked filter cmd)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1853 (silent (or (not cvs-confirm-removals) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1854 (cvs-every (lambda (fi) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1855 (or (not (file-exists-p |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1856 (cvs-fileinfo->full-path fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1857 (cvs-applicable-p fi 'safe-rm))) |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1858 files))) |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1859 (tmpbuf (cvs-temp-buffer))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1860 (when (and (not silent) (equal cvs-confirm-removals 'list)) |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1861 (with-current-buffer tmpbuf |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1862 (cvs-insert-strings (mapcar 'cvs-fileinfo->full-path fis)) |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1863 (cvs-pop-to-buffer-same-frame (current-buffer)) |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1864 (shrink-window-if-larger-than-buffer))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1865 (if (not (or silent |
33359
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1866 (unwind-protect |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1867 (yes-or-no-p (format "Delete %d files? " (length files))) |
5ef2137ce754
(cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33339
diff
changeset
|
1868 (cvs-bury-buffer tmpbuf cvs-buffer)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1869 (progn (message "Aborting") nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1870 (dolist (fi files) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1871 (let* ((type (cvs-fileinfo->type fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1872 (file (cvs-fileinfo->full-path fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1873 (when (or all (eq type 'UNKNOWN)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1874 (when (file-exists-p file) (delete-file file)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1875 (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1876 fis))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1877 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1878 (defun-cvs-mode (cvs-mode-remove . SIMPLE) (flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1879 "Remove all marked files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1880 With prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1881 (interactive (list (cvs-flags-query 'cvs-remove-flags "cvs remove flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1882 (let ((fis (cvs-do-removal 'remove))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1883 (if fis (cvs-mode-run "remove" (cons "-f" flags) fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1884 (cvs-cleanup-collection cvs-cookies nil nil nil)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1885 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1886 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1887 (defvar cvs-tag-name "") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1888 (defun-cvs-mode (cvs-mode-tag . SIMPLE) (tag &optional flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1889 "Run `cvs tag TAG' on all selected files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1890 With prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1891 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1892 (list (setq cvs-tag-name |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1893 (cvs-query-read cvs-tag-name "Tag name: " cvs-qtypedesc-tag)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1894 (cvs-flags-query 'cvs-tag-flags "tag flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1895 (cvs-mode-do "tag" (append flags (list tag)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1896 (when cvs-force-dir-tag 'tag))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1897 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1898 (defun-cvs-mode (cvs-mode-untag . SIMPLE) (tag &optional flags) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1899 "Run `cvs tag -d TAG' on all selected files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1900 With prefix argument, prompt for cvs flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1901 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1902 (list (setq cvs-tag-name |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1903 (cvs-query-read cvs-tag-name "Tag to delete: " cvs-qtypedesc-tag)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1904 (cvs-flags-query 'cvs-tag-flags "tag flags"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1905 (cvs-mode-do "tag" (append '("-d") flags (list tag)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1906 (when cvs-force-dir-tag 'tag))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1907 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1908 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1909 ;; Byte compile files. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1910 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1911 (defun-cvs-mode cvs-mode-byte-compile-files () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1912 "Run byte-compile-file on all selected files that end in '.el'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1913 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1914 (let ((marked (cvs-get-marked (cvs-ignore-marks-p "byte-compile")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1915 (dolist (fi marked) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1916 (let ((filename (cvs-fileinfo->full-path fi))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1917 (when (string-match "\\.el\\'" filename) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1918 (byte-compile-file filename)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1919 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1920 ;; ChangeLog support. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1921 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1922 (defun-cvs-mode cvs-mode-add-change-log-entry-other-window () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1923 "Add a ChangeLog entry in the ChangeLog of the current directory." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1924 (interactive) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1925 (let* ((fi (cvs-mode-marked nil nil :one t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1926 (default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi))) |
33195
d296e0e3cf43
(cvs-mode-add-change-log-entry-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32488
diff
changeset
|
1927 (buffer-file-name (expand-file-name (cvs-fileinfo->file fi))) |
d296e0e3cf43
(cvs-mode-add-change-log-entry-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32488
diff
changeset
|
1928 change-log-default-name) |
d296e0e3cf43
(cvs-mode-add-change-log-entry-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32488
diff
changeset
|
1929 (add-change-log-entry-other-window))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1930 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1931 ;; interactive commands to set optional flags |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1932 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1933 (defun cvs-mode-set-flags (flag) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1934 "Ask for new setting of cvs-FLAG-flags." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1935 (interactive |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1936 (list (completing-read |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1937 "Which flag: " |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1938 (mapcar 'list '("cvs" "diff" "update" "status" "log" "tag" ;"rtag" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1939 "commit" "remove" "undo" "checkout")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1940 nil t))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1941 (let* ((sym (intern (concat "cvs-" flag "-flags")))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1942 (let ((current-prefix-arg '(16))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1943 (cvs-flags-query sym (concat flag " flags"))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1944 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1945 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1946 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1947 ;;;; Utilities for the *cvs* buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1948 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1949 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1950 (defun cvs-dir-member-p (fileinfo dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1951 "Return true if FILEINFO represents a file in directory DIR." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1952 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)) |
28862
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
1953 (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1954 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1955 (defun cvs-execute-single-file (fi extractor program constant-args) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1956 "Internal function for `cvs-execute-single-file-list'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1957 (let* ((cur-dir (cvs-fileinfo->dir fi)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1958 (default-directory (cvs-expand-dir-name cur-dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1959 (inhibit-read-only t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1960 (arg-list (funcall extractor fi))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1961 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1962 ;; Execute the command unless extractor returned t. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1963 (when (listp arg-list) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1964 (let* ((args (append constant-args arg-list))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1965 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1966 (insert (format "=== cd %s\n=== %s %s\n\n" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1967 cur-dir program (cvs-strings->string args))) |
30569
f7a0912532da
* pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents:
29577
diff
changeset
|
1968 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1969 ;; FIXME: return the exit status? |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1970 (apply 'call-process program nil t t args) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1971 (goto-char (point-max)))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1972 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1973 ;; FIXME: make this run in the background ala cvs-run-process... |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1974 (defun cvs-execute-single-file-list (fis extractor program constant-args) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1975 "Run PROGRAM on all elements on FIS. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1976 The PROGRAM will be called with pwd set to the directory the files |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1977 reside in. CONSTANT-ARGS is a list of strings to pass as arguments to |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1978 PROGRAM. The arguments given to the program will be CONSTANT-ARGS |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1979 followed by the list that EXTRACTOR returns. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1980 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1981 EXTRACTOR will be called once for each file on FIS. It is given |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1982 one argument, the cvs-fileinfo. It can return t, which means ignore |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1983 this file, or a list of arguments to send to the program." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1984 (dolist (fi fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1985 (cvs-execute-single-file fi extractor program constant-args))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1986 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1987 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1988 (defun cvs-revert-if-needed (fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1989 (dolist (fileinfo fis) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1990 (let* ((file (cvs-fileinfo->full-path fileinfo)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1991 (buffer (find-buffer-visiting file))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1992 ;; For a revert to happen the user must be editing the file... |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1993 (unless (or (null buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1994 (eq (cvs-fileinfo->type fileinfo) 'MESSAGE) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1995 ;; FIXME: check whether revert is really needed. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1996 ;; `(verify-visited-file-modtime buffer)' doesn't cut it |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1997 ;; because it only looks at the time stamp (it ignores |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1998 ;; read-write changes) which is not changed by `commit'. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1999 (buffer-modified-p buffer)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2000 (with-current-buffer buffer |
31977
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2001 (ignore-errors |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2002 (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes) |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2003 ;; `preserve-modes' avoids changing the (minor) modes. But we |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2004 ;; do want to reset the mode for VC, so we do it explicitly. |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2005 (vc-find-file-hook) |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2006 (when (eq (cvs-fileinfo->type fileinfo) 'CONFLICT) |
2f79c1ebd1fe
(cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30879
diff
changeset
|
2007 (smerge-mode 1)))))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2008 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2009 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2010 (defun cvs-change-cvsroot (newroot) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2011 "Change the cvsroot." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2012 (interactive "DNew repository: ") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2013 (if (or (file-directory-p (expand-file-name "CVSROOT" newroot)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2014 (y-or-n-p (concat "Warning: no CVSROOT found inside repository." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2015 " Change cvs-cvsroot anyhow?"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2016 (setq cvs-cvsroot newroot))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2017 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2018 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2019 ;;;; useful global settings |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2020 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2021 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2022 ;;;###autoload |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2023 (add-to-list 'completion-ignored-extensions "CVS/") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2024 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2025 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2026 ;; Hook to allow calling PCL-CVS by visiting the /CVS subdirectory |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2027 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2028 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2029 ;;;###autoload |
32187
418444640a1e
(cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31977
diff
changeset
|
2030 (defcustom cvs-dired-action 'cvs-quickdir |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2031 "The action to be performed when opening a CVS directory. |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2032 Sensible values are `cvs-examine', `cvs-status' and `cvs-quickdir'." |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2033 :group 'pcl-cvs |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2034 :type '(choice (const cvs-examine) (const cvs-status) (const cvs-quickdir))) |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2035 |
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2036 ;;;###autoload |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2037 (defcustom cvs-dired-use-hook '(4) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2038 "Whether or not opening a CVS directory should run PCL-CVS. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2039 NIL means never do it. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2040 ALWAYS means to always do it unless a prefix argument is given to the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2041 command that prompted the opening of the directory. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2042 Anything else means to do it only if the prefix arg is equal to this value." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2043 :group 'pcl-cvs |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2044 :type '(choice (const :tag "Never" nil) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2045 (const :tag "Always" always) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2046 (const :tag "Prefix" (4)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2047 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2048 ;;;###autoload |
28862
d089f0a330a0
(cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28256
diff
changeset
|
2049 (progn (defun cvs-dired-noselect (dir) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2050 "Run `cvs-examine' if DIR is a CVS administrative directory. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2051 The exact behavior is determined also by `cvs-dired-use-hook'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2052 (when (stringp dir) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2053 (setq dir (directory-file-name dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2054 (when (and (string= "CVS" (file-name-nondirectory dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2055 (file-readable-p (expand-file-name "Entries" dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2056 cvs-dired-use-hook |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2057 (if (eq cvs-dired-use-hook 'always) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2058 (not current-prefix-arg) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2059 (equal current-prefix-arg cvs-dired-use-hook))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2060 (save-excursion |
29577
ce3a0229bee7
(cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28862
diff
changeset
|
2061 (funcall cvs-dired-action (file-name-directory dir) t t)))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2062 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2063 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2064 ;; hook into VC |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2065 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2066 |
32309
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
2067 (add-hook 'vc-post-command-functions 'cvs-vc-command-advice) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2068 |
32309
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
2069 (defun cvs-vc-command-advice (command file flags) |
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
2070 (when (and (equal command "cvs") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2071 ;; don't parse output we don't understand. |
32309
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
2072 (member (car flags) cvs-parse-known-commands)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2073 (save-excursion |
32309
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
2074 (let ((buffer (current-buffer)) |
bb96b2ece52b
(cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32187
diff
changeset
|
2075 (dir default-directory) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2076 (cvs-from-vc t)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2077 (dolist (cvs-buf (buffer-list)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2078 (set-buffer cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2079 ;; look for a corresponding pcl-cvs buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2080 (when (and (eq major-mode 'cvs-mode) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2081 (cvs-string-prefix-p default-directory dir)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2082 (let ((subdir (substring dir (length default-directory)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2083 (set-buffer buffer) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2084 (set (make-local-variable 'cvs-buffer) cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2085 ;; VC never (?) does `cvs -n update' so dcd=nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2086 ;; should probably always be the right choice. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2087 (cvs-parse-process nil subdir)))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2088 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2089 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2090 ;; Hook into write-buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2091 ;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2092 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2093 (defun cvs-mark-buffer-changed () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2094 (let* ((file (expand-file-name buffer-file-name)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2095 (version (and (fboundp 'vc-backend) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2096 (eq (vc-backend file) 'CVS) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2097 (vc-workfile-version file)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2098 (when version |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2099 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2100 (dolist (cvs-buf (buffer-list)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2101 (set-buffer cvs-buf) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2102 ;; look for a corresponding pcl-cvs buffer |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2103 (when (and (eq major-mode 'cvs-mode) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2104 (cvs-string-prefix-p default-directory file)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2105 (let* ((file (substring file (length default-directory))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2106 (fi (cvs-create-fileinfo |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2107 (if (string= "0" version) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2108 'ADDED 'MODIFIED) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2109 (or (file-name-directory file) "") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2110 (file-name-nondirectory file) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2111 "cvs-mark-buffer-changed"))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2112 (cvs-addto-collection cvs-cookies fi)))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2113 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2114 (add-hook 'after-save-hook 'cvs-mark-buffer-changed) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2115 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2116 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2117 (provide 'pcvs) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2118 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2119 ;;; pcvs.el ends here |