annotate lisp/pcvs.el @ 79642:01fcad3cc628

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Fri, 28 Dec 2007 03:50:09 +0000
parents cd3530596f8e
children 73661ddc7ac7 5039706521c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37339
diff changeset
1 ;;; pcvs.el --- a front-end to CVS
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
58158
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74442
diff changeset
4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
6 ;; Author: (The PCL-CVS Trust) pcl-cvs@cyclic.com
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
7 ;; (Per Cederqvist) ceder@lysator.liu.se
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
8 ;; (Greg A. Woods) woods@weird.com
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
9 ;; (Jim Blandy) jimb@cyclic.com
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
10 ;; (Karl Fogel) kfogel@floss.red-bean.com
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11 ;; (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
12 ;; (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
13 ;; (Greg Klanderman) greg@alphatech.com
2f79c1ebd1fe (cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30879
diff changeset
14 ;; (Jari Aalto+mail.emacs) jari.aalto@poboxes.com
54619
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
15 ;; Maintainer: (Stefan Monnier) monnier@gnu.org
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16 ;; Keywords: CVS, version control, release management
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
18 ;; This file is part of GNU Emacs.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20 ;; 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
21 ;; it under the terms of the GNU General Public License as published by
78236
9355f9b7bbff Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78203
diff changeset
22 ;; the Free Software Foundation; either version 3, or (at your option)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
23 ;; any later version.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
24
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25 ;; 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
26 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
27 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
28 ;; GNU General Public License for more details.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
29
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
30 ;; 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
31 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63421
diff changeset
32 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63421
diff changeset
33 ;; Boston, MA 02110-1301, USA.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
35 ;;; Commentary:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
36
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
37 ;; 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
38 ;; 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
39 ;; 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
40 ;; 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
41 ;; faster (but only for CVS).
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
42
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
43 ;; 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
44 ;; 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
45 ;; 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
46
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
47 ;; 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
48 ;; 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
49 ;; seamlessly (I also use VC).
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
50
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
51 ;; 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
52 ;; 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
53
34376
25976c39c41e * pcvs.el (cvs-menu): Use `cvs-menu' rather than `cvs-menu-map'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34304
diff changeset
54 ;;; Bugs:
25976c39c41e * pcvs.el (cvs-menu): Use `cvs-menu' rather than `cvs-menu-map'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34304
diff changeset
55
39392
11216aa2d43c *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38422
diff changeset
56 ;; - Extracting an old version seems not to recognize encoding correctly.
11216aa2d43c *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38422
diff changeset
57 ;; That's probably because it's done via a process rather than a file.
34376
25976c39c41e * pcvs.el (cvs-menu): Use `cvs-menu' rather than `cvs-menu-map'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34304
diff changeset
58
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59 ;;; Todo:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
61 ;; ******** FIX THE DOCUMENTATION *********
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48671
diff changeset
62 ;;
34376
25976c39c41e * pcvs.el (cvs-menu): Use `cvs-menu' rather than `cvs-menu-map'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34304
diff changeset
63 ;; - rework the displaying of error messages.
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
64 ;; - allow to flush messages only
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
65 ;; - 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
66 ;; - 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
67 ;; (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
68 ;; - 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
69 ;; - 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
70 ;; (resp after) it.
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
71 ;; - 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
72 ;; - 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
73 ;; - removal confirmation should allow specifying another file name.
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48671
diff changeset
74 ;;
30717
e6e5480e5b25 (cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
75 ;; - 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
76 ;; - add toolbar entries
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
77 ;; - marking
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
78 ;; 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
79 ;; allow (un)marking directories at a time with the mouse.
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
80 ;; allow cvs-cmd-do to either clear the marks or not.
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
81 ;; add a "marks active" notion, like transient-mark-mode does.
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
82 ;; - liveness indicator
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
83 ;; - 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
84 ;; - 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
85 ;; - 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
86 ;; - higher-level CVS operations
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
87 ;; cvs-mode-rename
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
88 ;; cvs-mode-branch
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
89 ;; - module-level commands
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
90 ;; 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
91 ;; cvs-mode-rcs2log
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
92 ;; cvs-rdiff
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
93 ;; cvs-release
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
94 ;; cvs-import
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
95 ;; 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
96 ;; cvs-mode-handle-new-vendor-version
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
97 ;; - checks out module, or alternately does update join
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
98 ;; - 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
99 ;; cvs-export
30879
3a1ff1caafe2 * emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30717
diff changeset
100 ;; (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
101 ;; - 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
102 ;; - 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
103 ;; 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
104 ;; 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
105 ;; - cvs-mode-incorporate
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
106 ;; 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
107 ;; 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
108 ;; 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
109 ;; - 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
110 ;; - 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
111 ;; 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
112 ;; - make `cvs-mode-ignore' allow manually entering a pattern.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
113 ;; 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
114 ;; - 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
115 ;; - 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
116 ;; - some kind of `cvs annotate' support ?
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117 ;; 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
118 ;; - 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
119 ;; 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
120 ;; - 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
121
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122 ;;; Code:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123
30612
a019ed819488 (require): Require `cl' during compilation, only.
Gerd Moellmann <gerd@gnu.org>
parents: 30569
diff changeset
124 (eval-when-compile (require 'cl))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
125 (require 'ewoc) ;Ewoc was once cookie
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
126 (require 'pcvs-defs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
127 (require 'pcvs-util)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
128 (require 'pcvs-parse)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
129 (require 'pcvs-info)
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
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
132 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
133 ;;;; global vars
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 (defvar cvs-cookies) ;;nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 ;;"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
138 ;;(make-variable-buffer-local 'cvs-cookies)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
141 ;;;; Dynamically scoped variables
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
142 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
143
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
144 (defvar cvs-from-vc nil "Bound to t inside VC advice.")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
146 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
147 ;;;; flags variables
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
148 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
149
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150 (defun cvs-defaults (&rest defs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151 (let ((defs (cvs-first defs cvs-shared-start)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 (append defs
30879
3a1ff1caafe2 * emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30717
diff changeset
153 (make-list (- cvs-shared-start (length defs)) (car defs))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 cvs-shared-flags)))
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 ;; 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
157 ;; 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
158 ;; information from pcl-cvs.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
159 (cvs-flags-define cvs-cvs-flags '(("-f")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
160
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
161 (cvs-flags-define cvs-checkout-flags (cvs-defaults '("-P")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162 (cvs-flags-define cvs-status-flags (cvs-defaults '("-v") nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
163 (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
164 (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
165 (cvs-flags-define cvs-tag-flags (cvs-defaults nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 (cvs-flags-define cvs-add-flags (cvs-defaults nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167 (cvs-flags-define cvs-commit-flags (cvs-defaults nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168 (cvs-flags-define cvs-remove-flags (cvs-defaults nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 ;;(cvs-flags-define cvs-undo-flags (cvs-defaults nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
170 (cvs-flags-define cvs-update-flags (cvs-defaults '("-d" "-P")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
171
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
172 (defun cvs-reread-cvsrc ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
173 "Reset the default arguments to those in the `cvs-cvsrc-file'."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
174 (interactive)
41779
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
175 (condition-case nil
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
176 (with-temp-buffer
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
177 (insert-file-contents cvs-cvsrc-file)
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
178 ;; fetch the values
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
179 (dolist (cmd '("cvs" "checkout" "status" "log" "diff" "tag"
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
180 "add" "commit" "remove" "update"))
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
181 (goto-char (point-min))
42966
afd482080b6f (cvs-reread-cvsrc): Distinguish between an empty list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42206
diff changeset
182 (when (re-search-forward
afd482080b6f (cvs-reread-cvsrc): Distinguish between an empty list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42206
diff changeset
183 (concat "^" cmd "\\(\\s-+\\(.*\\)\\)?$") nil t)
afd482080b6f (cvs-reread-cvsrc): Distinguish between an empty list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42206
diff changeset
184 (let* ((sym (intern (concat "cvs-" cmd "-flags")))
78535
651c50f01f5f (cvs-reread-cvsrc, cvs-checkout, cvs-mode-checkout)
Richard M. Stallman <rms@gnu.org>
parents: 78239
diff changeset
185 (val (split-string-and-unquote (or (match-string 2) ""))))
42966
afd482080b6f (cvs-reread-cvsrc): Distinguish between an empty list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42206
diff changeset
186 (cvs-flags-set sym 0 val))))
41779
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
187 ;; ensure that cvs doesn't have -q or -Q
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
188 (cvs-flags-set 'cvs-cvs-flags 0
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
189 (cons "-f"
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
190 (cdr (cvs-partition
42966
afd482080b6f (cvs-reread-cvsrc): Distinguish between an empty list of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42206
diff changeset
191 (lambda (x) (member x '("-q" "-Q" "-f")))
41779
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
192 (cvs-flags-query 'cvs-cvs-flags
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
193 nil 'noquery))))))
d31a6beb070e (cvs-reread-cvsrc): Don't use cvs-file-to-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40479
diff changeset
194 (file-error nil)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
195
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
196 ;; initialize to cvsrc's default values
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
197 (cvs-reread-cvsrc)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
198
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
199
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
200 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
201 ;;;; Mouse bindings and mode motion
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
50958
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
204 (defvar cvs-minor-current-files)
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
205
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
206 (defun cvs-menu (e)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
207 "Popup the CVS menu."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
208 (interactive "e")
30717
e6e5480e5b25 (cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
209 (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
210 (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
211 cvs-cookies (posn-point (event-end e)))))))
34376
25976c39c41e * pcvs.el (cvs-menu): Use `cvs-menu' rather than `cvs-menu-map'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34304
diff changeset
212 (popup-menu cvs-menu e)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
213
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
214 (defvar cvs-mode-line-process nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
215 "Mode-line control for displaying info on cvs process status.")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
216
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
217
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
218 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
219 ;;;; 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
220 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
221
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
222 (autoload 'cvs-status-get-tags "cvs-status")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
223 (defun cvs-tags-list ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
224 "Return a list of acceptable tags, ready for completions."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
225 (assert (cvs-buffer-p))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
226 (let ((marked (cvs-get-marked)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
227 (list* '("BASE") '("HEAD")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
228 (when marked
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
229 (with-temp-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
230 (call-process cvs-program
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
231 nil ;no input
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
232 t ;output to current-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
233 nil ;don't update display while running
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
234 "status"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
235 "-v"
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
236 (cvs-fileinfo->full-name (car marked)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
237 (goto-char (point-min))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
238 (let ((tags (cvs-status-get-tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
239 (when (listp tags) tags)))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
240
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
241 (defvar cvs-tag-history nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
242 (defconst cvs-qtypedesc-tag
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
243 (cvs-qtypedesc-create 'identity 'identity 'cvs-tags-list 'cvs-tag-history))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
244
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
245 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
246
50143
93622ce43bdd (cvs-mode!): Remove unused argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49688
diff changeset
247 (defun cvs-mode! (&optional -cvs-mode!-fun)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
248 "Switch to the *cvs* buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
249 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
250 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
251 -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
252 (let* ((-cvs-mode!-buf (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
253 (cvsbuf (cond ((cvs-buffer-p) (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
254 ((and cvs-buffer (cvs-buffer-p cvs-buffer)) cvs-buffer)
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37339
diff changeset
255 (t (error "can't find the *cvs* buffer"))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
256 (-cvs-mode!-wrapper cvs-minor-wrap-function)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
257 (-cvs-mode!-cont (lambda ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
258 (save-current-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
259 (if (commandp -cvs-mode!-fun)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
260 (call-interactively -cvs-mode!-fun)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
261 (funcall -cvs-mode!-fun))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
262 (if (not -cvs-mode!-fun) (set-buffer cvsbuf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
263 (let ((cvs-mode!-buf (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
264 (cvs-mode!-owin (selected-window))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
265 (cvs-mode!-nwin (get-buffer-window cvsbuf 'visible)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
266 (unwind-protect
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
267 (progn
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
268 (set-buffer cvsbuf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
269 (when cvs-mode!-nwin (select-window cvs-mode!-nwin))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
270 (if -cvs-mode!-wrapper
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
271 (funcall -cvs-mode!-wrapper -cvs-mode!-buf -cvs-mode!-cont)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
272 (funcall -cvs-mode!-cont)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
273 (set-buffer cvs-mode!-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
274 (when (and cvs-mode!-nwin (eq cvs-mode!-nwin (selected-window)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
275 ;; the selected window has not been changed by FUN
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
276 (select-window cvs-mode!-owin)))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
277
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
278 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
279 ;;;; Prefixes
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
280 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
281
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
282 (defvar cvs-branches (list cvs-vendor-branch "HEAD" "HEAD"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
283 (cvs-prefix-define cvs-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
284 "Current selected branch."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
285 "version"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
286 (cons cvs-vendor-branch cvs-branches)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
287 cvs-qtypedesc-tag)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
288
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
289 (defun cvs-set-branch-prefix (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
290 "Set the branch prefix to take action at the next command.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
291 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
292 \\[universal-argument] 1 selects the vendor branch
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
293 and \\[universal-argument] 2 selects the HEAD."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
294 (interactive "P")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
295 (cvs-mode!)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
296 (cvs-prefix-set 'cvs-branch-prefix arg))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
297
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
298 (defun cvs-add-branch-prefix (flags &optional arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
299 "Add branch selection argument if the branch prefix was set.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
300 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
301 by appending the branch to ARG which defaults to \"-r\"."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
302 (let ((branch (cvs-prefix-get 'cvs-branch-prefix)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
303 ;; deactivate the secondary prefix, even if not used.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
304 (cvs-prefix-get 'cvs-secondary-branch-prefix)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
305 (if branch (cons (concat (or arg "-r") branch) flags) flags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
306
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
307 (cvs-prefix-define cvs-secondary-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
308 "Current secondary selected branch."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
309 "version"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
310 (cons cvs-vendor-branch cvs-branches)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
311 cvs-qtypedesc-tag)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
312
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
313 (defun cvs-set-secondary-branch-prefix (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
314 "Set the branch prefix to take action at the next command.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
315 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
316 \\[universal-argument] 1 selects the vendor branch
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
317 and \\[universal-argument] 2 selects the HEAD."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
318 (interactive "P")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
319 (cvs-mode!)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
320 (cvs-prefix-set 'cvs-secondary-branch-prefix arg))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
321
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
322 (defun cvs-add-secondary-branch-prefix (flags &optional arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
323 "Add branch selection argument if the secondary branch prefix was set.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
324 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
325 by appending the branch to ARG which defaults to \"-r\".
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
326 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
327 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
328 the primay since reading the primary can deactivate it."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
329 (let ((branch (and (cvs-prefix-get 'cvs-branch-prefix 'read-only)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
330 (cvs-prefix-get 'cvs-secondary-branch-prefix))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
331 (if branch (cons (concat (or arg "-r") branch) flags) flags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
332
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
333 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
334
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
335 (define-minor-mode cvs-minor-mode
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
336 "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
337 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
338 the \\[cvs-mode-map] prefix."
48445
86325beb168c (cvs-minor-mode, cvs-mode-commit-hook): Add group.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48285
diff changeset
339 nil " CVS"
86325beb168c (cvs-minor-mode, cvs-mode-commit-hook): Add group.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48285
diff changeset
340 :group 'pcl-cvs)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
341 (put 'cvs-minor-mode 'permanent-local t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
342
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
343
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
344 (defvar cvs-temp-buffers nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
345 (defun cvs-temp-buffer (&optional cmd normal nosetup)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
346 "Create a temporary buffer to run CMD in.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
347 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
348 the buffer name to be used and its `major-mode'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
349
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
350 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
351 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
352 \(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
353 from the current buffer."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
354 (let* ((cvs-buf (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
355 (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
356 (name (eval (nth 0 info)))
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
357 (mode (nth 1 info))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
358 (dir default-directory)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
359 (buf (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
360 (name (cvs-get-buffer-create name))
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
361 ((and (bufferp cvs-temp-buffer) (buffer-live-p cvs-temp-buffer))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
362 cvs-temp-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
363 (t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
364 (set (make-local-variable 'cvs-temp-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
365 (cvs-get-buffer-create
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
366 (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
367
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
368 ;; handle the potential pre-existing process
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
369 (let ((proc (get-buffer-process buf)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
370 (when (and (not normal) (processp proc)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
371 (memq (process-status proc) '(run stop)))
51170
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
372 (if cmd
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
373 ;; When CMD is specified, the buffer is normally shown to the
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
374 ;; user, so interrupting the process is not harmful.
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
375 ;; Use `delete-process' rather than `kill-process' otherwise
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
376 ;; the pending output of the process will still get inserted
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
377 ;; after we erase the buffer.
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
378 (delete-process proc)
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
379 (error "Can not run two cvs processes simultaneously"))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
380
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
381 (if (not name) (kill-local-variable 'other-window-scroll-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
382 ;; Strangely, if no window is created, `display-buffer' ends up
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
383 ;; doing a `switch-to-buffer' which does a `set-buffer', hence
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
384 ;; the need for `save-excursion'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
385 (unless nosetup (save-excursion (display-buffer buf)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
386 ;; 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
387 ;; does a `find-file-other-window' and `scroll-other-window'
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
388 (set (make-local-variable 'other-window-scroll-buffer) buf))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
389
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
390 (add-to-list 'cvs-temp-buffers 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 (with-current-buffer buf
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
393 (setq buffer-read-only nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
394 (setq default-directory dir)
78239
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
395 (unless nosetup
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
396 ;; Disable undo before calling erase-buffer since it may generate
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
397 ;; a very large and unwanted undo record.
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
398 (buffer-disable-undo)
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
399 (erase-buffer))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
400 (set (make-local-variable 'cvs-buffer) cvs-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
401 ;;(cvs-minor-mode 1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
402 (let ((lbd list-buffers-directory))
78239
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
403 (if (fboundp mode) (funcall mode) (fundamental-mode))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
404 (when lbd (set (make-local-variable 'list-buffers-directory) lbd)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
405 (cvs-minor-mode 1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
406 ;;(set (make-local-variable 'cvs-buffer) cvs-buf)
78239
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
407 (if normal
be7fbb40c851 (cvs-temp-buffer): Undo last ill-conceived change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
408 (buffer-enable-undo)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
409 (setq buffer-read-only t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
410 (buffer-disable-undo))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
411 buf)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
412
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
413 (defun cvs-mode-kill-buffers ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
414 "Kill all the \"temporary\" buffers created by the *cvs* buffer."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
415 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
416 (dolist (buf cvs-temp-buffers) (ignore-errors (kill-buffer buf))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
417
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
418 (defun cvs-make-cvs-buffer (dir &optional new)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
419 "Create the *cvs* buffer for directory DIR.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
420 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
421 ;; the real cvs-buffer creation
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
422 (setq dir (cvs-expand-dir-name dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
423 (let* ((buffer-name (eval cvs-buffer-name))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
424 (buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
425 (or (and (not new)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
426 (eq cvs-reuse-cvs-buffer 'current)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
427 (cvs-buffer-p) ;reuse the current buffer if possible
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
428 (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
429 ;; look for another cvs buffer visiting the same directory
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
430 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
431 (unless new
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
432 (dolist (buffer (cons (current-buffer) (buffer-list)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
433 (set-buffer buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
434 (and (cvs-buffer-p)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
435 (case cvs-reuse-cvs-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
436 (always t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
437 (subdir
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
438 (or (cvs-string-prefix-p default-directory dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
439 (cvs-string-prefix-p dir default-directory)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
440 (samedir (string= default-directory dir)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
441 (return buffer)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
442 ;; we really have to create a new buffer:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
443 ;; we temporarily bind cwd to "" to prevent
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
444 ;; create-file-buffer from using directory info
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
445 ;; unless it is explicitly in the cvs-buffer-name.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
446 (cvs-get-buffer-create buffer-name new))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
447 (with-current-buffer buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
448 (or
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
449 (and (string= dir default-directory) (cvs-buffer-p)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
450 ;; just a refresh
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
451 (ignore-errors
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
452 (cvs-cleanup-collection cvs-cookies nil nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
453 (current-buffer)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
454 ;; setup from scratch
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
455 (progn
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
456 (setq default-directory dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
457 (setq buffer-read-only nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
458 (erase-buffer)
50965
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
459 (insert "Repository : " (directory-file-name (cvs-get-cvsroot))
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
460 "\nModule : " (cvs-get-module)
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
461 "\nWorking dir: " (abbreviate-file-name dir)
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
462 (if (not (file-readable-p "CVS/Tag")) "\n"
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
463 (let ((tag (cvs-file-to-string "CVS/Tag")))
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
464 (cond
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
465 ((string-match "\\`T" tag)
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
466 (concat "\nTag : " (substring tag 1)))
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
467 ((string-match "\\`D" tag)
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
468 (concat "\nDate : " (substring tag 1)))
51170
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
469 ("\n"))))
ae05e83c45d5 (cvs-temp-buffer): Kill running process in displayed buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50991
diff changeset
470 "\n")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
471 (setq buffer-read-only t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
472 (cvs-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
473 (set (make-local-variable 'list-buffers-directory) buffer-name)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
474 ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer))
71007
4f58e5dcbbc0 (cvs-make-cvs-buffer): Specify NOSEP to `ewoc-create'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 70708
diff changeset
475 (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n" t)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
476 (set (make-local-variable 'cvs-cookies) cookies)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
477 (add-hook 'kill-buffer-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
478 (lambda ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
479 (ignore-errors (kill-buffer cvs-temp-buffer)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
480 nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
481 ;;(set-buffer buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
482 buffer))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
483
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
484 (defun* cvs-cmd-do (cmd dir flags fis new
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
485 &key cvsargs noexist dont-change-disc noshow)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
486 (let* ((dir (file-name-as-directory
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
487 (abbreviate-file-name (expand-file-name dir))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
488 (cvsbuf (cvs-make-cvs-buffer dir new)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
489 ;; Check that dir is under CVS control.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
490 (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
491 (error "%s is not a directory" dir))
45325
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
492 (unless (or noexist (file-directory-p (expand-file-name "CVS" dir))
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
493 (file-expand-wildcards (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
494 (error "%s does not contain CVS controlled files" dir))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
495
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
496 (set-buffer cvsbuf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
497 (cvs-mode-run cmd flags fis
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
498 :cvsargs cvsargs :dont-change-disc dont-change-disc)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
499
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
500 (if noshow cvsbuf
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
501 (let ((pop-up-windows nil)) (pop-to-buffer cvsbuf)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
502 ;; (funcall (if (and (boundp 'pop-up-frames) pop-up-frames)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
503 ;; 'pop-to-buffer 'switch-to-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
504 ;; cvsbuf))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
505
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
506 (defun cvs-run-process (args fis postprocess &optional single-dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
507 (assert (cvs-buffer-p cvs-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
508 (save-current-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
509 (let ((procbuf (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
510 (cvsbuf cvs-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
511 (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
512
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
513 (set-buffer procbuf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
514 (goto-char (point-max))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
515 (unless (bolp) (let ((inhibit-read-only t)) (insert "\n")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
516 ;; find the set of files we'll process in this round
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
517 (let* ((dir+files+rest
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
518 (if (or (null fis) (not single-dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
519 ;; not single-dir mode: just process the whole thing
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
520 (list "" (mapcar 'cvs-fileinfo->full-name fis) nil)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
521 ;; single-dir mode: extract the same-dir-elements
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
522 (let ((dir (cvs-fileinfo->dir (car fis))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
523 ;; output the concerned dir so the parser can translate paths
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
524 (let ((inhibit-read-only t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
525 (insert "pcl-cvs: descending directory " dir "\n"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
526 ;; loop to find the same-dir-elems
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
527 (do* ((files () (cons (cvs-fileinfo->file fi) files))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
528 (fis fis (cdr fis))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
529 (fi (car fis) (car fis)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
530 ((not (and fis (string= dir (cvs-fileinfo->dir fi))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
531 (list dir files fis))))))
30618
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
532 (dir (nth 0 dir+files+rest))
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
533 (files (nth 1 dir+files+rest))
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
534 (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
535
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
536 (add-hook 'kill-buffer-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
537 (lambda ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
538 (let ((proc (get-buffer-process (current-buffer))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
539 (when (processp proc)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
540 (set-process-filter proc nil)
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
541 ;; Abort postprocessing but leave the sentinel so it
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
542 ;; will update the list of running procs.
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
543 (process-put proc 'cvs-postprocess nil)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
544 (interrupt-process proc))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
545 nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
546
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
547 ;; create the new process and setup the procbuffer correspondingly
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
548 (let* ((msg (cvs-header-msg args fis))
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
549 (args (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
550 (if cvs-cvsroot (list "-d" cvs-cvsroot))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
551 args
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
552 files))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
553 ;; If process-connection-type is nil and the repository
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
554 ;; is accessed via SSH, a bad interaction between libc,
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
555 ;; CVS and SSH can lead to garbled output.
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
556 ;; It might be a glibc-specific problem (but it can also happens
49688
372d20665473 Comment update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49597
diff changeset
557 ;; under Mac OS X, it seems).
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
558 ;; It seems that using a pty can help circumvent the problem,
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
559 ;; but at the cost of screwing up when the process thinks it
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
560 ;; can ask for user input (such as password or host-key
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
561 ;; confirmation). A better workaround is to set CVS_RSH to
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
562 ;; an appropriate script, or to use a later version of CVS.
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
563 (process-connection-type nil) ; Use a pipe, not a pty.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
564 (process
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
565 ;; the process will be run in the selected dir
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
566 (let ((default-directory (cvs-expand-dir-name dir)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
567 (apply 'start-process "cvs" procbuf cvs-program args))))
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
568 ;; setup the process.
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
569 (process-put process 'cvs-buffer cvs-buffer)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
570 (with-current-buffer cvs-buffer (cvs-update-header msg 'add))
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
571 (process-put process 'cvs-header msg)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
572 (process-put
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
573 process 'cvs-postprocess
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
574 (if (null rest)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
575 ;; this is the last invocation
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
576 postprocess
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
577 ;; else, we have to register ourselves to be rerun on the rest
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
578 `(cvs-run-process ',args ',rest ',postprocess ',single-dir)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
579 (set-process-sentinel process 'cvs-sentinel)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
580 (set-process-filter process 'cvs-update-filter)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
581 (set-marker (process-mark process) (point-max))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
582 (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
583
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
584 ;; now finish setting up the cvs-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
585 (set-buffer cvsbuf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
586 (setq cvs-mode-line-process (symbol-name (process-status process)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
587 (force-mode-line-update)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
588
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
589 ;; The following line is said to improve display updates on some
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
590 ;; emacsen. It shouldn't be needed, but it does no harm.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
591 (sit-for 0))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
592
58717
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
593 (defun cvs-header-msg (args fis)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
594 (let* ((lastarg nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
595 (args (mapcar (lambda (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
596 (cond
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
597 ;; filter out the largish commit message
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
598 ((and (eq lastarg nil) (string= arg "commit"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
599 (setq lastarg 'commit) arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
600 ((and (eq lastarg 'commit) (string= arg "-m"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
601 (setq lastarg '-m) arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
602 ((eq lastarg '-m)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
603 (setq lastarg 'done) "<log message>")
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
604 ;; filter out the largish `admin -mrev:msg' message
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
605 ((and (eq lastarg nil) (string= arg "admin"))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
606 (setq lastarg 'admin) arg)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
607 ((and (eq lastarg 'admin)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
608 (string-match "\\`-m[^:]*:" arg))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
609 (setq lastarg 'done)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
610 (concat (match-string 0 arg) "<log message>"))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
611 ;; Keep the rest as is.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
612 (t arg)))
58717
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
613 args)))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
614 (concat cvs-program " "
78535
651c50f01f5f (cvs-reread-cvsrc, cvs-checkout, cvs-mode-checkout)
Richard M. Stallman <rms@gnu.org>
parents: 78239
diff changeset
615 (combine-and-quote-strings
58717
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
616 (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery)
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
617 (if cvs-cvsroot (list "-d" cvs-cvsroot))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
618 args
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
619 (mapcar 'cvs-fileinfo->full-name fis))))))
58717
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
620
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
621 (defun cvs-update-header (cmd add)
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
622 (let* ((hf (ewoc-get-hf cvs-cookies))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
623 (str (car hf))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
624 (done "")
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
625 (tin (ewoc-nth cvs-cookies 0)))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
626 ;; look for the first *real* fileinfo (to determine emptyness)
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
627 (while
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
628 (and tin
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
629 (memq (cvs-fileinfo->type (ewoc-data tin))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
630 '(MESSAGE DIRCHANGE)))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
631 (setq tin (ewoc-next cvs-cookies tin)))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
632 (if add
73207
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
633 (progn
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
634 ;; Remove the default empty line, if applicable.
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
635 (if (not (string-match "." str)) (setq str "\n"))
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
636 (setq str (concat "-- Running " cmd " ...\n" str)))
58717
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
637 (if (not (string-match
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
638 (concat "^-- Running " (regexp-quote cmd) " \\.\\.\\.\n") str))
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
639 (error "Internal PCL-CVS error while removing message")
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
640 (setq str (replace-match "" t t str))
73207
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
641 ;; Re-add the default empty line, if applicable.
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
642 (if (not (string-match "." str)) (setq str "\n\n"))
7e220566994b (cvs-update-header): Fix handling of extra newlines so that
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72386
diff changeset
643 (setq done (concat "-- last cmd: " cmd " --\n"))))
58717
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
644 ;; set the new header and footer
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
645 (ewoc-set-hf cvs-cookies
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
646 str (concat "\n--------------------- "
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
647 (if tin "End" "Empty")
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
648 " ---------------------\n"
bd9d0c90fd28 (cvs-header-msg): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 58158
diff changeset
649 done))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
650
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
651
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
652 (defun cvs-sentinel (proc msg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
653 "Sentinel for the cvs update process.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
654 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
655 it is finished."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
656 (when (memq (process-status proc) '(signal exit))
61206
9c95a69e7e08 (cvs-sentinel): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61205
diff changeset
657 (let ((cvs-postproc (process-get proc 'cvs-postprocess))
65874
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
658 (cvs-buf (process-get proc 'cvs-buffer))
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
659 (procbuf (process-buffer proc)))
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
660 (unless (buffer-live-p cvs-buf) (setq cvs-buf nil))
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
661 (unless (buffer-live-p procbuf) (setq procbuf nil))
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
662 ;; Since the buffer and mode line will show that the
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
663 ;; process is dead, we can delete it now. Otherwise it
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
664 ;; will stay around until M-x list-processes.
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
665 (process-put proc 'postprocess nil)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
666 (delete-process proc)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
667 ;; Don't do anything if the main buffer doesn't exist any more.
65874
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
668 (when cvs-buf
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
669 (with-current-buffer cvs-buf
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
670 (cvs-update-header (process-get proc 'cvs-header) nil)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
671 (setq cvs-mode-line-process (symbol-name (process-status proc)))
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
672 (force-mode-line-update)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
673 (when cvs-postproc
65874
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
674 (if (null procbuf)
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
675 ;;(set-process-buffer proc nil)
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
676 (error "cvs' process buffer was killed")
65874
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
677 (with-current-buffer procbuf
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
678 ;; Do the postprocessing like parsing and such.
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
679 (save-excursion (eval cvs-postproc)))))))
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
680 ;; Check whether something is left.
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
681 (when (and procbuf (not (get-buffer-process procbuf)))
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
682 (with-current-buffer procbuf
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
683 ;; IIRC, we enable undo again once the process is finished
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
684 ;; for cases where the output was inserted in *vc-diff* or
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
685 ;; in a file-like buffer. --Stef
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
686 (buffer-enable-undo)
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
687 (with-current-buffer (or cvs-buf (current-buffer))
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
688 (message "CVS process has completed in %s"
03746d1d1011 (cvs-sentinel): Make sure we do re-enable undo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65582
diff changeset
689 (buffer-name))))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
690
45999
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
691 (defun cvs-parse-process (dcd &optional subdir old-fis)
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
692 "Parse the output of a cvs process.
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
693 DCD is the `dont-change-disc' flag to use when parsing that output.
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
694 SUBDIR is the subdirectory (if any) where this command was run.
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
695 OLD-FIS is the list of fileinfos on which the cvs command was applied and
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
696 which should be considered up-to-date if they are missing from the output."
54619
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
697 (when (eq system-type 'darwin)
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
698 ;; Fixup the ^D^H^H inserted at beginning of buffer sometimes on MacOSX
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
699 ;; because of the call to `process-send-eof'.
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
700 (save-excursion
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
701 (goto-char (point-min))
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
702 (while (re-search-forward "^\\^D+" nil t)
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
703 (let ((inhibit-read-only t))
261ba76ae244 (cvs-parse-process): Workaround for Darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54376
diff changeset
704 (delete-region (match-beginning 0) (match-end 0))))))
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
705 (let* ((fileinfos (cvs-parse-buffer 'cvs-parse-table dcd subdir))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
706 last)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
707 (with-current-buffer cvs-buffer
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
708 ;; Expand OLD-FIS to actual files.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
709 (let ((fis nil))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
710 (dolist (fi old-fis)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
711 (setq fis (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
712 (nconc (ewoc-collect cvs-cookies 'cvs-dir-member-p
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
713 (cvs-fileinfo->dir fi))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
714 fis)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
715 (cons fi fis))))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
716 (setq old-fis fis))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
717 ;; Drop OLD-FIS which were already up-to-date.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
718 (let ((fis nil))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
719 (dolist (fi old-fis)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
720 (unless (eq (cvs-fileinfo->type fi) 'UP-TO-DATE) (push fi fis)))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
721 (setq old-fis fis))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
722 ;; Add the new fileinfos to the ewoc.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
723 (dolist (fi fileinfos)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
724 (setq last (cvs-addto-collection cvs-cookies fi last))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
725 ;; This FI was in the output, so remove it from OLD-FIS.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
726 (setq old-fis (delq (ewoc-data last) old-fis)))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
727 ;; Process the "silent output" (i.e. absence means up-to-date).
45999
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
728 (dolist (fi old-fis)
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
729 (setf (cvs-fileinfo->type fi) 'UP-TO-DATE)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
730 (setq last (cvs-addto-collection cvs-cookies fi last)))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
731 (setq fileinfos (nconc old-fis fileinfos))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
732 ;; Clean up the ewoc as requested by the user.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
733 (cvs-cleanup-collection cvs-cookies
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
734 (eq cvs-auto-remove-handled t)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
735 cvs-auto-remove-directories
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
736 nil)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
737 ;; Revert buffers if necessary.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
738 (when (and cvs-auto-revert (not dcd) (not cvs-from-vc))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
739 (cvs-revert-if-needed fileinfos)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
740
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
741 (defmacro defun-cvs-mode (fun args docstring interact &rest body)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
742 "Define a function to be used in a *cvs* buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
743 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
744 Since the interactive arguments might need to be queried after
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
745 switching to the *cvs* buffer, the generic code is rather ugly,
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
746 but luckily we can often use simpler alternatives.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
747
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
748 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
749 ARGS and DOCSTRING are the normal argument list.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
750 INTERACT is the interactive specification or nil for non-commands.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
751
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
752 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
753 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
754 clear what alternative to use.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
755 - SIMPLE will get all the interactive arguments from the original buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
756 - 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
757 always behave as if called interactively.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
758 - DOUBLE is the generic case."
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
759 (declare (debug (&define sexp lambda-list stringp ("interactive" interactive) def-body)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
760 (let ((style (cvs-cdr fun))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
761 (fun (cvs-car fun)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
762 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
763 ;; a trivial interaction, no need to move it
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
764 ((or (eq style 'SIMPLE)
30618
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
765 (null (nth 1 interact))
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
766 (stringp (nth 1 interact)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
767 `(defun ,fun ,args ,docstring ,interact
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
768 (cvs-mode! (lambda () ,@body))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
769
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
770 ;; 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
771 ((eq style 'NOARGS)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
772 `(defun ,fun () ,docstring (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
773 (cvs-mode! (lambda ,args ,interact ,@body))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
774
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
775 ;; bad case
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
776 ((eq style 'DOUBLE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
777 (string-match ".*" docstring)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
778 (let ((line1 (match-string 0 docstring))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
779 (fun-1 (intern (concat (symbol-name fun) "-1"))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
780 `(progn
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
781 (defun ,fun-1 ,args
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
782 ,(concat docstring "\nThis function only works within a *cvs* buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
783 For interactive use, use `" (symbol-name fun) "' instead.")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
784 ,interact
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
785 ,@body)
67377
f031a0708433 (defun-cvs-mode): Put `definition-name' property on
Juri Linkov <juri@jurta.org>
parents: 66096
diff changeset
786 (put ',fun-1 'definition-name ',fun)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
787 (defun ,fun ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
788 ,(concat line1 "\nWrapper function that switches to a *cvs* buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
789 before calling the real function `" (symbol-name fun-1) "'.\n")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
790 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
791 (cvs-mode! ',fun-1)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
792
55695
b25f4dadde90 (defun-cvs-mode): Fix capitalization of error message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55458
diff changeset
793 (t (error "Unknown style %s in `defun-cvs-mode'" style)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
794
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
795 (defun-cvs-mode cvs-mode-kill-process ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
796 "Kill the temporary buffer and associated process."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
797 (interactive)
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
798 (when (and (bufferp cvs-temp-buffer) (buffer-live-p cvs-temp-buffer))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
799 (let ((proc (get-buffer-process cvs-temp-buffer)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
800 (when proc (delete-process proc)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
801
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
802 ;;
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
803 ;; Maintaining the collection in the face of updates
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
804 ;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
805
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
806 (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
807 "Add FI to C and return FI's corresponding tin.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
808 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
809 fileinfo if applicable.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
810 TIN specifies an optional starting point."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
811 (unless tin (setq tin (ewoc-nth c 0)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
812 (while (and tin (cvs-fileinfo< fi (ewoc-data tin)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
813 (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
814 (if (null tin) (ewoc-enter-first c fi) ;empty collection
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
815 (assert (not (cvs-fileinfo< fi (ewoc-data tin))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
816 (let ((next-tin (ewoc-next c tin)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
817 (while (not (or (null next-tin)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
818 (cvs-fileinfo< fi (ewoc-data next-tin))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
819 (setq tin next-tin next-tin (ewoc-next c next-tin)))
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
820 (if (or (cvs-fileinfo< (ewoc-data tin) fi)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
821 (eq (cvs-fileinfo->type fi) 'MESSAGE))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
822 ;; tin < fi < next-tin
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
823 (ewoc-enter-after c tin fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
824 ;; fi == tin
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
825 (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
826 (ewoc-invalidate c tin)
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
827 ;; Move cursor back to where it belongs.
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
828 (when (bolp) (cvs-move-to-goal-column))
32488
1fd2c9a94ec3 * pcvs.el (cvs-make-cvs-buffer, cvs-run-process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32309
diff changeset
829 tin))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
830
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
831 (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
832 "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
833 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
834 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
835 :group 'pcl-cvs
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
836 :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
837
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
838 (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
839 "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
840 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
841 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
842 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
843 the problem."
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
844 (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
845 (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
846 (eq (cvs-fileinfo->subtype fi) 'REMOVED)))
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
847 (file-exists-p (cvs-fileinfo->full-name fi))))
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
848
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
849 ;; called at the following times:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
850 ;; - 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
851 ;; - pre-run ((eq cvs-auto-remove-handled 'delayed) nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
852 ;; - remove-handled (t (or cvs-auto-remove-directories 'handled) t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
853 ;; - cvs-cmd-do (nil nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
854 ;; - post-ignore (nil nil nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
855 ;; - acknowledge (nil nil nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
856 ;; - remove (nil nil nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
857 (defun cvs-cleanup-collection (c rm-handled rm-dirs rm-msgs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
858 "Remove undesired entries.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
859 C is the collection
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
860 RM-HANDLED if non-nil means remove handled entries.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
861 RM-DIRS behaves like `cvs-auto-remove-directories'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
862 RM-MSGS if non-nil means remove messages."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
863 (let (last-fi first-dir (rerun t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
864 (while rerun
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
865 (setq rerun nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
866 (setq first-dir t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
867 (setq last-fi (cvs-create-fileinfo 'DEAD "../" "" "")) ;place-holder
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
868 (ewoc-filter
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
869 c (lambda (fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
870 (let* ((type (cvs-fileinfo->type fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
871 (subtype (cvs-fileinfo->subtype fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
872 (keep
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
873 (case type
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
874 ;; 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
875 (MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
876 ;; remove entries
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
877 (DEAD nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
878 ;; handled also?
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
879 (UP-TO-DATE (not rm-handled))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
880 ;; keep the rest
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
881 (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
882 '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
883
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
884 ;; mark dirs for removal
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
885 (when (and keep rm-dirs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
886 (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
887 (not (when first-dir (setq first-dir nil) t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
888 (or (eq rm-dirs 'all)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
889 (not (cvs-string-prefix-p
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
890 (cvs-fileinfo->dir last-fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
891 (cvs-fileinfo->dir fi)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
892 (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
893 (eq subtype 'FOOTER)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
894 (setf (cvs-fileinfo->type last-fi) 'DEAD)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
895 (setq rerun t))
28862
d089f0a330a0 (cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
896 (when keep (setq last-fi fi)))))
d089f0a330a0 (cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
897 ;; remove empty last dir
d089f0a330a0 (cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
898 (when (and rm-dirs
d089f0a330a0 (cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
899 (not first-dir)
d089f0a330a0 (cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
900 (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
901 (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
902 (setq rerun t)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
903
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
904 (defun cvs-get-cvsroot ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
905 "Gets the CVSROOT for DIR."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
906 (let ((cvs-cvsroot-file (expand-file-name "Root" "CVS")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
907 (or (cvs-file-to-string cvs-cvsroot-file t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
908 cvs-cvsroot
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
909 (getenv "CVSROOT")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
910 "?????")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
911
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
912 (defun cvs-get-module ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
913 "Return the current CVS module.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
914 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
915 (let* ((repfile (expand-file-name "Repository" "CVS"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
916 (rep (cvs-file-to-string repfile t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
917 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
918 ((null rep) "")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
919 ((not (file-name-absolute-p rep)) rep)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
920 (t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
921 (let* ((root (cvs-get-cvsroot))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
922 (str (concat (file-name-as-directory (or root "/")) " || " rep)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
923 (if (and root (string-match "\\(.*\\) || \\1\\(.*\\)\\'" str))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
924 (match-string 2 str)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
925 (file-name-nondirectory rep)))))))
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
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
928
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
929 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
930 ;;;; running a "cvs checkout".
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
931 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
932
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
933 ;;;###autoload
61245
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
934 (defun cvs-checkout (modules dir flags &optional root)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
935 "Run a 'cvs checkout MODULES' in DIR.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
936 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
937 and run `cvs-mode' on it.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
938
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
939 With a prefix argument, prompt for cvs FLAGS to use."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
940 (interactive
61245
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
941 (let ((root (cvs-get-cvsroot)))
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
942 (if (or (null root) current-prefix-arg)
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
943 (setq root (read-string "CVS Root: ")))
78535
651c50f01f5f (cvs-reread-cvsrc, cvs-checkout, cvs-mode-checkout)
Richard M. Stallman <rms@gnu.org>
parents: 78239
diff changeset
944 (list (split-string-and-unquote
651c50f01f5f (cvs-reread-cvsrc, cvs-checkout, cvs-mode-checkout)
Richard M. Stallman <rms@gnu.org>
parents: 78239
diff changeset
945 (read-string "Module(s): " (cvs-get-module)))
61245
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
946 (read-directory-name "CVS Checkout Directory: "
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
947 nil default-directory nil)
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
948 (cvs-add-branch-prefix
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
949 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags"))
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
950 root)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
951 (when (eq flags t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
952 (setf flags (cvs-flags-query 'cvs-checkout-flags nil 'noquery)))
61245
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
953 (let ((cvs-cvsroot root))
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
954 (cvs-cmd-do "checkout" (or dir default-directory)
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
955 (append flags modules) nil 'new
b8fb5fb4b960 (cvs-checkout): Prompt for cvsroot as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61206
diff changeset
956 :noexist t)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
957
58158
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
958 (defun-cvs-mode (cvs-mode-checkout . NOARGS) (dir)
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
959 "Run cvs checkout against the current branch.
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
960 The files are stored to DIR."
63421
8d79f84e54e8 (cvs-mode): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63210
diff changeset
961 (interactive
58158
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
962 (let* ((branch (cvs-prefix-get 'cvs-branch-prefix))
63421
8d79f84e54e8 (cvs-mode): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63210
diff changeset
963 (prompt (format "CVS Checkout Directory for `%s%s': "
58158
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
964 (cvs-get-module)
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
965 (if branch (format " (branch: %s)" branch)
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
966 ""))))
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
967 (list (read-directory-name prompt nil default-directory nil))))
78535
651c50f01f5f (cvs-reread-cvsrc, cvs-checkout, cvs-mode-checkout)
Richard M. Stallman <rms@gnu.org>
parents: 78239
diff changeset
968 (let ((modules (split-string-and-unquote (cvs-get-module)))
58158
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
969 (flags (cvs-add-branch-prefix
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
970 (cvs-flags-query 'cvs-checkout-flags "cvs checkout flags")))
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
971 (cvs-cvsroot (cvs-get-cvsroot)))
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
972 (cvs-checkout modules dir flags)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
973
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
974 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
975 ;;;; 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
976 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
977
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
978 (defun-cvs-mode (cvs-mode-revert-buffer . SIMPLE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
979 (&optional ignore-auto noconfirm)
35623
d88382df7b52 (cvs-mode-revert-buffer): Doc fix.
Dave Love <fx@gnu.org>
parents: 34653
diff changeset
980 "Rerun `cvs-examine' on the current directory with the default flags."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
981 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
982 (cvs-examine default-directory t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
983
78654
e3a7c52130ec (cvs-query-directory): Only prompt when prefix is given.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78639
diff changeset
984 (defun cvs-query-directory (prompt)
e3a7c52130ec (cvs-query-directory): Only prompt when prefix is given.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78639
diff changeset
985 "Read directory name, prompting with PROMPT.
e3a7c52130ec (cvs-query-directory): Only prompt when prefix is given.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78639
diff changeset
986 If in a *cvs* buffer, don't prompt unless a prefix argument is given."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
987 (if (and (cvs-buffer-p)
78654
e3a7c52130ec (cvs-query-directory): Only prompt when prefix is given.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78639
diff changeset
988 (not current-prefix-arg))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
989 default-directory
78654
e3a7c52130ec (cvs-query-directory): Only prompt when prefix is given.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78639
diff changeset
990 (read-directory-name prompt nil default-directory nil)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
991
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
992 ;;;###autoload
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
993 (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
994 "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
995 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
996 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
997 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
998 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
999 FLAGS is ignored."
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1000 (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
1001 ;; 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
1002 (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
1003 (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
1004 (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
1005 (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
1006 last)
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1007 ;; 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
1008 (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
1009 (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
1010 (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
1011 (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
1012 (set-buffer cvsbuf)
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1013 (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
1014 (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
1015 (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
1016 (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
1017 cvs-auto-remove-directories
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1018 nil)
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1019 (if noshow cvsbuf
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1020 (let ((pop-up-windows nil)) (pop-to-buffer cvsbuf)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1021
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1022 ;;;###autoload
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1023 (defun cvs-examine (directory flags &optional noshow)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1024 "Run a `cvs -n update' in the specified DIRECTORY.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1025 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
1026 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
1027 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
1028 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]),
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1029 prevents reuse of an existing *cvs* buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1030 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
1031 (interactive (list (cvs-query-directory "CVS Examine (directory): ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1032 (cvs-flags-query 'cvs-update-flags "cvs -n update flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1033 (when (eq flags t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1034 (setf flags (cvs-flags-query 'cvs-update-flags nil 'noquery)))
50651
7b04c2825a38 (cvs-examine): Respect `find-file-visit-truename'.
Sam Steingold <sds@gnu.org>
parents: 50202
diff changeset
1035 (when find-file-visit-truename (setq directory (file-truename directory)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1036 (cvs-cmd-do "update" directory flags nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1037 (> (prefix-numeric-value current-prefix-arg) 8)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1038 :cvsargs '("-n")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1039 :noshow noshow
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1040 :dont-change-disc t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1041
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1042
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1043 ;;;###autoload
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1044 (defun cvs-update (directory flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1045 "Run a `cvs update' in the current working DIRECTORY.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1046 Feed the output to a *cvs* buffer and run `cvs-mode' on it.
47729
8dcdf2a8c1f8 (cvs-mode-find-file): Look up font-lock-face so it also
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47470
diff changeset
1047 With a \\[universal-argument] prefix argument, prompt for a directory to use.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1048 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]),
47729
8dcdf2a8c1f8 (cvs-mode-find-file): Look up font-lock-face so it also
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47470
diff changeset
1049 prevents reuse of an existing *cvs* buffer.
8dcdf2a8c1f8 (cvs-mode-find-file): Look up font-lock-face so it also
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47470
diff changeset
1050 The prefix is also passed to `cvs-flags-query' to select the FLAGS
8dcdf2a8c1f8 (cvs-mode-find-file): Look up font-lock-face so it also
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47470
diff changeset
1051 passed to cvs."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1052 (interactive (list (cvs-query-directory "CVS Update (directory): ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1053 (cvs-flags-query 'cvs-update-flags "cvs update flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1054 (when (eq flags t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1055 (setf flags (cvs-flags-query 'cvs-update-flags nil 'noquery)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1056 (cvs-cmd-do "update" directory flags nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1057 (> (prefix-numeric-value current-prefix-arg) 8)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1058
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 ;;;###autoload
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1061 (defun cvs-status (directory flags &optional noshow)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1062 "Run a `cvs status' in the current working DIRECTORY.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1063 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
1064 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
1065 A prefix arg >8 (ex: \\[universal-argument] \\[universal-argument]),
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1066 prevents reuse of an existing *cvs* buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1067 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
1068 (interactive (list (cvs-query-directory "CVS Status (directory): ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1069 (cvs-flags-query 'cvs-status-flags "cvs status flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1070 (when (eq flags t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1071 (setf flags (cvs-flags-query 'cvs-status-flags nil 'noquery)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1072 (cvs-cmd-do "status" directory flags nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1073 (> (prefix-numeric-value current-prefix-arg) 8)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1074 :noshow noshow :dont-change-disc t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1075
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1076 (defun cvs-update-filter (proc string)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1077 "Filter function for pcl-cvs.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1078 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
1079 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
1080 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
1081 (save-match-data
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1082 (with-current-buffer (process-buffer proc)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1083 (let ((inhibit-read-only t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1084 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1085 ;; Insert the text, moving the process-marker.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1086 (goto-char (process-mark proc))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1087 (insert string)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1088 (set-marker (process-mark proc) (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1089 ;; FIXME: Delete any old lock message
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1090 ;;(if (tin-nth cookies 1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1091 ;; (tin-delete cookies
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1092 ;; (tin-nth cookies 1)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1093 ;; 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
1094 (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
1095 (when (looking-at "^[ a-z]+: \\(.*waiting for .*lock in \\(.*\\)\\)$")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1096 (let ((msg (match-string 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1097 (lock (match-string 2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1098 (with-current-buffer cvs-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1099 (set (make-local-variable 'cvs-lock-file) lock)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1100 ;; display the lock situation in the *cvs* buffer:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1101 (ewoc-enter-last
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1102 cvs-cookies
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1103 (cvs-create-fileinfo
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1104 'MESSAGE "" " "
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1105 (concat msg
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1106 (when (file-exists-p lock)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1107 (substitute-command-keys
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1108 "\n\t(type \\[cvs-mode-delete-lock] to delete it)")))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1109 :subtype 'TEMP))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1110 (pop-to-buffer (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1111 (goto-char (point-max))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1112 (beep)))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1113
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1114
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1115 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1116 ;;;; The cvs-mode and its associated commands.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1117 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1118
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1119 (cvs-prefix-define cvs-force-command "" "" '("/F") cvs-qtypedesc-string1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1120 (defun-cvs-mode cvs-mode-force-command (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1121 "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
1122 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
1123 \"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
1124 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
1125 the override will persist until the next toggle."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1126 (interactive "P")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1127 (cvs-prefix-set 'cvs-force-command arg))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1128
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1129 (put 'cvs-mode 'mode-class 'special)
50965
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
1130 (define-derived-mode cvs-mode nil "CVS"
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1131 "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
1132 Full documentation is in the Texinfo file."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1133 (setq mode-line-process
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1134 '("" cvs-force-command cvs-ignore-marks-modif
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1135 ":" (cvs-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1136 ("" cvs-branch-prefix (cvs-secondary-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1137 ("->" cvs-secondary-branch-prefix))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1138 " " cvs-mode-line-process))
50965
c1e6923f4f9b (cvs-make-cvs-buffer): Add the tag info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50958
diff changeset
1139 (if buffer-file-name
63421
8d79f84e54e8 (cvs-mode): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63210
diff changeset
1140 (error "Use M-x cvs-quickdir to get a *cvs* buffer"))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1141 (buffer-disable-undo)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1142 ;;(set (make-local-variable 'goal-column) cvs-cursor-column)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1143 (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
1144 (setq truncate-lines t)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1145 (cvs-prefix-make-local 'cvs-branch-prefix)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1146 (cvs-prefix-make-local 'cvs-secondary-branch-prefix)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1147 (cvs-prefix-make-local 'cvs-force-command)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1148 (cvs-prefix-make-local 'cvs-ignore-marks-modif)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1149 (make-local-variable 'cvs-mode-line-process)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1150 (make-local-variable 'cvs-temp-buffers))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1151
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1152
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1153 (defun cvs-buffer-p (&optional buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1154 "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
1155 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1156 (if buffer (set-buffer buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1157 (and (eq major-mode 'cvs-mode))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1158
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1159 (defun cvs-buffer-check ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1160 "Check that the current buffer follows cvs-buffer's conventions."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1161 (let ((buf (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1162 (check 'none))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1163 (or (and (setq check 'collection)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1164 (eq (ewoc-buffer cvs-cookies) buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1165 (setq check 'cvs-temp-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1166 (or (null cvs-temp-buffer)
61205
7178fdb70eff (cvs-temp-buffer, cvs-mode-kill-process, cvs-buffer-check):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 60602
diff changeset
1167 (null (buffer-live-p cvs-temp-buffer))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1168 (and (eq (with-current-buffer cvs-temp-buffer cvs-buffer) buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1169 (equal (with-current-buffer cvs-temp-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1170 default-directory)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1171 default-directory)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1172 t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1173 (error "Inconsistent %s in buffer %s" check (buffer-name buf)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1174
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1175
34376
25976c39c41e * pcvs.el (cvs-menu): Use `cvs-menu' rather than `cvs-menu-map'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34304
diff changeset
1176 (defun cvs-mode-quit ()
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1177 "Quit PCL-CVS, killing the *cvs* buffer."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1178 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1179 (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
1180
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1181 ;; Give help....
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1182
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1183 (defun cvs-help ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1184 "Display help for various PCL-CVS commands."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1185 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1186 (if (eq last-command 'cvs-help)
34408
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1187 (describe-function 'cvs-mode) ; would need minor-mode for log-edit-mode
65582
4d1085b02d64 Message format spec fixes (1)
Deepak Goel <deego@gnufans.org>
parents: 64762
diff changeset
1188 (message "%s"
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1189 (substitute-command-keys
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1190 "`\\[cvs-help]':help `\\[cvs-mode-add]':add `\\[cvs-mode-commit]':commit \
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1191 `\\[cvs-mode-diff-map]':diff* `\\[cvs-mode-log]':log \
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1192 `\\[cvs-mode-remove]':remove `\\[cvs-mode-status]':status \
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1193 `\\[cvs-mode-undo]':undo"))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1194
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1195 ;; Move around in the buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1196
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1197 (defun cvs-move-to-goal-column ()
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1198 (let* ((eol (line-end-position))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1199 (fpos (next-single-property-change (point) 'cvs-goal-column nil eol)))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1200 (when (< fpos eol)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1201 (goto-char fpos))))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1202
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1203 (defun-cvs-mode cvs-mode-previous-line (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1204 "Go to the previous line.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1205 If a prefix argument is given, move by that many lines."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1206 (interactive "p")
44384
3626a12fe452 * pcvs.el (cvs-mode-previous-line, cvs-mode-next-line): Move to
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 42966
diff changeset
1207 (ewoc-goto-prev cvs-cookies arg)
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1208 (cvs-move-to-goal-column))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1209
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1210 (defun-cvs-mode cvs-mode-next-line (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1211 "Go to the next line.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1212 If a prefix argument is given, move by that many lines."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1213 (interactive "p")
44384
3626a12fe452 * pcvs.el (cvs-mode-previous-line, cvs-mode-next-line): Move to
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 42966
diff changeset
1214 (ewoc-goto-next cvs-cookies arg)
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
1215 (cvs-move-to-goal-column))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1216
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
1217 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1218 ;;;; Mark handling
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
1219 ;;;;
28088
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 (defun-cvs-mode cvs-mode-mark (&optional arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1222 "Mark the fileinfo on the current line.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1223 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
1224 marked instead. A directory can never be marked."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1225 (interactive)
30879
3a1ff1caafe2 * emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30717
diff changeset
1226 (let* ((tin (ewoc-locate cvs-cookies))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1227 (fi (ewoc-data tin)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1228 (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1229 ;; it's a directory: let's mark all files inside
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1230 (ewoc-map
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1231 (lambda (f dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1232 (when (cvs-dir-member-p f dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1233 (setf (cvs-fileinfo->marked f)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1234 (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
1235 t)) ;Tell cookie to redisplay this cookie.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1236 cvs-cookies
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1237 (cvs-fileinfo->dir fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1238 ;; not a directory: just do the obvious
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1239 (setf (cvs-fileinfo->marked fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1240 (not (if (eq arg 'toggle) (cvs-fileinfo->marked fi) arg)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1241 (ewoc-invalidate cvs-cookies tin)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1242 (cvs-mode-next-line 1))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1243
54870
3b1741ff0676 (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54619
diff changeset
1244 (defalias 'cvs-mouse-toggle-mark 'cvs-mode-toggle-mark)
3b1741ff0676 (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54619
diff changeset
1245 (defun cvs-mode-toggle-mark (e)
3b1741ff0676 (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54619
diff changeset
1246 "Toggle the mark of the entry at point."
3b1741ff0676 (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54619
diff changeset
1247 (interactive (list last-input-event))
30879
3a1ff1caafe2 * emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30717
diff changeset
1248 (save-excursion
54870
3b1741ff0676 (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54619
diff changeset
1249 (posn-set-point (event-end e))
30879
3a1ff1caafe2 * emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30717
diff changeset
1250 (cvs-mode-mark 'toggle)))
28088
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 cvs-mode-unmark ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1253 "Unmark the fileinfo on the current line."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1254 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1255 (cvs-mode-mark t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1256
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1257 (defun-cvs-mode cvs-mode-mark-all-files ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1258 "Mark all files."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1259 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1260 (ewoc-map (lambda (cookie)
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1261 (unless (eq (cvs-fileinfo->type cookie) 'DIRCHANGE)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1262 (setf (cvs-fileinfo->marked cookie) t)))
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1263 cvs-cookies))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1264
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1265 (defun-cvs-mode (cvs-mode-mark-on-state . SIMPLE) (state)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1266 "Mark all files in state STATE."
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1267 (interactive
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1268 (list
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1269 (let ((default
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1270 (condition-case nil
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1271 (downcase
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1272 (symbol-name
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1273 (cvs-fileinfo->type
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1274 (cvs-mode-marked nil nil :read-only t :one t :noquery t))))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1275 (error nil))))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1276 (intern
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1277 (upcase
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1278 (completing-read
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1279 (concat
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1280 "Mark files in state" (if default (concat " [" default "]")) ": ")
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1281 (mapcar (lambda (x)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1282 (list (downcase (symbol-name (car x)))))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1283 cvs-states)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1284 nil t nil nil default))))))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1285 (ewoc-map (lambda (fi)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1286 (when (eq (cvs-fileinfo->type fi) state)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1287 (setf (cvs-fileinfo->marked fi) t)))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1288 cvs-cookies))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1289
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1290 (defun-cvs-mode cvs-mode-mark-matching-files (regex)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1291 "Mark all files matching REGEX."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1292 (interactive "sMark files matching: ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1293 (ewoc-map (lambda (cookie)
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1294 (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
1295 (string-match regex (cvs-fileinfo->file cookie)))
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1296 (setf (cvs-fileinfo->marked cookie) t)))
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1297 cvs-cookies))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1298
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1299 (defun-cvs-mode cvs-mode-unmark-all-files ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1300 "Unmark all files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1301 Directories are also unmarked, but that doesn't matter, since
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1302 they should always be unmarked."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1303 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1304 (ewoc-map (lambda (cookie)
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1305 (setf (cvs-fileinfo->marked cookie) nil)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1306 t)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1307 cvs-cookies))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1308
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1309 (defun-cvs-mode cvs-mode-unmark-up ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1310 "Unmark the file on the previous line."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1311 (interactive)
30879
3a1ff1caafe2 * emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30717
diff changeset
1312 (let ((tin (ewoc-goto-prev cvs-cookies 1)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1313 (when tin
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1314 (setf (cvs-fileinfo->marked (ewoc-data tin)) nil)
52669
2db8fbd2339c (cvs-mode-unmark-up): Move to goal column when done.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52552
diff changeset
1315 (ewoc-invalidate cvs-cookies tin)))
2db8fbd2339c (cvs-mode-unmark-up): Move to goal column when done.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52552
diff changeset
1316 (cvs-move-to-goal-column))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1317
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1318 (defconst cvs-ignore-marks-alternatives
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1319 '(("toggle-marks" . "/TM")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1320 ("force-marks" . "/FM")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1321 ("ignore-marks" . "/IM")))
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 (cvs-prefix-define cvs-ignore-marks-modif
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1324 "Prefix to decide whether to ignore marks or not."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1325 "active"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1326 (mapcar 'cdr cvs-ignore-marks-alternatives)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1327 (cvs-qtypedesc-create
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1328 (lambda (str) (cdr (assoc str cvs-ignore-marks-alternatives)))
36615
c3af189df631 (cvs-ignore-marks-modif): Use `rassoc' rather than `member*'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35707
diff changeset
1329 (lambda (obj) (car (rassoc obj cvs-ignore-marks-alternatives)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1330 (lambda () cvs-ignore-marks-alternatives)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1331 nil t))
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 (defun-cvs-mode cvs-mode-toggle-marks (arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1334 "Toggle whether the next CVS command uses marks.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1335 See `cvs-prefix-set' for further description of the behavior.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1336 \\[universal-argument] 1 selects `force-marks',
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1337 \\[universal-argument] 2 selects `ignore-marks',
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1338 \\[universal-argument] 3 selects `toggle-marks'."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1339 (interactive "P")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1340 (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
1341
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1342 (defun cvs-ignore-marks-p (cmd &optional read-only)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1343 (let ((default (if (member cmd cvs-invert-ignore-marks)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1344 (not cvs-default-ignore-marks)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1345 cvs-default-ignore-marks))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1346 (modif (cvs-prefix-get 'cvs-ignore-marks-modif read-only)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1347 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1348 ((equal modif "/IM") t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1349 ((equal modif "/TM") (not default))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1350 ((equal modif "/FM") nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1351 (t default))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1352
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1353 (defun cvs-mode-mark-get-modif (cmd)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1354 (if (cvs-ignore-marks-p cmd 'read-only) "/IM" "/FM"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1355
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1356 (defun cvs-get-marked (&optional ignore-marks ignore-contents)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1357 "Return a list of all selected fileinfos.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1358 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
1359 Otherwise, if the cursor selects a directory, and IGNORE-CONTENTS is
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1360 nil, return all files in it, else return just the directory.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1361 Otherwise return (a list containing) the file the cursor points to, or
55458
f673d8bf105a (cvs-mode-run, cvs-is-within-p): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 54870
diff changeset
1362 an empty list if it doesn't point to a file at all."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1363 (let ((fis nil))
30717
e6e5480e5b25 (cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
1364 (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
1365 (consp cvs-minor-current-files))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1366 (mapcar
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1367 (lambda (f)
30717
e6e5480e5b25 (cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
1368 (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
1369 (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
1370 (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
1371 (cvs-create-fileinfo
e6e5480e5b25 (cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
1372 '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
1373 (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
1374 (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
1375 (cvs-create-fileinfo
e6e5480e5b25 (cvs-menu): Don't move point. Use popup-menu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
1376 'UNKNOWN (or dir "") file ""))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1377 cvs-minor-current-files)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1378 (or (and (not ignore-marks)
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1379 (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
1380 (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
1381
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1382 (if (or ignore-contents (not (eq (cvs-fileinfo->type fi) 'DIRCHANGE)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1383 (push fi fis)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1384 ;; If a directory is selected, return members, if any.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1385 (setq fis
34412
da1ec51d3da7 (cvs-mode-marked): Set up the default for CMD manually.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34408
diff changeset
1386 (append (ewoc-collect
da1ec51d3da7 (cvs-mode-marked): Set up the default for CMD manually.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34408
diff changeset
1387 cvs-cookies 'cvs-dir-member-p (cvs-fileinfo->dir fi))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1388 fis))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1389 (nreverse fis)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1390
34412
da1ec51d3da7 (cvs-mode-marked): Set up the default for CMD manually.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34408
diff changeset
1391 (defun* cvs-mode-marked (filter &optional cmd
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1392 &key read-only one file noquery)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1393 "Get the list of marked FIS.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1394 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
1395 Only files for which FILTER is applicable are returned.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1396 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
1397 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
1398 If FILE is non-nil, directory entries won't be selected."
34412
da1ec51d3da7 (cvs-mode-marked): Set up the default for CMD manually.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34408
diff changeset
1399 (unless cmd (setq cmd (symbol-name filter)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1400 (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
1401 (and (not file)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1402 (cvs-applicable-p 'DIRCHANGE filter))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1403 (force (cvs-prefix-get 'cvs-force-command))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1404 (fis (car (cvs-partition
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1405 (lambda (fi) (cvs-applicable-p fi (and (not force) filter)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1406 fis))))
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1407 (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
1408 (message (if (null fis)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1409 "`%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
1410 "`%s' is only applicable to a single file.") cmd)
34412
da1ec51d3da7 (cvs-mode-marked): Set up the default for CMD manually.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34408
diff changeset
1411 (sit-for 1)
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1412 (setq fis (list (cvs-insert-file
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1413 (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
1414 (if one (car fis) fis)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1415
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1416 (defun cvs-enabledp (filter)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1417 "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
1418 (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
1419
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1420 (defun cvs-mode-files (&rest -cvs-mode-files-args)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1421 (cvs-mode!
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1422 (lambda ()
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1423 (mapcar 'cvs-fileinfo->full-name
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1424 (apply 'cvs-mode-marked -cvs-mode-files-args)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1425
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1426 ;;
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1427 ;; Interface between Log-Edit and PCL-CVS
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1428 ;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1429
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1430 (defun cvs-mode-commit-setup ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1431 "Run `cvs-mode-commit' with setup."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1432 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1433 (cvs-mode-commit 'force))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1434
40479
2930fd135efa (cvs-mode-commit-hook): New hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39392
diff changeset
1435 (defcustom cvs-mode-commit-hook nil
2930fd135efa (cvs-mode-commit-hook): New hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39392
diff changeset
1436 "Hook run after setting up the commit buffer."
2930fd135efa (cvs-mode-commit-hook): New hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39392
diff changeset
1437 :type 'hook
48445
86325beb168c (cvs-minor-mode, cvs-mode-commit-hook): Add group.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48285
diff changeset
1438 :options '(cvs-mode-diff)
86325beb168c (cvs-minor-mode, cvs-mode-commit-hook): Add group.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48285
diff changeset
1439 :group 'pcl-cvs)
40479
2930fd135efa (cvs-mode-commit-hook): New hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39392
diff changeset
1440
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1441 (defun cvs-mode-commit (setup)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1442 "Check in all marked files, or the current file.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1443 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
1444 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
1445 of `cvs-buffer-name-alist'.
34408
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1446 The POSTPROC specified there (typically `log-edit') is then called,
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1447 passing it the SETUP argument."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1448 (interactive "P")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1449 ;; 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
1450 ;; form of `(cvs-mode! (lambda ...))' screws up a couple things which
34408
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1451 ;; end up being rather annoying (like log-edit-mode's message being
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1452 ;; displayed in the wrong minibuffer).
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1453 (cvs-mode!)
34408
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1454 (let ((buf (cvs-temp-buffer "message" 'normal 'nosetup))
30618
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
1455 (setupfun (or (nth 2 (cdr (assoc "message" cvs-buffer-name-alist)))
34408
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1456 'log-edit)))
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1457 (funcall setupfun 'cvs-do-commit setup 'cvs-commit-filelist buf)
0f95f2e53b1f Update references to CVS-Edit (now Log-Edit).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34376
diff changeset
1458 (set (make-local-variable 'cvs-minor-wrap-function) 'cvs-commit-minor-wrap)
40479
2930fd135efa (cvs-mode-commit-hook): New hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39392
diff changeset
1459 (run-hooks 'cvs-mode-commit-hook)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1460
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1461 (defun cvs-commit-minor-wrap (buf f)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1462 (let ((cvs-ignore-marks-modif (cvs-mode-mark-get-modif "commit")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1463 (funcall f)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1464
33359
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
1465 (defun cvs-commit-filelist ()
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
1466 (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
1467
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1468 (defun cvs-do-commit (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1469 "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
1470 (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
1471 (let ((msg (buffer-substring-no-properties (point-min) (point-max))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1472 (cvs-mode!)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1473 ;;(pop-to-buffer cvs-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1474 (cvs-mode-do "commit" (list* "-m" msg flags) 'commit)))
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
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1477 ;;;; Editing existing commit log messages.
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1478
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1479 (defun cvs-edit-log-text-at-point ()
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1480 (save-excursion
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1481 (end-of-line)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1482 (when (re-search-backward "^revision " nil t)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1483 (forward-line 1)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1484 (if (looking-at "date:") (forward-line 1))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1485 (if (looking-at "branches:") (forward-line 1))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1486 (buffer-substring
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1487 (point)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1488 (if (re-search-forward
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1489 "^\\(-\\{28\\}\\|=\\{77\\}\\|revision [.0-9]+\\)$"
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1490 nil t)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1491 (match-beginning 0)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1492 (point))))))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1493
50958
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
1494 (defvar cvs-edit-log-revision)
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1495 (defvar cvs-edit-log-files) (put 'cvs-edit-log-files 'permanent-local t)
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1496 (defun cvs-mode-edit-log (file rev &optional text)
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1497 "Edit the log message at point.
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1498 This is best called from a `log-view-mode' buffer."
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1499 (interactive
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1500 (list
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1501 (or (cvs-mode! (lambda ()
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1502 (car (cvs-mode-files nil nil
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1503 :read-only t :file t :noquery t))))
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1504 (read-string "File name: "))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1505 (or (cvs-mode! (lambda () (cvs-prefix-get 'cvs-branch-prefix)))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1506 (read-string "Revision to edit: "))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1507 (cvs-edit-log-text-at-point)))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1508 ;; It seems that the save-excursion that happens if I use the better
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1509 ;; form of `(cvs-mode! (lambda ...))' screws up a couple things which
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1510 ;; end up being rather annoying (like log-edit-mode's message being
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1511 ;; displayed in the wrong minibuffer).
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1512 (cvs-mode!)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1513 (let ((buf (cvs-temp-buffer "message" 'normal 'nosetup))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1514 (setupfun (or (nth 2 (cdr (assoc "message" cvs-buffer-name-alist)))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1515 'log-edit)))
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1516 (with-current-buffer buf
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1517 ;; Set the filename before, so log-edit can correctly setup its
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1518 ;; log-edit-initial-files variable.
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1519 (set (make-local-variable 'cvs-edit-log-files) (list file)))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1520 (funcall setupfun 'cvs-do-edit-log nil 'cvs-edit-log-filelist buf)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1521 (when text (erase-buffer) (insert text))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1522 (set (make-local-variable 'cvs-edit-log-revision) rev)
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1523 (set (make-local-variable 'cvs-minor-wrap-function)
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1524 'cvs-edit-log-minor-wrap)
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1525 ;; (run-hooks 'cvs-mode-commit-hook)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1526 ))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1527
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1528 (defun cvs-edit-log-minor-wrap (buf f)
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1529 (let ((cvs-branch-prefix (with-current-buffer buf cvs-edit-log-revision))
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1530 (cvs-minor-current-files
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1531 (with-current-buffer buf cvs-edit-log-files))
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1532 ;; FIXME: I need to force because the fileinfos are UNKNOWN
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1533 (cvs-force-command "/F"))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1534 (funcall f)))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1535
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1536 (defun cvs-edit-log-filelist ()
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1537 (if cvs-minor-wrap-function
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1538 (cvs-mode-files nil nil :read-only t :file t :noquery t)
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1539 cvs-edit-log-files))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1540
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1541 (defun cvs-do-edit-log (rev)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1542 "Do the actual commit, using the current buffer as the log message."
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1543 (interactive (list cvs-edit-log-revision))
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1544 (let ((msg (buffer-substring-no-properties (point-min) (point-max))))
66096
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1545 (cvs-mode!
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1546 (lambda ()
59b6016b2dc3 (cvs-edit-log-files): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65874
diff changeset
1547 (cvs-mode-do "admin" (list (concat "-m" rev ":" msg)) nil)))))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1548
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
1549
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
1550 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1551 ;;;; CVS Mode commands
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
1552 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1553
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1554 (defun-cvs-mode (cvs-mode-insert . NOARGS) (file)
45325
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
1555 "Insert an entry for a specific file into the current listing.
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
1556 This is typically used if the file is up-to-date (or has been added
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
1557 outside of PCL-CVS) and one wants to do some operation on it."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1558 (interactive
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1559 (list (read-file-name
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1560 "File to insert: "
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1561 ;; Can't use ignore-errors here because interactive
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1562 ;; specs aren't byte-compiled.
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1563 (condition-case nil
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1564 (file-name-as-directory
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1565 (expand-file-name
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1566 (cvs-fileinfo->dir
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1567 (cvs-mode-marked nil nil :read-only t :one t :noquery t))))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1568 (error nil)))))
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1569 (cvs-insert-file file))
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1570
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1571 (defun cvs-insert-file (file)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1572 "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
1573 (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
1574 (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
1575 (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
1576 ;; 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
1577 (goto-char (ewoc-location last))
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1578 (ewoc-data last)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1579
35707
1285b34a630d (cvs-mark-fis-dead): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35623
diff changeset
1580 (defun cvs-mark-fis-dead (fis)
1285b34a630d (cvs-mark-fis-dead): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35623
diff changeset
1581 ;; Helper function, introduced because of the need for macro-expansion.
1285b34a630d (cvs-mark-fis-dead): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35623
diff changeset
1582 (dolist (fi fis)
1285b34a630d (cvs-mark-fis-dead): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35623
diff changeset
1583 (setf (cvs-fileinfo->type fi) 'DEAD)))
1285b34a630d (cvs-mark-fis-dead): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35623
diff changeset
1584
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1585 (defun-cvs-mode (cvs-mode-add . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1586 "Add marked files to the cvs repository.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1587 With prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1588 (interactive (list (cvs-flags-query 'cvs-add-flags "cvs add flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1589 (let ((fis (cvs-mode-marked 'add))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1590 (needdesc nil) (dirs nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1591 ;; find directories and look for fis needing a description
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1592 (dolist (fi fis)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1593 (cond
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1594 ((file-directory-p (cvs-fileinfo->full-name fi)) (push fi dirs))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1595 ((eq (cvs-fileinfo->type fi) 'UNKNOWN) (setq needdesc t))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1596 ;; prompt for description if necessary
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1597 (let* ((msg (if (and needdesc
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1598 (or current-prefix-arg (not cvs-add-default-message)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1599 (read-from-minibuffer "Enter description: ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1600 (or cvs-add-default-message "")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1601 (flags (list* "-m" msg flags))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1602 (postproc
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1603 ;; setup postprocessing for the directory entries
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1604 (when dirs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1605 `((cvs-run-process (list "-n" "update")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1606 ',dirs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1607 '(cvs-parse-process t))
35707
1285b34a630d (cvs-mark-fis-dead): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 35623
diff changeset
1608 (cvs-mark-fis-dead ',dirs)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1609 (cvs-mode-run "add" flags fis :postproc postproc))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1610
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1611 (defun-cvs-mode (cvs-mode-diff . DOUBLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1612 "Diff the selected files against the repository.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1613 This command compares the files in your working area against the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1614 revision which they are based upon."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1615 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1616 (list (cvs-add-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1617 (cvs-add-secondary-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1618 (cvs-flags-query 'cvs-diff-flags "cvs diff flags")))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1619 (cvs-mode-do "diff" flags 'diff
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1620 :show t)) ;; :ignore-exit t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1621
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1622 (defun-cvs-mode (cvs-mode-diff-head . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1623 "Diff the selected files against the head of the current branch.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1624 See ``cvs-mode-diff'' for more info."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1625 (interactive (list (cvs-flags-query 'cvs-diff-flags "cvs diff flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1626 (cvs-mode-diff-1 (cons "-rHEAD" flags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1627
56314
6a5f26b68c3c (cvs-mode-diff-repository): New command.
Juri Linkov <juri@jurta.org>
parents: 56011
diff changeset
1628 (defun-cvs-mode (cvs-mode-diff-repository . SIMPLE) (flags)
6a5f26b68c3c (cvs-mode-diff-repository): New command.
Juri Linkov <juri@jurta.org>
parents: 56011
diff changeset
1629 "Diff the files for changes in the repository since last co/update/commit.
6a5f26b68c3c (cvs-mode-diff-repository): New command.
Juri Linkov <juri@jurta.org>
parents: 56011
diff changeset
1630 See ``cvs-mode-diff'' for more info."
6a5f26b68c3c (cvs-mode-diff-repository): New command.
Juri Linkov <juri@jurta.org>
parents: 56011
diff changeset
1631 (interactive (list (cvs-flags-query 'cvs-diff-flags "cvs diff flags")))
6a5f26b68c3c (cvs-mode-diff-repository): New command.
Juri Linkov <juri@jurta.org>
parents: 56011
diff changeset
1632 (cvs-mode-diff-1 (cons "-rBASE" (cons "-rHEAD" flags))))
6a5f26b68c3c (cvs-mode-diff-repository): New command.
Juri Linkov <juri@jurta.org>
parents: 56011
diff changeset
1633
56011
bf2ee754eeed (cvs-mode-diff-yesterday): New command.
Kim F. Storm <storm@cua.dk>
parents: 55695
diff changeset
1634 (defun-cvs-mode (cvs-mode-diff-yesterday . SIMPLE) (flags)
bf2ee754eeed (cvs-mode-diff-yesterday): New command.
Kim F. Storm <storm@cua.dk>
parents: 55695
diff changeset
1635 "Diff the selected files against yesterday's head of the current branch.
bf2ee754eeed (cvs-mode-diff-yesterday): New command.
Kim F. Storm <storm@cua.dk>
parents: 55695
diff changeset
1636 See ``cvs-mode-diff'' for more info."
bf2ee754eeed (cvs-mode-diff-yesterday): New command.
Kim F. Storm <storm@cua.dk>
parents: 55695
diff changeset
1637 (interactive (list (cvs-flags-query 'cvs-diff-flags "cvs diff flags")))
bf2ee754eeed (cvs-mode-diff-yesterday): New command.
Kim F. Storm <storm@cua.dk>
parents: 55695
diff changeset
1638 (cvs-mode-diff-1 (cons "-Dyesterday" flags)))
bf2ee754eeed (cvs-mode-diff-yesterday): New command.
Kim F. Storm <storm@cua.dk>
parents: 55695
diff changeset
1639
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1640 (defun-cvs-mode (cvs-mode-diff-vendor . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1641 "Diff the selected files against the head of the vendor branch.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1642 See ``cvs-mode-diff'' for more info."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1643 (interactive (list (cvs-flags-query 'cvs-diff-flags "cvs diff flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1644 (cvs-mode-diff-1 (cons (concat "-r" cvs-vendor-branch) flags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1645
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1646 ;; 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
1647 (defun-cvs-mode (cvs-mode-diff-backup . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1648 "Diff the files against the backup file.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1649 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
1650 or \"Conflict\" in the *cvs* buffer."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1651 (interactive (list (cvs-flags-query 'cvs-diff-flags "diff flags")))
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37339
diff changeset
1652 (unless (listp flags) (error "flags should be a list of strings"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1653 (save-some-buffers)
50958
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
1654 (let* ((marked (cvs-get-marked (cvs-ignore-marks-p "diff")))
33359
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
1655 (fis (car (cvs-partition 'cvs-fileinfo->backup-file marked))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1656 (unless (consp fis)
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1657 (error "No files with a backup file selected!"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1658 ;; let's extract some info into the environment for `buffer-name'
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1659 (let* ((dir (cvs-fileinfo->dir (car fis)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1660 (file (cvs-fileinfo->file (car fis))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1661 (set-buffer (cvs-temp-buffer "diff")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1662 (message "cvs diff backup...")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1663 (cvs-execute-single-file-list fis 'cvs-diff-backup-extractor
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1664 cvs-diff-program flags))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1665 (message "cvs diff backup... Done."))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1666
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1667 (defun cvs-diff-backup-extractor (fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1668 "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
1669 Signal an error if there is no backup file."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1670 (let ((backup-file (cvs-fileinfo->backup-file fileinfo)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1671 (unless backup-file
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1672 (error "%s has no backup file" (cvs-fileinfo->full-name fileinfo)))
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1673 (list backup-file (cvs-fileinfo->full-name fileinfo))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1674
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 ;; Emerge support
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1677 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1678 (defun cvs-emerge-diff (b1 b2) (emerge-buffers b1 b2 b1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1679 (defun cvs-emerge-merge (b1 b2 base out)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1680 (emerge-buffers-with-ancestor b1 b2 base (find-file-noselect out)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1681
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 ;; Ediff support
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
1684 ;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1685
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1686 (defvar ediff-after-quit-destination-buffer)
50958
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
1687 (defvar ediff-after-quit-hook-internal)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1688 (defvar cvs-transient-buffers)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1689 (defun cvs-ediff-startup-hook ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1690 (add-hook 'ediff-after-quit-hook-internal
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1691 `(lambda ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1692 (cvs-ediff-exit-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1693 ',ediff-after-quit-destination-buffer ',cvs-transient-buffers))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1694 nil 'local))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1695
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1696 (defun cvs-ediff-exit-hook (cvs-buf tmp-bufs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1697 ;; kill the temp buffers (and their associated windows)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1698 (dolist (tb tmp-bufs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1699 (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
1700 (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
1701 (kill-buffer tb)
32187
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1702 (when (window-live-p win) (ignore-errors (delete-window win))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1703 ;; switch back to the *cvs* buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1704 (when (and cvs-buf (buffer-live-p cvs-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1705 (not (get-buffer-window cvs-buf t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1706 (ignore-errors (switch-to-buffer cvs-buf))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1707
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1708 (defun cvs-ediff-diff (b1 b2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1709 (let ((ediff-after-quit-destination-buffer (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1710 (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
1711 (ediff-buffers b1 b2 startup-hook 'ediff-revision)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1712
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1713 (defun cvs-ediff-merge (b1 b2 base out)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1714 (let ((ediff-after-quit-destination-buffer (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1715 (startup-hook '(cvs-ediff-startup-hook)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1716 (ediff-merge-buffers-with-ancestor
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1717 b1 b2 base startup-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1718 'ediff-merge-revisions-with-ancestor
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1719 out)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1720
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1721 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1722 ;; Interactive merge/diff support.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1723 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1724
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1725 (defun cvs-retrieve-revision (fileinfo rev)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1726 "Retrieve the given REVision of the file in FILEINFO into a new buffer."
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1727 (let* ((file (cvs-fileinfo->full-name fileinfo))
32187
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1728 (buffile (concat file "." rev)))
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1729 (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
1730 (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
1731 (message "Retrieving revision %s..." rev)
50143
93622ce43bdd (cvs-mode!): Remove unused argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49688
diff changeset
1732 ;; Discard stderr output to work around the CVS+SSH+libc
93622ce43bdd (cvs-mode!): Remove unused argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49688
diff changeset
1733 ;; problem when stdout and stderr are the same.
71346
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1734 (let ((res
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1735 (let ((coding-system-for-read 'binary))
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1736 (apply 'call-process cvs-program nil '(t nil) nil
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1737 "-q" "update" "-p"
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1738 ;; If `rev' is HEAD, don't pass it at all:
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1739 ;; the default behavior is to get the head
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1740 ;; of the current branch whereas "-r HEAD"
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1741 ;; stupidly gives you the head of the trunk.
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1742 (append (unless (equal rev "HEAD") (list "-r" rev))
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1743 (list file))))))
32187
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1744 (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
1745 (error "Something went wrong retrieving revision %s: %s" rev res))
71346
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1746 ;; Figure out the encoding used and decode the byte-sequence
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1747 ;; into a sequence of chars.
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1748 (decode-coding-inserted-region
1405144e8610 (cvs-retrieve-revision): Use decode-coding-inserted-region.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71007
diff changeset
1749 (point-min) (point-max) file t nil nil t)
74028
82fde7e4c23b (cvs-retrieve-revision): Set buffer-file-coding-system.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 73207
diff changeset
1750 ;; Set buffer-file-coding-system.
82fde7e4c23b (cvs-retrieve-revision): Set buffer-file-coding-system.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 73207
diff changeset
1751 (after-insert-file-set-coding (buffer-size) t)
32187
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1752 (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
1753 (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
1754 (after-find-file))
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1755 (toggle-read-only 1)
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
1756 (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
1757 (current-buffer))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1758
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1759 ;; 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
1760 ;; 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
1761 ;; 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
1762 (defun-cvs-mode cvs-mode-imerge ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1763 "Merge interactively appropriate revisions of the selected file."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1764 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1765 (let ((fi (cvs-mode-marked 'merge nil :one t :file t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1766 (let ((merge (cvs-fileinfo->merge fi))
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1767 (file (cvs-fileinfo->full-name fi))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1768 (backup-file (cvs-fileinfo->backup-file fi)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1769 (if (not (and merge backup-file))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1770 (let ((buf (find-file-noselect file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1771 (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
1772 (with-current-buffer buf
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
1773 (smerge-ediff)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1774 (let* ((ancestor-buf (cvs-retrieve-revision fi (car merge)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1775 (head-buf (cvs-retrieve-revision fi (cdr merge)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1776 (backup-buf (let ((auto-mode-alist nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1777 (find-file-noselect backup-file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1778 ;; this binding is used by cvs-ediff-startup-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1779 (cvs-transient-buffers (list ancestor-buf backup-buf head-buf)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1780 (with-current-buffer backup-buf
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1781 (let ((buffer-file-name (expand-file-name file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1782 (after-find-file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1783 (funcall (cdr cvs-idiff-imerge-handlers)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1784 backup-buf head-buf ancestor-buf file))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1785
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1786 (cvs-flags-define cvs-idiff-version
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1787 (list "BASE" cvs-vendor-branch cvs-vendor-branch "BASE" "BASE")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1788 "version: " cvs-qtypedesc-tag)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1789
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1790 (defun-cvs-mode (cvs-mode-idiff . NOARGS) (&optional rev1 rev2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1791 "Diff interactively current file to revisions."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1792 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1793 (let* ((rev1 (cvs-prefix-get 'cvs-branch-prefix))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1794 (rev2 (and rev1 (cvs-prefix-get 'cvs-secondary-branch-prefix))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1795 (list (or rev1 (cvs-flags-query 'cvs-idiff-version))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1796 rev2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1797 (let ((fi (cvs-mode-marked 'diff "idiff" :one t :file t)))
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1798 (let* ((file (cvs-fileinfo->full-name fi))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1799 (rev1-buf (cvs-retrieve-revision fi (or rev1 "BASE")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1800 (rev2-buf (if rev2 (cvs-retrieve-revision fi rev2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1801 ;; this binding is used by cvs-ediff-startup-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1802 (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
1803 (funcall (car cvs-idiff-imerge-handlers)
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1804 rev1-buf (or rev2-buf (find-file-noselect file))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1805
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1806 (defun-cvs-mode (cvs-mode-idiff-other . NOARGS) ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1807 "Diff interactively current file to revisions."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1808 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1809 (let* ((rev1 (cvs-prefix-get 'cvs-branch-prefix))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1810 (rev2 (and rev1 (cvs-prefix-get 'cvs-secondary-branch-prefix)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1811 (fis (cvs-mode-marked 'diff "idiff" :file t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1812 (when (> (length fis) 2)
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37339
diff changeset
1813 (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
1814 (let* ((fi1 (car fis))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1815 (rev1-buf (if rev1 (cvs-retrieve-revision fi1 rev1)
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1816 (find-file-noselect (cvs-fileinfo->full-name fi1))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1817 rev2-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1818 (if (cdr fis)
30618
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 30612
diff changeset
1819 (let ((fi2 (nth 1 fis)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1820 (setq rev2-buf
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1821 (if rev2 (cvs-retrieve-revision fi2 rev2)
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1822 (find-file-noselect (cvs-fileinfo->full-name fi2)))))
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37339
diff changeset
1823 (error "idiff-other doesn't know what other file/buffer to use"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1824 (let* (;; this binding is used by cvs-ediff-startup-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1825 (cvs-transient-buffers (list rev1-buf rev2-buf)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1826 (funcall (car cvs-idiff-imerge-handlers)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1827 rev1-buf rev2-buf)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1828
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1829
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1830 (defun cvs-is-within-p (fis dir)
55458
f673d8bf105a (cvs-mode-run, cvs-is-within-p): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 54870
diff changeset
1831 "Non-nil if buffer is inside one of FIS (in DIR)."
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1832 (when (stringp buffer-file-name)
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1833 (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
1834 (let (ret)
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1835 (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
1836 (when (cvs-string-prefix-p
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
1837 (expand-file-name (cvs-fileinfo->full-name fi) dir)
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1838 buffer-file-name)
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1839 (setq ret t)))
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1840 ret)))
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1841
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1842 (defun* cvs-mode-run (cmd flags fis
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1843 &key (buf (cvs-temp-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1844 dont-change-disc cvsargs postproc)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1845 "Generic cvs-mode-<foo> function.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1846 Executes `cvs CVSARGS CMD FLAGS FIS'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1847 BUF is the buffer to be used for cvs' output.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1848 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
1849 contents of files. This is only used by the parser.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1850 POSTPROC is a list of expressions to be evaluated at the very end (after
55458
f673d8bf105a (cvs-mode-run, cvs-is-within-p): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 54870
diff changeset
1851 parsing if applicable). It will be prepended with `progn' if necessary."
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1852 (let ((def-dir default-directory))
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1853 ;; Save the relevant buffers
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
1854 (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
1855 (unless (listp flags) (error "flags should be a list of strings"))
48285
64107c7851aa (cvs-mode-run): Don't pass "." if not needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48003
diff changeset
1856 ;; Some w32 versions of CVS don't like an explicit . too much.
64107c7851aa (cvs-mode-run): Don't pass "." if not needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48003
diff changeset
1857 (when (and (car fis) (null (cdr fis))
64107c7851aa (cvs-mode-run): Don't pass "." if not needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48003
diff changeset
1858 (eq (cvs-fileinfo->type (car fis)) 'DIRCHANGE)
64107c7851aa (cvs-mode-run): Don't pass "." if not needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48003
diff changeset
1859 ;; (equal (cvs-fileinfo->file (car fis)) ".")
64107c7851aa (cvs-mode-run): Don't pass "." if not needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48003
diff changeset
1860 (equal (cvs-fileinfo->dir (car fis)) ""))
64107c7851aa (cvs-mode-run): Don't pass "." if not needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48003
diff changeset
1861 (setq fis nil))
50958
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
1862 (let* ((single-dir (or (not (listp cvs-execute-single-dir))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1863 (member cmd cvs-execute-single-dir)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1864 (parse (member cmd cvs-parse-known-commands))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1865 (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
1866 (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
1867 (cvs-cleanup-collection cvs-cookies ;cleanup remaining messages
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1868 (eq cvs-auto-remove-handled 'delayed) nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1869 (when (fboundp after-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1870 (setq postproc (append postproc `((,after-mode)))))
45999
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
1871 (when parse
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
1872 (let ((old-fis
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
1873 (when (member cmd '("status" "update")) ;FIXME: Yuck!!
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
1874 ;; absence of `cvs update' output has a specific meaning.
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
1875 (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))))
6efc3066895b (cvs-fileinfo-kill): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45904
diff changeset
1876 (push `(cvs-parse-process ',dont-change-disc nil ',old-fis) postproc)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1877 (setq postproc (if (cdr postproc) (cons 'progn postproc) (car postproc)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1878 (with-current-buffer buf
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1879 (let ((inhibit-read-only t)) (erase-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1880 (message "Running cvs %s ..." cmd)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1881 (cvs-run-process args fis postproc single-dir))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1882
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1883
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1884 (defun* cvs-mode-do (cmd flags filter
50958
d20464e3d617 (cvs-minor-current-files): Move before first use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50956
diff changeset
1885 &key show dont-change-disc cvsargs postproc)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1886 "Generic cvs-mode-<foo> function.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1887 Executes `cvs CVSARGS CMD FLAGS' on the selected files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1888 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
1889 files for which it makes sense.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1890 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
1891 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
1892 by `cvs-buffer-name-alist'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1893 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
1894 contents of files. This is only used by the parser."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1895 (cvs-mode-run cmd flags (cvs-mode-marked filter cmd)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1896 :buf (cvs-temp-buffer (when show cmd))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1897 :dont-change-disc dont-change-disc
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1898 :cvsargs cvsargs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1899 :postproc postproc))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1900
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1901 (defun-cvs-mode (cvs-mode-status . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1902 "Show cvs status for all marked files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1903 With prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1904 (interactive (list (cvs-flags-query 'cvs-status-flags "cvs status flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1905 (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
1906 :postproc (when (eq cvs-auto-remove-handled 'status)
78639
0c7ac1e33f19 (cvs-mode-status): Fix long-standing typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78535
diff changeset
1907 `((with-current-buffer ,(current-buffer)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1908 (cvs-mode-remove-handled))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1909
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1910 (defun-cvs-mode (cvs-mode-tree . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1911 "Call cvstree using the file under the point as a keyfile."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1912 (interactive (list (cvs-flags-query 'cvs-status-flags "cvs status flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1913 (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
1914 :buf (cvs-temp-buffer "tree")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1915 :dont-change-disc t
33234
39c359a5c419 (cvs-mode-marked): New arg `noquery'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33195
diff changeset
1916 :postproc '((cvs-status-cvstrees))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1917
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1918 ;; cvs log
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 (defun-cvs-mode (cvs-mode-log . NOARGS) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1921 "Display the cvs log of all selected files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1922 With prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1923 (interactive (list (cvs-add-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1924 (cvs-flags-query 'cvs-log-flags "cvs log flags"))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1925 (cvs-mode-do "log" flags nil :show t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1926
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1927
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1928 (defun-cvs-mode (cvs-mode-update . NOARGS) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1929 "Update all marked files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1930 With a prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1931 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1932 (list (cvs-add-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1933 (cvs-add-secondary-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1934 (cvs-flags-query 'cvs-update-flags "cvs update flags")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1935 "-j") "-j")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1936 (cvs-mode-do "update" flags 'update))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1937
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1938
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1939 (defun-cvs-mode (cvs-mode-examine . NOARGS) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1940 "Re-examine all marked files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1941 With a prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1942 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1943 (list (cvs-add-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1944 (cvs-add-secondary-branch-prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1945 (cvs-flags-query 'cvs-update-flags "cvs -n update flags")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1946 "-j") "-j")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1947 (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
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-mode cvs-mode-ignore (&optional pattern)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1951 "Arrange so that CVS ignores the selected files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1952 This command ignores files that are not flagged as `Unknown'."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1953 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1954 (dolist (fi (cvs-mode-marked 'ignore))
50991
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1955 (cvs-append-to-ignore (cvs-fileinfo->dir fi) (cvs-fileinfo->file fi)
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1956 (eq (cvs-fileinfo->subtype fi) 'NEW-DIR))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1957 (setf (cvs-fileinfo->type fi) 'DEAD))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1958 (cvs-cleanup-collection cvs-cookies nil nil nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1959
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1960
50991
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1961 (defun cvs-append-to-ignore (dir str &optional old-dir)
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1962 "Add STR to the .cvsignore file in DIR.
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1963 If OLD-DIR is non-nil, then this is a directory that we don't want
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1964 to hear about anymore."
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1965 (with-current-buffer
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1966 (find-file-noselect (expand-file-name ".cvsignore" dir))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1967 (when (ignore-errors
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1968 (and buffer-read-only
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1969 (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
1970 (not (vc-editable-p buffer-file-name))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1971 ;; CVSREAD=on special case
50991
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1972 (vc-checkout buffer-file-name t))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1973 (goto-char (point-max))
50991
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1974 (unless (bolp) (insert "\n"))
d79cc0e092b2 (cvs-append-to-ignore): New arg `old-dir'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50965
diff changeset
1975 (insert str (if old-dir "/\n" "\n"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1976 (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
1977 (save-buffer)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1978
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1979
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1980 (defun cvs-mode-find-file-other-window (e)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1981 "Select a buffer containing the file in another window."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1982 (interactive (list last-input-event))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1983 (cvs-mode-find-file e t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1984
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1985
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1986 (defun cvs-mode-display-file (e)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1987 "Show a buffer containing the file in another window."
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1988 (interactive (list last-input-event))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1989 (cvs-mode-find-file e 'dont-select))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1990
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
1991
57505
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1992 (defun cvs-mode-view-file (e)
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1993 "View the file."
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1994 (interactive (list last-input-event))
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1995 (cvs-mode-find-file e nil t))
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1996
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1997
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1998 (defun cvs-mode-view-file-other-window (e)
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
1999 "View the file."
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2000 (interactive (list last-input-event))
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2001 (cvs-mode-find-file e t t))
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2002
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2003
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2004 (defun cvs-find-modif (fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2005 (with-temp-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2006 (call-process cvs-program nil (current-buffer) nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2007 "-f" "diff" (cvs-fileinfo->file fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2008 (goto-char (point-min))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2009 (if (re-search-forward "^\\([0-9]+\\)" nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2010 (string-to-number (match-string 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2011 1)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2012
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2013
57505
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2014 (defun cvs-mode-find-file (e &optional other view)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2015 "Select a buffer containing the file.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2016 With a prefix, opens the buffer in an OTHER window."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2017 (interactive (list last-input-event current-prefix-arg))
50764
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2018 ;; If the event moves point, check that it moves it to a valid location.
54870
3b1741ff0676 (cvs-mode-toggle-mark): Rename from cvs-mouse-toggle-mark.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54619
diff changeset
2019 (when (and (/= (point) (progn (posn-set-point (event-end e)) (point)))
50925
2318a0020ca5 (cvs-mode-find-file): Fixed the last patch's logic.
Sam Steingold <sds@gnu.org>
parents: 50764
diff changeset
2020 (not (memq (get-text-property (1- (line-end-position))
2318a0020ca5 (cvs-mode-find-file): Fixed the last patch's logic.
Sam Steingold <sds@gnu.org>
parents: 50764
diff changeset
2021 'font-lock-face)
63210
2e115caaa7d2 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380
Miles Bader <miles@gnu.org>
parents: 62138
diff changeset
2022 '(cvs-header cvs-filename))))
50764
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2023 (error "Not a file name"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2024 (cvs-mode!
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2025 (lambda (&optional rev)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2026 (interactive (list (cvs-prefix-get 'cvs-branch-prefix)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2027 (let* ((cvs-buf (current-buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2028 (fi (cvs-mode-marked nil nil :one t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2029 (if (eq (cvs-fileinfo->type fi) 'DIRCHANGE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2030 (let ((odir default-directory))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2031 (setq default-directory
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2032 (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
2033 (cond ((eq other 'dont-select)
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
2034 (display-buffer (find-file-noselect default-directory)))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
2035 (other (dired-other-window default-directory))
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
2036 (t (dired default-directory)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2037 (set-buffer cvs-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2038 (setq default-directory odir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2039 (let ((buf (if rev (cvs-retrieve-revision fi rev)
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
2040 (find-file-noselect (cvs-fileinfo->full-name fi)))))
37339
31271d7f21c9 (cvs-addto-collection): Don't merge MESSAGE fileinfos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36615
diff changeset
2041 (funcall (cond ((eq other 'dont-select) 'display-buffer)
57505
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2042 (other
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2043 (if view 'view-buffer-other-window
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2044 'switch-to-buffer-other-window))
78b87f4d875f (cvs-mode-view-file, cvs-mode-view-file-other-window): Add.
Kim F. Storm <storm@cua.dk>
parents: 56314
diff changeset
2045 (t (if view 'view-buffer 'switch-to-buffer)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2046 buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2047 (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
2048 (goto-line (cvs-find-modif fi)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2049 buf))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2050
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2051
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2052 (defun-cvs-mode (cvs-mode-undo . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2053 "Undo local changes to all marked files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2054 The file is removed and `cvs update FILE' is run."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2055 ;;"With prefix argument, prompt for cvs FLAGS."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2056 (interactive (list nil));; (cvs-flags-query 'cvs-undo-flags "undo flags")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2057 (if current-prefix-arg (call-interactively 'cvs-mode-revert-to-rev)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2058 (let* ((fis (cvs-do-removal 'undo "update" 'all))
47211
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
2059 (removedp (lambda (fi)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
2060 (or (eq (cvs-fileinfo->type fi) 'REMOVED)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
2061 (and (eq (cvs-fileinfo->type fi) 'CONFLICT)
3a7c7e0c12f7 (cvs-run-process): Use a pty rather than a pipe to work
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46002
diff changeset
2062 (eq (cvs-fileinfo->subtype fi) 'REMOVED)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2063 (fis-split (cvs-partition removedp fis))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2064 (fis-removed (car fis-split))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2065 (fis-other (cdr fis-split)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2066 (if (null fis-other)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2067 (when fis-removed (cvs-mode-run "add" nil fis-removed))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2068 (cvs-mode-run "update" flags fis-other
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2069 :postproc
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2070 (when fis-removed
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2071 `((with-current-buffer ,(current-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2072 (cvs-mode-run "add" nil ',fis-removed)))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2073
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2074
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2075 (defun-cvs-mode (cvs-mode-revert-to-rev . NOARGS) (rev)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2076 "Revert the selected files to an old revision."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2077 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2078 (list (or (cvs-prefix-get 'cvs-branch-prefix)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2079 (let ((current-prefix-arg '(4)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2080 (cvs-flags-query 'cvs-idiff-version)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2081 (let* ((fis (cvs-mode-marked 'revert "revert" :file t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2082 (tag (concat "tmp_pcl_tag_" (make-temp-name "")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2083 (untag `((with-current-buffer ,(current-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2084 (cvs-mode-run "tag" (list "-d" ',tag) ',fis))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2085 (update `((with-current-buffer ,(current-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2086 (cvs-mode-run "update" (list "-j" ',tag "-j" ',rev) ',fis
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2087 :postproc ',untag)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2088 (cvs-mode-run "tag" (list tag) fis :postproc update)))
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
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2091 (defun-cvs-mode cvs-mode-delete-lock ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2092 "Delete the lock file that CVS is waiting for.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2093 Note that this can be dangerous. You should only do this
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2094 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
2095 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2096 (let* ((default-directory (cvs-expand-dir-name cvs-lock-file))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2097 (locks (directory-files default-directory nil cvs-lock-file-regexp)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2098 (cond
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37339
diff changeset
2099 ((not locks) (error "No lock files found"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2100 ((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
2101 (dolist (lock locks)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2102 (cond ((file-directory-p lock) (delete-directory lock))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2103 ((file-exists-p lock) (delete-file lock))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2104
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2105
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2106 (defun-cvs-mode cvs-mode-remove-handled ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2107 "Remove all lines that are handled.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2108 Empty directories are removed."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2109 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2110 (cvs-cleanup-collection cvs-cookies
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2111 t (or cvs-auto-remove-directories 'handled) t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2112
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 (defun-cvs-mode cvs-mode-acknowledge ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2115 "Remove all marked files from the buffer."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2116 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2117 (dolist (fi (cvs-get-marked (cvs-ignore-marks-p "acknowledge") t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2118 (setf (cvs-fileinfo->type fi) 'DEAD))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2119 (cvs-cleanup-collection cvs-cookies nil nil nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2120
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2121 (defun cvs-do-removal (filter &optional cmd all)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2122 "Remove files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2123 Returns a list of FIS that should be `cvs remove'd."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2124 (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
2125 (fis (cdr (cvs-partition (lambda (fi)
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
2126 (eq (cvs-fileinfo->type fi) 'UNKNOWN))
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
2127 (cvs-mode-marked filter cmd))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2128 (silent (or (not cvs-confirm-removals)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2129 (cvs-every (lambda (fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2130 (or (not (file-exists-p
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
2131 (cvs-fileinfo->full-name fi)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2132 (cvs-applicable-p fi 'safe-rm)))
33359
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
2133 files)))
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
2134 (tmpbuf (cvs-temp-buffer)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2135 (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
2136 (with-current-buffer tmpbuf
47470
344fed0ec431 (cvs-do-removal): Bind inhibit-read-only while modifying the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47468
diff changeset
2137 (let ((inhibit-read-only t))
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
2138 (cvs-insert-strings (mapcar 'cvs-fileinfo->full-name fis))
47470
344fed0ec431 (cvs-do-removal): Bind inhibit-read-only while modifying the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47468
diff changeset
2139 (cvs-pop-to-buffer-same-frame (current-buffer))
344fed0ec431 (cvs-do-removal): Bind inhibit-read-only while modifying the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47468
diff changeset
2140 (shrink-window-if-larger-than-buffer))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2141 (if (not (or silent
33359
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
2142 (unwind-protect
52669
2db8fbd2339c (cvs-mode-unmark-up): Move to goal column when done.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52552
diff changeset
2143 (yes-or-no-p
52552
dab2424315f1 Change the prompt depending on `filter' value.
Masatake YAMATO <jet@gyve.org>
parents: 52401
diff changeset
2144 (let ((nfiles (length files))
dab2424315f1 Change the prompt depending on `filter' value.
Masatake YAMATO <jet@gyve.org>
parents: 52401
diff changeset
2145 (verb (if (eq filter 'undo) "Undo" "Delete")))
52388
b851ebbed6d8 * pcvs.el (cvs-do-removal): Use = instead of eq to check
Masatake YAMATO <jet@gyve.org>
parents: 52299
diff changeset
2146 (if (= 1 nfiles)
52669
2db8fbd2339c (cvs-mode-unmark-up): Move to goal column when done.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52552
diff changeset
2147 (format "%s file: \"%s\" ? "
52552
dab2424315f1 Change the prompt depending on `filter' value.
Masatake YAMATO <jet@gyve.org>
parents: 52401
diff changeset
2148 verb
52388
b851ebbed6d8 * pcvs.el (cvs-do-removal): Use = instead of eq to check
Masatake YAMATO <jet@gyve.org>
parents: 52299
diff changeset
2149 (cvs-fileinfo->file (car files)))
52669
2db8fbd2339c (cvs-mode-unmark-up): Move to goal column when done.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52552
diff changeset
2150 (format "%s %d files? "
52552
dab2424315f1 Change the prompt depending on `filter' value.
Masatake YAMATO <jet@gyve.org>
parents: 52401
diff changeset
2151 verb
dab2424315f1 Change the prompt depending on `filter' value.
Masatake YAMATO <jet@gyve.org>
parents: 52401
diff changeset
2152 nfiles))))
33359
5ef2137ce754 (cvs-enabledp): Ignore errors.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33339
diff changeset
2153 (cvs-bury-buffer tmpbuf cvs-buffer))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2154 (progn (message "Aborting") nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2155 (dolist (fi files)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2156 (let* ((type (cvs-fileinfo->type fi))
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
2157 (file (cvs-fileinfo->full-name fi)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2158 (when (or all (eq type 'UNKNOWN))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2159 (when (file-exists-p file) (delete-file file))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2160 (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2161 fis)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2162
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2163 (defun-cvs-mode (cvs-mode-remove . SIMPLE) (flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2164 "Remove all marked files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2165 With prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2166 (interactive (list (cvs-flags-query 'cvs-remove-flags "cvs remove flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2167 (let ((fis (cvs-do-removal 'remove)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2168 (if fis (cvs-mode-run "remove" (cons "-f" flags) fis)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2169 (cvs-cleanup-collection cvs-cookies nil nil nil))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2170
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2171
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2172 (defvar cvs-tag-name "")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2173 (defun-cvs-mode (cvs-mode-tag . SIMPLE) (tag &optional flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2174 "Run `cvs tag TAG' on all selected files.
50202
dac1de705d35 (cvs-mode-tag): Docstring improvement.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50143
diff changeset
2175 With prefix argument, prompt for cvs flags.
dac1de705d35 (cvs-mode-tag): Docstring improvement.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50143
diff changeset
2176 By default this can only be used on directories.
dac1de705d35 (cvs-mode-tag): Docstring improvement.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50143
diff changeset
2177 Use \\[cvs-mode-force-command] or change `cvs-force-dir-tag' if you need
dac1de705d35 (cvs-mode-tag): Docstring improvement.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50143
diff changeset
2178 to use it on individual files."
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2179 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2180 (list (setq cvs-tag-name
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2181 (cvs-query-read cvs-tag-name "Tag name: " cvs-qtypedesc-tag))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2182 (cvs-flags-query 'cvs-tag-flags "tag flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2183 (cvs-mode-do "tag" (append flags (list tag))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2184 (when cvs-force-dir-tag 'tag)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2185
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2186 (defun-cvs-mode (cvs-mode-untag . SIMPLE) (tag &optional flags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2187 "Run `cvs tag -d TAG' on all selected files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2188 With prefix argument, prompt for cvs flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2189 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2190 (list (setq cvs-tag-name
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2191 (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
2192 (cvs-flags-query 'cvs-tag-flags "tag flags")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2193 (cvs-mode-do "tag" (append '("-d") flags (list tag))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2194 (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
2195
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2196
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2197 ;; Byte compile files.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2198
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2199 (defun-cvs-mode cvs-mode-byte-compile-files ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2200 "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
2201 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2202 (let ((marked (cvs-get-marked (cvs-ignore-marks-p "byte-compile"))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2203 (dolist (fi marked)
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
2204 (let ((filename (cvs-fileinfo->full-name fi)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2205 (when (string-match "\\.el\\'" filename)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2206 (byte-compile-file filename))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2207
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2208 ;; ChangeLog support.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2209
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2210 (defun-cvs-mode cvs-mode-add-change-log-entry-other-window ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2211 "Add a ChangeLog entry in the ChangeLog of the current directory."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2212 (interactive)
78753
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2213 ;; Require `add-log' explicitly, because if it gets autoloaded when we call
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2214 ;; add-change-log-entry-other-window below, the
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2215 ;; add-log-buffer-file-name-function ends up unbound when we leave the `let'.
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2216 (require 'add-log)
45325
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
2217 (dolist (fi (cvs-mode-marked nil nil))
54376
43c8c6b5656b (cvs-mode-add-change-log-entry-other-window): Fix minor bug.
Richard M. Stallman <rms@gnu.org>
parents: 52669
diff changeset
2218 (let* ((default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
78753
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2219 (add-log-buffer-file-name-function
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2220 (lambda ()
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2221 (let ((file (expand-file-name (cvs-fileinfo->file fi))))
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2222 (if (file-directory-p file)
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2223 ;; Be careful to use a directory name, otherwise add-log
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2224 ;; starts looking for a ChangeLog file in the
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2225 ;; parent dir.
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2226 (file-name-as-directory file)
cd3530596f8e (cvs-mode-add-change-log-entry-other-window): Use
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78654
diff changeset
2227 file)))))
45325
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
2228 (kill-local-variable 'change-log-default-name)
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
2229 (save-excursion (add-change-log-entry-other-window)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2230
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2231 ;; interactive commands to set optional flags
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2232
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2233 (defun cvs-mode-set-flags (flag)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2234 "Ask for new setting of cvs-FLAG-flags."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2235 (interactive
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2236 (list (completing-read
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2237 "Which flag: "
45325
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
2238 '("cvs" "diff" "update" "status" "log" "tag" ;"rtag"
8b7e7b9551fe (cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44384
diff changeset
2239 "commit" "remove" "undo" "checkout")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2240 nil t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2241 (let* ((sym (intern (concat "cvs-" flag "-flags"))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2242 (let ((current-prefix-arg '(16)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2243 (cvs-flags-query sym (concat flag " flags")))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2244
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2245
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2246 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2247 ;;;; Utilities for the *cvs* buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2248 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2249
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2250 (defun cvs-dir-member-p (fileinfo dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2251 "Return true if FILEINFO represents a file in directory DIR."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2252 (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
2253 (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2254
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2255 (defun cvs-execute-single-file (fi extractor program constant-args)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2256 "Internal function for `cvs-execute-single-file-list'."
34653
433f1bff06f5 (cvs-diff-backup-extractor): Return full-path for file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34412
diff changeset
2257 (let* ((arg-list (funcall extractor fi))
433f1bff06f5 (cvs-diff-backup-extractor): Return full-path for file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34412
diff changeset
2258 (inhibit-read-only t))
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
2259
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2260 ;; Execute the command unless extractor returned t.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2261 (when (listp arg-list)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2262 (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
2263
34653
433f1bff06f5 (cvs-diff-backup-extractor): Return full-path for file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34412
diff changeset
2264 (insert (format "=== %s %s\n\n"
78535
651c50f01f5f (cvs-reread-cvsrc, cvs-checkout, cvs-mode-checkout)
Richard M. Stallman <rms@gnu.org>
parents: 78239
diff changeset
2265 program (split-string-and-unquote args)))
30569
f7a0912532da * pcvs.el (cvs-do-commit): Use `buffer-substring-no-properties'
Sam Steingold <sds@gnu.org>
parents: 29577
diff changeset
2266
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2267 ;; FIXME: return the exit status?
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2268 (apply 'call-process program nil t t args)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2269 (goto-char (point-max))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2270
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2271 ;; FIXME: make this run in the background ala cvs-run-process...
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2272 (defun cvs-execute-single-file-list (fis extractor program constant-args)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2273 "Run PROGRAM on all elements on FIS.
34653
433f1bff06f5 (cvs-diff-backup-extractor): Return full-path for file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34412
diff changeset
2274 CONSTANT-ARGS is a list of strings to pass as arguments to PROGRAM.
433f1bff06f5 (cvs-diff-backup-extractor): Return full-path for file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34412
diff changeset
2275 The arguments given to the program will be CONSTANT-ARGS followed by
433f1bff06f5 (cvs-diff-backup-extractor): Return full-path for file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 34412
diff changeset
2276 the list that EXTRACTOR returns.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2277
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2278 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
2279 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
2280 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
2281 (dolist (fi fis)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2282 (cvs-execute-single-file fi extractor program constant-args)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2283
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2284
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2285 (defun cvs-revert-if-needed (fis)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2286 (dolist (fileinfo fis)
61867
59330b4d0e5b Rename "full-path" -> "full-name".
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61245
diff changeset
2287 (let* ((file (cvs-fileinfo->full-name fileinfo))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2288 (buffer (find-buffer-visiting file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2289 ;; 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
2290 (unless (or (null buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2291 (eq (cvs-fileinfo->type fileinfo) 'MESSAGE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2292 ;; FIXME: check whether revert is really needed.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2293 ;; `(verify-visited-file-modtime buffer)' doesn't cut it
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2294 ;; because it only looks at the time stamp (it ignores
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2295 ;; read-write changes) which is not changed by `commit'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2296 (buffer-modified-p buffer))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2297 (with-current-buffer buffer
31977
2f79c1ebd1fe (cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30879
diff changeset
2298 (ignore-errors
2f79c1ebd1fe (cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30879
diff changeset
2299 (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
2300 ;; `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
2301 ;; 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
2302 (vc-find-file-hook)
2f79c1ebd1fe (cvs-ediff-exit-hook): Kill buffer before window.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30879
diff changeset
2303 (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
2304 (smerge-mode 1))))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2305
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2306
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2307 (defun cvs-change-cvsroot (newroot)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2308 "Change the cvsroot."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2309 (interactive "DNew repository: ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2310 (if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2311 (y-or-n-p (concat "Warning: no CVSROOT found inside repository."
72386
2ce9bf47e864 * cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents: 71346
diff changeset
2312 " Change cvs-cvsroot anyhow? ")))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2313 (setq cvs-cvsroot newroot)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2314
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2315 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2316 ;;;; useful global settings
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2317 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2318
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2319 ;;;###autoload
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2320 (add-to-list 'completion-ignored-extensions "CVS/")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2321
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2322 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2323 ;; Hook to allow calling PCL-CVS by visiting the /CVS subdirectory
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2324 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2325
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2326 ;;;###autoload
32187
418444640a1e (cvs-ediff-exit-hook): Expect delete-window to fail.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31977
diff changeset
2327 (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
2328 "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
2329 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
2330 :group 'pcl-cvs
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
2331 :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
2332
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
2333 ;;;###autoload
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2334 (defcustom cvs-dired-use-hook '(4)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2335 "Whether or not opening a CVS directory should run PCL-CVS.
77713
e16960b7b99b (cvs-dired-use-hook): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 75347
diff changeset
2336 A value of nil means never do it.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2337 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
2338 command that prompted the opening of the directory.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2339 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
2340 :group 'pcl-cvs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2341 :type '(choice (const :tag "Never" nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2342 (const :tag "Always" always)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2343 (const :tag "Prefix" (4))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2344
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2345 ;;;###autoload
28862
d089f0a330a0 (cvs-cleanup-collection): Remove obsolete code for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
2346 (progn (defun cvs-dired-noselect (dir)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2347 "Run `cvs-examine' if DIR is a CVS administrative directory.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2348 The exact behavior is determined also by `cvs-dired-use-hook'."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2349 (when (stringp dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2350 (setq dir (directory-file-name dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2351 (when (and (string= "CVS" (file-name-nondirectory dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2352 (file-readable-p (expand-file-name "Entries" dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2353 cvs-dired-use-hook
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2354 (if (eq cvs-dired-use-hook 'always)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2355 (not current-prefix-arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2356 (equal current-prefix-arg cvs-dired-use-hook)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2357 (save-excursion
29577
ce3a0229bee7 (cvs-parse-process): Don't blindly refresh all cookies.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28862
diff changeset
2358 (funcall cvs-dired-action (file-name-directory dir) t t))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2359
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2360 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2361 ;; hook into VC
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2362 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2363
32309
bb96b2ece52b (cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32187
diff changeset
2364 (add-hook 'vc-post-command-functions 'cvs-vc-command-advice)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2365
32309
bb96b2ece52b (cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32187
diff changeset
2366 (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
2367 (when (and (equal command "cvs")
45904
4c3a4e9f96e7 (cvs-vc-command-advice): Handle the case where args
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45325
diff changeset
2368 (progn
4c3a4e9f96e7 (cvs-vc-command-advice): Handle the case where args
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45325
diff changeset
2369 (while (and (stringp (car flags))
4c3a4e9f96e7 (cvs-vc-command-advice): Handle the case where args
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45325
diff changeset
2370 (string-match "\\`-" (car flags)))
4c3a4e9f96e7 (cvs-vc-command-advice): Handle the case where args
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45325
diff changeset
2371 (pop flags))
4c3a4e9f96e7 (cvs-vc-command-advice): Handle the case where args
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45325
diff changeset
2372 ;; don't parse output we don't understand.
50764
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2373 (member (car flags) cvs-parse-known-commands))
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2374 ;; Don't parse "update -p" output.
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2375 (not (and (member (car flags) '("update" "checkout"))
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2376 (let ((found-p nil))
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2377 (dolist (flag flags found-p)
394622821e83 (cvs-mode-find-file): Don't complain if bound to a non-mouse event.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50651
diff changeset
2378 (if (equal flag "-p") (setq found-p t)))))))
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2379 (save-current-buffer
32309
bb96b2ece52b (cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32187
diff changeset
2380 (let ((buffer (current-buffer))
bb96b2ece52b (cvs-append-to-ignore, cvs-vc-command-advice)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32187
diff changeset
2381 (dir default-directory)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2382 (cvs-from-vc t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2383 (dolist (cvs-buf (buffer-list))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2384 (set-buffer cvs-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2385 ;; look for a corresponding pcl-cvs buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2386 (when (and (eq major-mode 'cvs-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2387 (cvs-string-prefix-p default-directory dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2388 (let ((subdir (substring dir (length default-directory))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2389 (set-buffer buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2390 (set (make-local-variable 'cvs-buffer) cvs-buf)
46002
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2391 ;; `cvs -q add file' produces no useful output :-(
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2392 (when (and (equal (car flags) "add")
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2393 (goto-char (point-min))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2394 (looking-at ".*to add this file permanently\n\\'"))
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2395 (insert "cvs add: scheduling file `"
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2396 (file-name-nondirectory file)
6f298513c731 (cvs-parse-process): Don't save/restore point.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45999
diff changeset
2397 "' for addition\n"))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2398 ;; VC never (?) does `cvs -n update' so dcd=nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2399 ;; should probably always be the right choice.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2400 (cvs-parse-process nil subdir))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2401
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2402 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2403 ;; Hook into write-buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2404 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2405
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2406 (defun cvs-mark-buffer-changed ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2407 (let* ((file (expand-file-name buffer-file-name))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2408 (version (and (fboundp 'vc-backend)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2409 (eq (vc-backend file) 'CVS)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2410 (vc-workfile-version file))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2411 (when version
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2412 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2413 (dolist (cvs-buf (buffer-list))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2414 (set-buffer cvs-buf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2415 ;; look for a corresponding pcl-cvs buffer
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2416 (when (and (eq major-mode 'cvs-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2417 (cvs-string-prefix-p default-directory file))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2418 (let* ((file (substring file (length default-directory)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2419 (fi (cvs-create-fileinfo
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2420 (if (string= "0" version)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2421 'ADDED 'MODIFIED)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2422 (or (file-name-directory file) "")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2423 (file-name-nondirectory file)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2424 "cvs-mark-buffer-changed")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2425 (cvs-addto-collection cvs-cookies fi))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2426
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2427 (add-hook 'after-save-hook 'cvs-mark-buffer-changed)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2428
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2429
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2430 (provide 'pcvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2431
58158
0d53729c8f7a (cvs-mode-checkout): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 57505
diff changeset
2432 ;; arch-tag: 8e3a7494-0453-4389-9ab3-a557ce9fab61
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2433 ;;; pcvs.el ends here