annotate lisp/vc-dir.el @ 111890:ba688f8ab22c

Small ps-print fixes. * lisp/ps-print.el (ps-line-lengths-internal, ps-nb-pages): Ensure ps-footer-font-size-internal is initialized. Call ps-get-page-dimensions before trying to use ps-font-for-text.
author Glenn Morris <rgm@gnu.org>
date Wed, 01 Dec 2010 20:06:52 -0800
parents 8027e412df98
children 163a7066458a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1 ;;; vc-dir.el --- Directory status display under VC
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106759
diff changeset
3 ;; Copyright (C) 2007, 2008, 2009, 2010
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
4 ;; Free Software Foundation, Inc.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
5
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
6 ;; Author: Dan Nicolaescu <dann@ics.uci.edu>
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
7 ;; Keywords: tools
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
8
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
10
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
14 ;; (at your option) any later version.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
15
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
19 ;; GNU General Public License for more details.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
20
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
23
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
24 ;;; Credits:
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
25
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
26 ;; The original VC directory status implementation was based on dired.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
27 ;; This implementation was inspired by PCL-CVS.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
28 ;; Many people contributed comments, ideas and code to this
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
29 ;; implementation. These include:
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
30 ;;
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
31 ;; Alexandre Julliard <julliard@winehq.org>
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
32 ;; Stefan Monnier <monnier@iro.umontreal.ca>
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
33 ;; Tom Tromey <tromey@redhat.com>
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
34
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
35 ;;; Commentary:
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
36 ;;
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
37
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
38 ;;; Todo: see vc.el.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
39
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
40 (require 'vc-hooks)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
41 (require 'vc)
96310
ba295cada06b * vc-dir.el (tool-bar): Require.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96256
diff changeset
42 (require 'tool-bar)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
43 (require 'ewoc)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
44
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
45 ;;; Code:
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
46 (eval-when-compile
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
47 (require 'cl))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
48
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
49 (defcustom vc-dir-mode-hook nil
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
50 "Normal hook run by `vc-dir-mode'.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
51 See `run-hooks'."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
52 :type 'hook
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
53 :group 'vc)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
54
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
55 ;; Used to store information for the files displayed in the directory buffer.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
56 ;; Each item displayed corresponds to one of these defstructs.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
57 (defstruct (vc-dir-fileinfo
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
58 (:copier nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
59 (:type list) ;So we can use `member' on lists of FIs.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
60 (:constructor
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
61 ;; We could define it as an alias for `list'.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
62 vc-dir-create-fileinfo (name state &optional extra marked directory))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
63 (:conc-name vc-dir-fileinfo->))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
64 name ;Keep it as first, for `member'.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
65 state
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
66 ;; For storing backend specific information.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
67 extra
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
68 marked
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
69 ;; To keep track of not updated files during a global refresh
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
70 needs-update
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
71 ;; To distinguish files and directories.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
72 directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
73
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
74 (defvar vc-ewoc nil)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
75
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
76 (defvar vc-dir-process-buffer nil
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
77 "The buffer used for the asynchronous call that computes status.")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
78
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
79 (defvar vc-dir-backend nil
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
80 "The backend used by the current *vc-dir* buffer.")
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
81
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
82 (defun vc-dir-move-to-goal-column ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
83 ;; Used to keep the cursor on the file name column.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
84 (beginning-of-line)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
85 (unless (eolp)
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
86 ;; Must be in sync with vc-default-dir-printer.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
87 (forward-char 25)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
88
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
89 (defun vc-dir-prepare-status-buffer (bname dir backend &optional create-new)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
90 "Find a buffer named BNAME showing DIR, or create a new one."
97660
cf2cf606d5d7 (vc-dir-prepare-status-buffer): Make sure we use a
Dan Nicolaescu <dann@ics.uci.edu>
parents: 97315
diff changeset
91 (setq dir (file-name-as-directory (expand-file-name dir)))
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
92 (let* ;; Look for another buffer name BNAME visiting the same directory.
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
93 ((buf (save-excursion
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
94 (unless create-new
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
95 (dolist (buffer vc-dir-buffers)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
96 (when (buffer-live-p buffer)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
97 (set-buffer buffer)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
98 (when (and (derived-mode-p 'vc-dir-mode)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
99 (eq vc-dir-backend backend)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
100 (string= default-directory dir))
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
101 (return buffer))))))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
102 (or buf
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
103 ;; Create a new buffer named BNAME.
106759
e778a4a0f821 Fix bug#3224.
Juanma Barranquero <lekktu@gmail.com>
parents: 106412
diff changeset
104 ;; We pass a filename to create-file-buffer because it is what
e778a4a0f821 Fix bug#3224.
Juanma Barranquero <lekktu@gmail.com>
parents: 106412
diff changeset
105 ;; the function expects, and also what uniquify needs (if active)
e778a4a0f821 Fix bug#3224.
Juanma Barranquero <lekktu@gmail.com>
parents: 106412
diff changeset
106 (with-current-buffer (create-file-buffer (expand-file-name bname dir))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
107 (cd dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
108 (vc-setup-buffer (current-buffer))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
109 ;; Reset the vc-parent-buffer-name so that it does not appear
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
110 ;; in the mode-line.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
111 (setq vc-parent-buffer-name nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
112 (current-buffer)))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
113
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
114 (defvar vc-dir-menu-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
115 (let ((map (make-sparse-keymap "VC-dir")))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
116 (define-key map [quit]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
117 '(menu-item "Quit" quit-window
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
118 :help "Quit"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
119 (define-key map [kill]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
120 '(menu-item "Kill Update Command" vc-dir-kill-dir-status-process
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
121 :enable (vc-dir-busy)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
122 :help "Kill the command that updates the directory buffer"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
123 (define-key map [refresh]
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
124 '(menu-item "Refresh" revert-buffer
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
125 :enable (not (vc-dir-busy))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
126 :help "Refresh the contents of the directory buffer"))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
127 (define-key map [remup]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
128 '(menu-item "Hide up-to-date" vc-dir-hide-up-to-date
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
129 :help "Hide up-to-date items from display"))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
130 ;; Movement.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
131 (define-key map [sepmv] '("--"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
132 (define-key map [next-line]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
133 '(menu-item "Next line" vc-dir-next-line
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
134 :help "Go to the next line" :keys "n"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
135 (define-key map [previous-line]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
136 '(menu-item "Previous line" vc-dir-previous-line
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
137 :help "Go to the previous line"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
138 ;; Marking.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
139 (define-key map [sepmrk] '("--"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
140 (define-key map [unmark-all]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
141 '(menu-item "Unmark All" vc-dir-unmark-all-files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
142 :help "Unmark all files that are in the same state as the current file\
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
143 \nWith prefix argument unmark all files"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
144 (define-key map [unmark-previous]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
145 '(menu-item "Unmark previous " vc-dir-unmark-file-up
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
146 :help "Move to the previous line and unmark the file"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
147
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
148 (define-key map [mark-all]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
149 '(menu-item "Mark All" vc-dir-mark-all-files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
150 :help "Mark all files that are in the same state as the current file\
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
151 \nWith prefix argument mark all files"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
152 (define-key map [unmark]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
153 '(menu-item "Unmark" vc-dir-unmark
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
154 :help "Unmark the current file or all files in the region"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
155
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
156 (define-key map [mark]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
157 '(menu-item "Mark" vc-dir-mark
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
158 :help "Mark the current file or all files in the region"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
159
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
160 (define-key map [sepopn] '("--"))
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
161 (define-key map [qr]
96964
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
162 '(menu-item "Query Replace in Files..." vc-dir-query-replace-regexp
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
163 :help "Replace a string in the marked files"))
96963
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
164 (define-key map [se]
96964
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
165 '(menu-item "Search Files..." vc-dir-search
96963
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
166 :help "Search a regexp in the marked files"))
96964
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
167 (define-key map [ires]
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
168 '(menu-item "Isearch Regexp Files..." vc-dir-isearch-regexp
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
169 :help "Incremental search a regexp in the marked files"))
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
170 (define-key map [ise]
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
171 '(menu-item "Isearch Files..." vc-dir-isearch
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
172 :help "Incremental search a string in the marked files"))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
173 (define-key map [open-other]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
174 '(menu-item "Open in other window" vc-dir-find-file-other-window
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
175 :help "Find the file on the current line, in another window"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
176 (define-key map [open]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
177 '(menu-item "Open file" vc-dir-find-file
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
178 :help "Find the file on the current line"))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
179 (define-key map [sepvcdet] '("--"))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
180 ;; FIXME: This needs a key binding. And maybe a better name
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
181 ;; ("Insert" like PCL-CVS uses does not sound that great either)...
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
182 (define-key map [ins]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
183 '(menu-item "Show File" vc-dir-show-fileentry
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
184 :help "Show a file in the VC status listing even though it might be up to date"))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
185 (define-key map [annotate]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
186 '(menu-item "Annotate" vc-annotate
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
187 :help "Display the edit history of the current file using colors"))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
188 (define-key map [diff]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
189 '(menu-item "Compare with Base Version" vc-diff
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
190 :help "Compare file set with the base version"))
111350
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
191 (define-key map [logo]
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
192 '(menu-item "Show Outgoing Log" vc-log-outgoing
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
193 :help "Show a log of changes that will be sent with a push operation"))
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
194 (define-key map [logi]
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
195 '(menu-item "Show Incoming Log" vc-log-incoming
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
196 :help "Show a log of changes that will be received with a pull operation"))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
197 (define-key map [log]
111350
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
198 '(menu-item "Show history" vc-print-log
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
199 :help "List the change log of the current file set in a window"))
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
200 (define-key map [rlog]
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
201 '(menu-item "Show Top of the Tree History " vc-print-root-log
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
202 :help "List the change log for the current tree in a window"))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
203 ;; VC commands.
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
204 (define-key map [sepvccmd] '("--"))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
205 (define-key map [update]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
206 '(menu-item "Update to latest version" vc-update
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
207 :help "Update the current fileset's files to their tip revisions"))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
208 (define-key map [revert]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
209 '(menu-item "Revert to base version" vc-revert
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
210 :help "Revert working copies of the selected fileset to their repository contents."))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
211 (define-key map [next-action]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
212 ;; FIXME: This really really really needs a better name!
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
213 ;; And a key binding too.
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
214 '(menu-item "Check In/Out" vc-next-action
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
215 :help "Do the next logical version control operation on the current fileset"))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
216 (define-key map [register]
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
217 '(menu-item "Register" vc-register
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
218 :help "Register file set into the version control system"))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
219 map)
101642
a2281d8c22e0 * vc-dir.el (vc-dir-menu-map, vc-dir-at-event, vc-dir-resynch-file):
Juanma Barranquero <lekktu@gmail.com>
parents: 100908
diff changeset
220 "Menu for VC dir.")
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
221
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
222 ;; VC backends can use this to add mode-specific menu items to
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
223 ;; vc-dir-menu-map.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
224 (defun vc-dir-menu-map-filter (orig-binding)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
225 (when (and (symbolp orig-binding) (fboundp orig-binding))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
226 (setq orig-binding (indirect-function orig-binding)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
227 (let ((ext-binding
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
228 (when (derived-mode-p 'vc-dir-mode)
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
229 (vc-call-backend vc-dir-backend 'extra-status-menu))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
230 (if (null ext-binding)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
231 orig-binding
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
232 (append orig-binding
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
233 '("----")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
234 ext-binding))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
235
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
236 (defvar vc-dir-mode-map
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
237 (let ((map (make-sparse-keymap)))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
238 ;; VC commands
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
239 (define-key map "v" 'vc-next-action) ;; C-x v v
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
240 (define-key map "=" 'vc-diff) ;; C-x v =
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
241 (define-key map "i" 'vc-register) ;; C-x v i
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
242 (define-key map "+" 'vc-update) ;; C-x v +
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
243 (define-key map "l" 'vc-print-log) ;; C-x v l
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
244 ;; More confusing than helpful, probably
97210
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
245 ;;(define-key map "R" 'vc-revert) ;; u is taken by vc-dir-unmark.
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
246 ;;(define-key map "A" 'vc-annotate) ;; g is taken by revert-buffer
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
247 ;; bound by `special-mode'.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
248 ;; Marking.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
249 (define-key map "m" 'vc-dir-mark)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
250 (define-key map "M" 'vc-dir-mark-all-files)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
251 (define-key map "u" 'vc-dir-unmark)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
252 (define-key map "U" 'vc-dir-unmark-all-files)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
253 (define-key map "\C-?" 'vc-dir-unmark-file-up)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
254 (define-key map "\M-\C-?" 'vc-dir-unmark-all-files)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
255 ;; Movement.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
256 (define-key map "n" 'vc-dir-next-line)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
257 (define-key map " " 'vc-dir-next-line)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
258 (define-key map "\t" 'vc-dir-next-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
259 (define-key map "p" 'vc-dir-previous-line)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
260 (define-key map [backtab] 'vc-dir-previous-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
261 ;;; Rebind paragraph-movement commands.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
262 (define-key map "\M-}" 'vc-dir-next-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
263 (define-key map "\M-{" 'vc-dir-previous-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
264 (define-key map [C-down] 'vc-dir-next-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
265 (define-key map [C-up] 'vc-dir-previous-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
266 ;; The remainder.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
267 (define-key map "f" 'vc-dir-find-file)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
268 (define-key map "\C-m" 'vc-dir-find-file)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
269 (define-key map "o" 'vc-dir-find-file-other-window)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
270 (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
271 (define-key map [down-mouse-3] 'vc-dir-menu)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
272 (define-key map [mouse-2] 'vc-dir-toggle-mark)
99133
be46fd14df8a (vc-dir-mode-map): Add follow-link behavior.
Chong Yidong <cyd@stupidchicken.com>
parents: 98471
diff changeset
273 (define-key map [follow-link] 'mouse-face)
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
274 (define-key map "x" 'vc-dir-hide-up-to-date)
111350
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
275 (define-key map [?\C-k] 'vc-dir-kill-line)
96963
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
276 (define-key map "S" 'vc-dir-search) ;; FIXME: Maybe use A like dired?
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
277 (define-key map "Q" 'vc-dir-query-replace-regexp)
96964
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
278 (define-key map (kbd "M-s a C-s") 'vc-dir-isearch)
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
279 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
280
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
281 ;; Hook up the menu.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
282 (define-key map [menu-bar vc-dir-mode]
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
283 `(menu-item
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
284 ;; VC backends can use this to add mode-specific menu items to
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
285 ;; vc-dir-menu-map.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
286 "VC-dir" ,vc-dir-menu-map :filter vc-dir-menu-map-filter))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
287 map)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
288 "Keymap for directory buffer.")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
289
100483
15455ea10b4a (vc-dir-at-event): Rename from vc-at-event. Change
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100475
diff changeset
290 (defmacro vc-dir-at-event (event &rest body)
101642
a2281d8c22e0 * vc-dir.el (vc-dir-menu-map, vc-dir-at-event, vc-dir-resynch-file):
Juanma Barranquero <lekktu@gmail.com>
parents: 100908
diff changeset
291 "Evaluate BODY with point located at event-start of EVENT.
a2281d8c22e0 * vc-dir.el (vc-dir-menu-map, vc-dir-at-event, vc-dir-resynch-file):
Juanma Barranquero <lekktu@gmail.com>
parents: 100908
diff changeset
292 If BODY uses EVENT, it should be a variable,
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
293 otherwise it will be evaluated twice."
100483
15455ea10b4a (vc-dir-at-event): Rename from vc-at-event. Change
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100475
diff changeset
294 (let ((posn (make-symbol "vc-dir-at-event-posn")))
100475
75d8b06be81f (vc-at-event): Handle (tool-bar) events. Fix bug#1585.
Sam Steingold <sds@gnu.org>
parents: 99367
diff changeset
295 `(save-excursion
75d8b06be81f (vc-at-event): Handle (tool-bar) events. Fix bug#1585.
Sam Steingold <sds@gnu.org>
parents: 99367
diff changeset
296 (unless (equal ,event '(tool-bar))
75d8b06be81f (vc-at-event): Handle (tool-bar) events. Fix bug#1585.
Sam Steingold <sds@gnu.org>
parents: 99367
diff changeset
297 (let ((,posn (event-start ,event)))
75d8b06be81f (vc-at-event): Handle (tool-bar) events. Fix bug#1585.
Sam Steingold <sds@gnu.org>
parents: 99367
diff changeset
298 (set-buffer (window-buffer (posn-window ,posn)))
75d8b06be81f (vc-at-event): Handle (tool-bar) events. Fix bug#1585.
Sam Steingold <sds@gnu.org>
parents: 99367
diff changeset
299 (goto-char (posn-point ,posn))))
75d8b06be81f (vc-at-event): Handle (tool-bar) events. Fix bug#1585.
Sam Steingold <sds@gnu.org>
parents: 99367
diff changeset
300 ,@body)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
301
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
302 (defun vc-dir-menu (e)
97210
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
303 "Popup the VC dir menu."
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
304 (interactive "e")
100483
15455ea10b4a (vc-dir-at-event): Rename from vc-at-event. Change
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100475
diff changeset
305 (vc-dir-at-event e (popup-menu vc-dir-menu-map e)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
306
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
307 (defvar vc-dir-tool-bar-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
308 (let ((map (make-sparse-keymap)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
309 (tool-bar-local-item-from-menu 'vc-dir-find-file "open"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
310 map vc-dir-mode-map)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
311 (tool-bar-local-item "bookmark_add"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
312 'vc-dir-toggle-mark 'vc-dir-toggle-mark map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
313 :help "Toggle mark on current item")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
314 (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
315 map vc-dir-mode-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
316 :rtl "right-arrow")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
317 (tool-bar-local-item-from-menu 'vc-dir-next-line "right-arrow"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
318 map vc-dir-mode-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
319 :rtl "left-arrow")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
320 (tool-bar-local-item-from-menu 'vc-print-log "info"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
321 map vc-dir-mode-map)
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
322 (tool-bar-local-item-from-menu 'revert-buffer "refresh"
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
323 map vc-dir-mode-map)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
324 (tool-bar-local-item-from-menu 'nonincremental-search-forward
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
325 "search" map)
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
326 (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
327 "search-replace" map vc-dir-mode-map)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
328 (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
329 map vc-dir-mode-map)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
330 (tool-bar-local-item-from-menu 'quit-window "exit"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
331 map vc-dir-mode-map)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
332 map))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
333
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
334 (defun vc-dir-node-directory (node)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
335 ;; Compute the directory for NODE.
105424
098f8a47a308 Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents: 105293
diff changeset
336 ;; If it's a directory node, get it from the node.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
337 (let ((data (ewoc-data node)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
338 (or (vc-dir-fileinfo->directory data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
339 ;; Otherwise compute it from the file name.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
340 (file-name-directory
104615
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
341 (directory-file-name
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
342 (expand-file-name
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
343 (vc-dir-fileinfo->name data)))))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
344
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
345 (defun vc-dir-update (entries buffer &optional noinsert)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
346 "Update BUFFER's ewoc from the list of ENTRIES.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
347 If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
348 ;; Add ENTRIES to the vc-dir buffer BUFFER.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
349 (with-current-buffer buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
350 ;; Insert the entries sorted by name into the ewoc.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
351 ;; We assume the ewoc is sorted too, which should be the
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
352 ;; case if we always add entries with vc-dir-update.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
353 (setq entries
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
354 ;; Sort: first files and then subdirectories.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
355 ;; XXX: this is VERY inefficient, it computes the directory
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
356 ;; names too many times
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
357 (sort entries
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
358 (lambda (entry1 entry2)
104615
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
359 (let ((dir1 (file-name-directory
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
360 (directory-file-name (expand-file-name (car entry1)))))
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
361 (dir2 (file-name-directory
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
362 (directory-file-name (expand-file-name (car entry2))))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
363 (cond
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
364 ((string< dir1 dir2) t)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
365 ((not (string= dir1 dir2)) nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
366 ((string< (car entry1) (car entry2))))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
367 ;; Insert directory entries in the right places.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
368 (let ((entry (car entries))
102260
a52c9332c41c (vc-dir-update): Make sure ./ is always first in the listing.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101940
diff changeset
369 (node (ewoc-nth vc-ewoc 0))
108929
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
370 (to-remove nil)
102260
a52c9332c41c (vc-dir-update): Make sure ./ is always first in the listing.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101940
diff changeset
371 (dotname (file-relative-name default-directory)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
372 ;; Insert . if it is not present.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
373 (unless node
102260
a52c9332c41c (vc-dir-update): Make sure ./ is always first in the listing.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101940
diff changeset
374 (ewoc-enter-last
a52c9332c41c (vc-dir-update): Make sure ./ is always first in the listing.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101940
diff changeset
375 vc-ewoc (vc-dir-create-fileinfo
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
376 dotname nil nil nil default-directory))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
377 (setq node (ewoc-nth vc-ewoc 0)))
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
378
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
379 (while (and entry node)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
380 (let* ((entryfile (car entry))
104615
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
381 (entrydir (file-name-directory (directory-file-name
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
382 (expand-file-name entryfile))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
383 (nodedir (vc-dir-node-directory node)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
384 (cond
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
385 ;; First try to find the directory.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
386 ((string-lessp nodedir entrydir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
387 (setq node (ewoc-next vc-ewoc node)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
388 ((string-equal nodedir entrydir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
389 ;; Found the directory, find the place for the file name.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
390 (let ((nodefile (vc-dir-fileinfo->name (ewoc-data node))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
391 (cond
102260
a52c9332c41c (vc-dir-update): Make sure ./ is always first in the listing.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101940
diff changeset
392 ((string= nodefile dotname)
a52c9332c41c (vc-dir-update): Make sure ./ is always first in the listing.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101940
diff changeset
393 (setq node (ewoc-next vc-ewoc node)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
394 ((string-lessp nodefile entryfile)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
395 (setq node (ewoc-next vc-ewoc node)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
396 ((string-equal nodefile entryfile)
108929
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
397 (if (nth 1 entry)
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
398 (progn
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
399 (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
400 (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
401 (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
402 (ewoc-invalidate vc-ewoc node))
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
403 ;; If the state is nil, the file does not exist
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
404 ;; anymore, so remember the entry so we can remove
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
405 ;; it after we are done inserting all ENTRIES.
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
406 (push node to-remove))
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
407 (setq entries (cdr entries))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
408 (setq entry (car entries))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
409 (setq node (ewoc-next vc-ewoc node)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
410 (t
109289
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
411 (unless noinsert
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
412 (ewoc-enter-before vc-ewoc node
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
413 (apply 'vc-dir-create-fileinfo entry)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
414 (setq entries (cdr entries))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
415 (setq entry (car entries))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
416 (t
109289
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
417 (unless noinsert
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
418 ;; We might need to insert a directory node if the
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
419 ;; previous node was in a different directory.
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
420 (let* ((rd (file-relative-name entrydir))
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
421 (prev-node (ewoc-prev vc-ewoc node))
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
422 (prev-dir (vc-dir-node-directory prev-node)))
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
423 (unless (string-equal entrydir prev-dir)
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
424 (ewoc-enter-before
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
425 vc-ewoc node (vc-dir-create-fileinfo rd nil nil nil entrydir))))
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
426 ;; Now insert the node itself.
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
427 (ewoc-enter-before vc-ewoc node
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
428 (apply 'vc-dir-create-fileinfo entry)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
429 (setq entries (cdr entries) entry (car entries))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
430 ;; We're past the last node, all remaining entries go to the end.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
431 (unless (or node noinsert)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
432 (let ((lastdir (vc-dir-node-directory (ewoc-nth vc-ewoc -1))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
433 (dolist (entry entries)
104615
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
434 (let ((entrydir (file-name-directory
6915f976dcd2 (vc-dir-node-directory, vc-dir-update): Get the parent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104051
diff changeset
435 (directory-file-name (expand-file-name (car entry))))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
436 ;; Insert a directory node if needed.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
437 (unless (string-equal lastdir entrydir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
438 (setq lastdir entrydir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
439 (let ((rd (file-relative-name entrydir)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
440 (ewoc-enter-last
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
441 vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
442 ;; Now insert the node itself.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
443 (ewoc-enter-last vc-ewoc
108929
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
444 (apply 'vc-dir-create-fileinfo entry))))))
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
445 (when to-remove
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
446 (let ((inhibit-read-only t))
739b55c58952 * lisp/vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106887
diff changeset
447 (apply 'ewoc-delete vc-ewoc (nreverse to-remove)))))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
448
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
449 (defun vc-dir-busy ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
450 (and (buffer-live-p vc-dir-process-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
451 (get-buffer-process vc-dir-process-buffer)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
452
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
453 (defun vc-dir-kill-dir-status-process ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
454 "Kill the temporary buffer and associated process."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
455 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
456 (when (buffer-live-p vc-dir-process-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
457 (let ((proc (get-buffer-process vc-dir-process-buffer)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
458 (when proc (delete-process proc))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
459 (setq vc-dir-process-buffer nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
460 (setq mode-line-process nil))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
461
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
462 (defun vc-dir-kill-query ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
463 ;; Make sure that when the status buffer is killed the update
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
464 ;; process running in background is also killed.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
465 (if (vc-dir-busy)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
466 (when (y-or-n-p "Status update process running, really kill status buffer? ")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
467 (vc-dir-kill-dir-status-process)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
468 t)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
469 t))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
470
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
471 (defun vc-dir-next-line (arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
472 "Go to the next line.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
473 If a prefix argument is given, move by that many lines."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
474 (interactive "p")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
475 (with-no-warnings
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
476 (ewoc-goto-next vc-ewoc arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
477 (vc-dir-move-to-goal-column)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
478
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
479 (defun vc-dir-previous-line (arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
480 "Go to the previous line.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
481 If a prefix argument is given, move by that many lines."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
482 (interactive "p")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
483 (ewoc-goto-prev vc-ewoc arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
484 (vc-dir-move-to-goal-column))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
485
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
486 (defun vc-dir-next-directory ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
487 "Go to the next directory."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
488 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
489 (let ((orig (point)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
490 (if
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
491 (catch 'foundit
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
492 (while t
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
493 (let* ((next (ewoc-next vc-ewoc (ewoc-locate vc-ewoc))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
494 (cond ((not next)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
495 (throw 'foundit t))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
496 (t
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
497 (progn
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
498 (ewoc-goto-node vc-ewoc next)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
499 (vc-dir-move-to-goal-column)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
500 (if (vc-dir-fileinfo->directory (ewoc-data next))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
501 (throw 'foundit nil))))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
502 (goto-char orig))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
503
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
504 (defun vc-dir-previous-directory ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
505 "Go to the previous directory."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
506 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
507 (let ((orig (point)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
508 (if
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
509 (catch 'foundit
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
510 (while t
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
511 (let* ((prev (ewoc-prev vc-ewoc (ewoc-locate vc-ewoc))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
512 (cond ((not prev)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
513 (throw 'foundit t))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
514 (t
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
515 (progn
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
516 (ewoc-goto-node vc-ewoc prev)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
517 (vc-dir-move-to-goal-column)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
518 (if (vc-dir-fileinfo->directory (ewoc-data prev))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
519 (throw 'foundit nil))))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
520 (goto-char orig))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
521
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
522 (defun vc-dir-mark-unmark (mark-unmark-function)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
523 (if (use-region-p)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
524 (let ((firstl (line-number-at-pos (region-beginning)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
525 (lastl (line-number-at-pos (region-end))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
526 (save-excursion
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
527 (goto-char (region-beginning))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
528 (while (<= (line-number-at-pos) lastl)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
529 (funcall mark-unmark-function))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
530 (funcall mark-unmark-function)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
531
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
532 (defun vc-dir-parent-marked-p (arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
533 ;; Return nil if none of the parent directories of arg is marked.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
534 (let* ((argdir (vc-dir-node-directory arg))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
535 (arglen (length argdir))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
536 (crt arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
537 data dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
538 ;; Go through the predecessors, checking if any directory that is
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
539 ;; a parent is marked.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
540 (while (setq crt (ewoc-prev vc-ewoc crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
541 (setq data (ewoc-data crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
542 (setq dir (vc-dir-node-directory crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
543 (when (and (vc-dir-fileinfo->directory data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
544 (vc-string-prefix-p dir argdir))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
545 (when (vc-dir-fileinfo->marked data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
546 (error "Cannot mark `%s', parent directory `%s' marked"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
547 (vc-dir-fileinfo->name (ewoc-data arg))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
548 (vc-dir-fileinfo->name data)))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
549 nil))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
550
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
551 (defun vc-dir-children-marked-p (arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
552 ;; Return nil if none of the children of arg is marked.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
553 (let* ((argdir-re (concat "\\`" (regexp-quote (vc-dir-node-directory arg))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
554 (is-child t)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
555 (crt arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
556 data dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
557 (while (and is-child (setq crt (ewoc-next vc-ewoc crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
558 (setq data (ewoc-data crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
559 (setq dir (vc-dir-node-directory crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
560 (if (string-match argdir-re dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
561 (when (vc-dir-fileinfo->marked data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
562 (error "Cannot mark `%s', child `%s' marked"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
563 (vc-dir-fileinfo->name (ewoc-data arg))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
564 (vc-dir-fileinfo->name data)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
565 ;; We are done, we got to an entry that is not a child of `arg'.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
566 (setq is-child nil)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
567 nil))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
568
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
569 (defun vc-dir-mark-file (&optional arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
570 ;; Mark ARG or the current file and move to the next line.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
571 (let* ((crt (or arg (ewoc-locate vc-ewoc)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
572 (file (ewoc-data crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
573 (isdir (vc-dir-fileinfo->directory file)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
574 (when (or (and isdir (not (vc-dir-children-marked-p crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
575 (and (not isdir) (not (vc-dir-parent-marked-p crt))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
576 (setf (vc-dir-fileinfo->marked file) t)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
577 (ewoc-invalidate vc-ewoc crt)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
578 (unless (or arg (mouse-event-p last-command-event))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
579 (vc-dir-next-line 1)))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
580
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
581 (defun vc-dir-mark ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
582 "Mark the current file or all files in the region.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
583 If the region is active, mark all the files in the region.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
584 Otherwise mark the file on the current line and move to the next
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
585 line."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
586 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
587 (vc-dir-mark-unmark 'vc-dir-mark-file))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
588
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
589 (defun vc-dir-mark-all-files (arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
590 "Mark all files with the same state as the current one.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
591 With a prefix argument mark all files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
592 If the current entry is a directory, mark all child files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
593
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
594 The commands operate on files that are on the same state.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
595 This command is intended to make it easy to select all files that
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
596 share the same state."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
597 (interactive "P")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
598 (if arg
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
599 ;; Mark all files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
600 (progn
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
601 ;; First check that no directory is marked, we can't mark
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
602 ;; files in that case.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
603 (ewoc-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
604 (lambda (filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
605 (when (and (vc-dir-fileinfo->directory filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
606 (vc-dir-fileinfo->marked filearg))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
607 (error "Cannot mark all files, directory `%s' marked"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
608 (vc-dir-fileinfo->name filearg))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
609 vc-ewoc)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
610 (ewoc-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
611 (lambda (filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
612 (unless (vc-dir-fileinfo->marked filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
613 (setf (vc-dir-fileinfo->marked filearg) t)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
614 t))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
615 vc-ewoc))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
616 (let ((data (ewoc-data (ewoc-locate vc-ewoc))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
617 (if (vc-dir-fileinfo->directory data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
618 ;; It's a directory, mark child files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
619 (let ((crt (ewoc-locate vc-ewoc)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
620 (unless (vc-dir-children-marked-p crt)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
621 (while (setq crt (ewoc-next vc-ewoc crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
622 (let ((crt-data (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
623 (unless (vc-dir-fileinfo->directory crt-data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
624 (setf (vc-dir-fileinfo->marked crt-data) t)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
625 (ewoc-invalidate vc-ewoc crt))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
626 ;; It's a file
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
627 (let ((state (vc-dir-fileinfo->state data))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
628 (crt (ewoc-nth vc-ewoc 0)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
629 (while crt
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
630 (let ((crt-data (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
631 (when (and (not (vc-dir-fileinfo->marked crt-data))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
632 (eq (vc-dir-fileinfo->state crt-data) state)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
633 (not (vc-dir-fileinfo->directory crt-data)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
634 (vc-dir-mark-file crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
635 (setq crt (ewoc-next vc-ewoc crt))))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
636
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
637 (defun vc-dir-unmark-file ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
638 ;; Unmark the current file and move to the next line.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
639 (let* ((crt (ewoc-locate vc-ewoc))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
640 (file (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
641 (setf (vc-dir-fileinfo->marked file) nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
642 (ewoc-invalidate vc-ewoc crt)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
643 (unless (mouse-event-p last-command-event)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
644 (vc-dir-next-line 1))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
645
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
646 (defun vc-dir-unmark ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
647 "Unmark the current file or all files in the region.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
648 If the region is active, unmark all the files in the region.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
649 Otherwise mark the file on the current line and move to the next
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
650 line."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
651 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
652 (vc-dir-mark-unmark 'vc-dir-unmark-file))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
653
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
654 (defun vc-dir-unmark-file-up ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
655 "Move to the previous line and unmark the file."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
656 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
657 ;; If we're on the first line, we won't move up, but we will still
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
658 ;; remove the mark. This seems a bit odd but it is what buffer-menu
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
659 ;; does.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
660 (let* ((prev (ewoc-goto-prev vc-ewoc 1))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
661 (file (ewoc-data prev)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
662 (setf (vc-dir-fileinfo->marked file) nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
663 (ewoc-invalidate vc-ewoc prev)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
664 (vc-dir-move-to-goal-column)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
665
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
666 (defun vc-dir-unmark-all-files (arg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
667 "Unmark all files with the same state as the current one.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
668 With a prefix argument unmark all files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
669 If the current entry is a directory, unmark all the child files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
670
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
671 The commands operate on files that are on the same state.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
672 This command is intended to make it easy to deselect all files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
673 that share the same state."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
674 (interactive "P")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
675 (if arg
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
676 (ewoc-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
677 (lambda (filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
678 (when (vc-dir-fileinfo->marked filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
679 (setf (vc-dir-fileinfo->marked filearg) nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
680 t))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
681 vc-ewoc)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
682 (let* ((crt (ewoc-locate vc-ewoc))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
683 (data (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
684 (if (vc-dir-fileinfo->directory data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
685 ;; It's a directory, unmark child files.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
686 (while (setq crt (ewoc-next vc-ewoc crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
687 (let ((crt-data (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
688 (unless (vc-dir-fileinfo->directory crt-data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
689 (setf (vc-dir-fileinfo->marked crt-data) nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
690 (ewoc-invalidate vc-ewoc crt))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
691 ;; It's a file
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
692 (let ((crt-state (vc-dir-fileinfo->state (ewoc-data crt))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
693 (ewoc-map
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
694 (lambda (filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
695 (when (and (vc-dir-fileinfo->marked filearg)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
696 (eq (vc-dir-fileinfo->state filearg) crt-state))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
697 (setf (vc-dir-fileinfo->marked filearg) nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
698 t))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
699 vc-ewoc))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
700
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
701 (defun vc-dir-toggle-mark-file ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
702 (let* ((crt (ewoc-locate vc-ewoc))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
703 (file (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
704 (if (vc-dir-fileinfo->marked file)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
705 (vc-dir-unmark-file)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
706 (vc-dir-mark-file))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
707
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
708 (defun vc-dir-toggle-mark (e)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
709 (interactive "e")
100483
15455ea10b4a (vc-dir-at-event): Rename from vc-at-event. Change
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100475
diff changeset
710 (vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
711
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
712 (defun vc-dir-delete-file ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
713 "Delete the marked files, or the current file if no marks."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
714 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
715 (mapc 'vc-delete-file (or (vc-dir-marked-files)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
716 (list (vc-dir-current-file)))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
717
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
718 (defun vc-dir-find-file ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
719 "Find the file on the current line."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
720 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
721 (find-file (vc-dir-current-file)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
722
101924
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
723 (defun vc-dir-find-file-other-window (&optional event)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
724 "Find the file on the current line, in another window."
101924
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
725 (interactive (list last-nonmenu-event))
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
726 (if event (posn-set-point (event-end event)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
727 (find-file-other-window (vc-dir-current-file)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
728
96964
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
729 (defun vc-dir-isearch ()
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
730 "Search for a string through all marked buffers using Isearch."
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
731 (interactive)
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
732 (multi-isearch-files
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
733 (mapcar 'car (vc-dir-marked-only-files-and-states))))
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
734
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
735 (defun vc-dir-isearch-regexp ()
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
736 "Search for a regexp through all marked buffers using Isearch."
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
737 (interactive)
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
738 (multi-isearch-files-regexp
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
739 (mapcar 'car (vc-dir-marked-only-files-and-states))))
bd2850789ce2 (vc-dir-search, vc-dir-isearch)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96963
diff changeset
740
96963
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
741 (defun vc-dir-search (regexp)
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
742 "Search through all marked files for a match for REGEXP.
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
743 For marked directories, use the files displayed from those directories.
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
744 Stops when a match is found.
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
745 To continue searching for next match, use command \\[tags-loop-continue]."
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
746 (interactive "sSearch marked files (regexp): ")
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
747 (tags-search regexp '(mapcar 'car (vc-dir-marked-only-files-and-states))))
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
748
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
749 (defun vc-dir-query-replace-regexp (from to &optional delimited)
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
750 "Do `query-replace-regexp' of FROM with TO, on all marked files.
96963
4abff057d348 (vc-dir-search): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96888
diff changeset
751 For marked directories, use the files displayed from those directories.
96500
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
752 If a directory is marked, then use the files displayed for that directory.
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
753 Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
754 If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
755 with the command \\[tags-loop-continue]."
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
756 ;; FIXME: this is almost a copy of `dired-do-replace-regexp'. This
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
757 ;; should probably be made generic and used in both places instead of
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
758 ;; duplicating it here.
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
759 (interactive
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
760 (let ((common
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
761 (query-replace-read-args
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
762 "Query replace regexp in marked files" t t)))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
763 (list (nth 0 common) (nth 1 common) (nth 2 common))))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
764 (dolist (file (mapcar 'car (vc-dir-marked-only-files-and-states)))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
765 (let ((buffer (get-file-buffer file)))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
766 (if (and buffer (with-current-buffer buffer
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
767 buffer-read-only))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
768 (error "File `%s' is visited read-only" file))))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
769 (tags-query-replace from to delimited
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
770 '(mapcar 'car (vc-dir-marked-only-files-and-states))))
4c68d664c39b (vc-dir-query-replace-regexp): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96474
diff changeset
771
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
772 (defun vc-dir-current-file ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
773 (let ((node (ewoc-locate vc-ewoc)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
774 (unless node
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
775 (error "No file available"))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
776 (expand-file-name (vc-dir-fileinfo->name (ewoc-data node)))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
777
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
778 (defun vc-dir-marked-files ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
779 "Return the list of marked files."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
780 (mapcar
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
781 (lambda (elem) (expand-file-name (vc-dir-fileinfo->name elem)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
782 (ewoc-collect vc-ewoc 'vc-dir-fileinfo->marked)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
783
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
784 (defun vc-dir-marked-only-files-and-states ()
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
785 "Return the list of conses (FILE . STATE) for the marked files.
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
786 For marked directories return the corresponding conses for the
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
787 child files."
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
788 (let ((crt (ewoc-nth vc-ewoc 0))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
789 result)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
790 (while crt
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
791 (let ((crt-data (ewoc-data crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
792 (if (vc-dir-fileinfo->marked crt-data)
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
793 ;; FIXME: use vc-dir-child-files-and-states here instead of duplicating it.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
794 (if (vc-dir-fileinfo->directory crt-data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
795 (let* ((dir (vc-dir-fileinfo->directory crt-data))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
796 (dirlen (length dir))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
797 data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
798 (while
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
799 (and (setq crt (ewoc-next vc-ewoc crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
800 (vc-string-prefix-p dir
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
801 (progn
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
802 (setq data (ewoc-data crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
803 (vc-dir-node-directory crt))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
804 (unless (vc-dir-fileinfo->directory data)
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
805 (push
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
806 (cons (expand-file-name (vc-dir-fileinfo->name data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
807 (vc-dir-fileinfo->state data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
808 result))))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
809 (push (cons (expand-file-name (vc-dir-fileinfo->name crt-data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
810 (vc-dir-fileinfo->state crt-data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
811 result)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
812 (setq crt (ewoc-next vc-ewoc crt)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
813 (setq crt (ewoc-next vc-ewoc crt)))))
97696
5d466e3c0ab7 (vc-dir-marked-only-files-and-states):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 97660
diff changeset
814 (nreverse result)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
815
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
816 (defun vc-dir-child-files-and-states ()
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
817 "Return the list of conses (FILE . STATE) for child files of the current entry if it's a directory.
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
818 If it is a file, return the corresponding cons for the file itself."
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
819 (let* ((crt (ewoc-locate vc-ewoc))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
820 (crt-data (ewoc-data crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
821 result)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
822 (if (vc-dir-fileinfo->directory crt-data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
823 (let* ((dir (vc-dir-fileinfo->directory crt-data))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
824 (dirlen (length dir))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
825 data)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
826 (while
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
827 (and (setq crt (ewoc-next vc-ewoc crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
828 (vc-string-prefix-p dir (progn
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
829 (setq data (ewoc-data crt))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
830 (vc-dir-node-directory crt))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
831 (unless (vc-dir-fileinfo->directory data)
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
832 (push
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
833 (cons (expand-file-name (vc-dir-fileinfo->name data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
834 (vc-dir-fileinfo->state data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
835 result))))
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
836 (push
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
837 (cons (expand-file-name (vc-dir-fileinfo->name crt-data))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
838 (vc-dir-fileinfo->state crt-data)) result))
97696
5d466e3c0ab7 (vc-dir-marked-only-files-and-states):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 97660
diff changeset
839 (nreverse result)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
840
96520
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
841 (defun vc-dir-recompute-file-state (fname def-dir)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
842 (let* ((file-short (file-relative-name fname def-dir))
96880
938dd02137bc (vc-dir-recompute-file-state): Add workaround for CVS.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96541
diff changeset
843 (remove-me-when-CVS-works
938dd02137bc (vc-dir-recompute-file-state): Add workaround for CVS.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96541
diff changeset
844 (when (eq vc-dir-backend 'CVS)
938dd02137bc (vc-dir-recompute-file-state): Add workaround for CVS.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96541
diff changeset
845 ;; FIXME: Warning: UGLY HACK. The CVS backend caches the state
938dd02137bc (vc-dir-recompute-file-state): Add workaround for CVS.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96541
diff changeset
846 ;; info, this forces the backend to update it.
96888
32da3745adc8 Fixed mismatched parenthesis in vc-dir.el.
Bastien Guerry <bzg@altern.org>
parents: 96880
diff changeset
847 (vc-call-backend vc-dir-backend 'registered fname)))
96520
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
848 (state (vc-call-backend vc-dir-backend 'state fname))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
849 (extra (vc-call-backend vc-dir-backend
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
850 'status-fileinfo-extra fname)))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
851 (list file-short state extra)))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
852
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
853 (defun vc-dir-find-child-files (dirname)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
854 ;; Give a DIRNAME string return the list of all child files shown in
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
855 ;; the current *vc-dir* buffer.
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
856 (let ((crt (ewoc-nth vc-ewoc 0))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
857 children
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
858 dname)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
859 ;; Find DIR
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
860 (while (and crt (not (vc-string-prefix-p
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
861 dirname (vc-dir-node-directory crt))))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
862 (setq crt (ewoc-next vc-ewoc crt)))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
863 (while (and crt (vc-string-prefix-p
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
864 dirname
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
865 (setq dname (vc-dir-node-directory crt))))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
866 (let ((data (ewoc-data crt)))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
867 (unless (vc-dir-fileinfo->directory data)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
868 (push (expand-file-name (vc-dir-fileinfo->name data)) children)))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
869 (setq crt (ewoc-next vc-ewoc crt)))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
870 children))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
871
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
872 (defun vc-dir-resync-directory-files (dirname)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
873 ;; Update the entries for all the child files of DIRNAME shown in
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
874 ;; the current *vc-dir* buffer.
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
875 (let ((files (vc-dir-find-child-files dirname))
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
876 (ddir default-directory)
96520
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
877 fileentries)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
878 (when files
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
879 (dolist (crt files)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
880 (push (vc-dir-recompute-file-state crt ddir)
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
881 fileentries))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
882 (vc-dir-update fileentries (current-buffer)))))
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
883
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
884 (defun vc-dir-resynch-file (&optional fname)
101642
a2281d8c22e0 * vc-dir.el (vc-dir-menu-map, vc-dir-at-event, vc-dir-resynch-file):
Juanma Barranquero <lekktu@gmail.com>
parents: 100908
diff changeset
885 "Update the entries for FNAME in any directory buffers that list it."
96520
00812d11af93 * vc-dir.el (vc-dir-find-child-files): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96500
diff changeset
886 (let ((file (or fname (expand-file-name buffer-file-name)))
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
887 (drop '()))
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
888 (save-current-buffer
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
889 ;; look for a vc-dir buffer that might show this file.
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
890 (dolist (status-buf vc-dir-buffers)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
891 (if (not (buffer-live-p status-buf))
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
892 (push status-buf drop)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
893 (set-buffer status-buf)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
894 (if (not (derived-mode-p 'vc-dir-mode))
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
895 (push status-buf drop)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
896 (let ((ddir default-directory))
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
897 (when (vc-string-prefix-p ddir file)
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
898 (if (file-directory-p file)
106887
b9c9ec129ae5 (vc-dir-resynch-file): Update the vc-dir header when
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106815
diff changeset
899 (progn
b9c9ec129ae5 (vc-dir-resynch-file): Update the vc-dir header when
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106815
diff changeset
900 (vc-dir-resync-directory-files file)
b9c9ec129ae5 (vc-dir-resynch-file): Update the vc-dir header when
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106815
diff changeset
901 (ewoc-set-hf vc-ewoc
b9c9ec129ae5 (vc-dir-resynch-file): Update the vc-dir header when
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106815
diff changeset
902 (vc-dir-headers vc-dir-backend default-directory) ""))
109289
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
903 (let* ((complete-state (vc-dir-recompute-file-state file ddir))
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
904 (state (cadr complete-state)))
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
905 (vc-dir-update
109289
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
906 (list complete-state)
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
907 status-buf (or (not state)
ef318d39a3e6 Avoid displaying files with a nil state in vc-dir.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108929
diff changeset
908 (eq state 'up-to-date)))))))))))
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
909 ;; Remove out-of-date entries from vc-dir-buffers.
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
910 (dolist (b drop) (setq vc-dir-buffers (delq b vc-dir-buffers)))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
911
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
912 (defvar use-vc-backend) ;; dynamically bound
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
913
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
914 (define-derived-mode vc-dir-mode special-mode "VC dir"
97210
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
915 "Major mode for VC directory buffers.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
916 Marking/Unmarking key bindings and actions:
101718
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
917 m - mark a file/directory
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
918 - if the region is active, mark all the files in region.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
919 Restrictions: - a file cannot be marked if any parent directory is marked
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
920 - a directory cannot be marked if any child file or
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
921 directory is marked
101718
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
922 u - unmark a file/directory
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
923 - if the region is active, unmark all the files in region.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
924 M - if the cursor is on a file: mark all the files with the same state as
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
925 the current file
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
926 - if the cursor is on a directory: mark all child files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
927 - with a prefix argument: mark all files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
928 U - if the cursor is on a file: unmark all the files with the same state
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
929 as the current file
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
930 - if the cursor is on a directory: unmark all child files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
931 - with a prefix argument: unmark all files
101718
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
932 mouse-2 - toggles the mark state
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
933
97210
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
934 VC commands
101718
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
935 VC commands in the `C-x v' prefix can be used.
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
936 VC commands act on the marked entries. If nothing is marked, VC
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
937 commands act on the current entry.
97210
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
938
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
939 Search & Replace
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
940 S - searches the marked files
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
941 Q - does a query replace on the marked files
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
942 M-s a C-s - does an isearch on the marked files
97315
b51913497dd3 (vc-dir-mode): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 97210
diff changeset
943 M-s a C-M-s - does a regexp isearch on the marked files
97210
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
944 If nothing is marked, these commands act on the current entry.
50d4090b5c35 restore 1.17
Sam Steingold <sds@gnu.org>
parents: 97118
diff changeset
945 When a directory is current or marked, the Search & Replace
101718
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
946 commands act on the child files of that directory that are displayed in
e5e2e4109ea1 (vc-dir-mode): Fix docstring.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101717
diff changeset
947 the *vc-dir* buffer.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
948
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
949 \\{vc-dir-mode-map}"
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
950 (set (make-local-variable 'vc-dir-backend) use-vc-backend)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
951 (setq buffer-read-only t)
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
952 (when (boundp 'tool-bar-map)
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
953 (set (make-local-variable 'tool-bar-map) vc-dir-tool-bar-map))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
954 (let ((buffer-read-only nil))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
955 (erase-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
956 (set (make-local-variable 'vc-dir-process-buffer) nil)
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
957 (set (make-local-variable 'vc-ewoc) (ewoc-create #'vc-dir-printer))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
958 (set (make-local-variable 'revert-buffer-function)
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
959 'vc-dir-revert-buffer-function)
106759
e778a4a0f821 Fix bug#3224.
Juanma Barranquero <lekktu@gmail.com>
parents: 106412
diff changeset
960 (setq list-buffers-directory (expand-file-name "*vc-dir*" default-directory))
105293
8bfe20e0336c * vc-hooks.el (vc-dir-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105196
diff changeset
961 (add-to-list 'vc-dir-buffers (current-buffer))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
962 ;; Make sure that if the directory buffer is killed, the update
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
963 ;; process running in the background is also killed.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
964 (add-hook 'kill-buffer-query-functions 'vc-dir-kill-query nil t)
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
965 (vc-dir-refresh)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
966
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
967 (defun vc-dir-headers (backend dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
968 "Display the headers in the *VC dir* buffer.
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
969 It calls the `dir-extra-headers' backend method to display backend
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
970 specific headers."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
971 (concat
99367
ce0076e88ed4 (vc-dir-headers): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99361
diff changeset
972 ;; First layout the common headers.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
973 (propertize "VC backend : " 'face 'font-lock-type-face)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
974 (propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
975 (propertize "Working dir: " 'face 'font-lock-type-face)
111350
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
976 (propertize (format "%s\n" (abbreviate-file-name dir))
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
977 'face 'font-lock-variable-name-face)
99367
ce0076e88ed4 (vc-dir-headers): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99361
diff changeset
978 ;; Then the backend specific ones.
ce0076e88ed4 (vc-dir-headers): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99361
diff changeset
979 (vc-call-backend backend 'dir-extra-headers dir)
ce0076e88ed4 (vc-dir-headers): Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99361
diff changeset
980 "\n"))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
981
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
982 (defun vc-dir-refresh-files (files default-state)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
983 "Refresh some files in the *VC-dir* buffer."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
984 (let ((def-dir default-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
985 (backend vc-dir-backend))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
986 (vc-set-mode-line-busy-indicator)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
987 ;; Call the `dir-status-file' backend function.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
988 ;; `dir-status-file' is supposed to be asynchronous.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
989 ;; It should compute the results, and then call the function
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
990 ;; passed as an argument in order to update the vc-dir buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
991 ;; with the results.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
992 (unless (buffer-live-p vc-dir-process-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
993 (setq vc-dir-process-buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
994 (generate-new-buffer (format " *VC-%s* tmp status" backend))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
995 (lexical-let ((buffer (current-buffer)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
996 (with-current-buffer vc-dir-process-buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
997 (cd def-dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
998 (erase-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
999 (vc-call-backend
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1000 backend 'dir-status-files def-dir files default-state
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1001 (lambda (entries &optional more-to-come)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1002 ;; ENTRIES is a list of (FILE VC_STATE EXTRA) items.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1003 ;; If MORE-TO-COME is true, then more updates will come from
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1004 ;; the asynchronous process.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1005 (with-current-buffer buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1006 (vc-dir-update entries buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1007 (unless more-to-come
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1008 (setq mode-line-process nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1009 ;; Remove the ones that haven't been updated at all.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1010 ;; Those not-updated are those whose state is nil because the
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1011 ;; file/dir doesn't exist and isn't versioned.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1012 (ewoc-filter vc-ewoc
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1013 (lambda (info)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1014 ;; The state for directory entries might
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1015 ;; have been changed to 'up-to-date,
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1016 ;; reset it, othewise it will be removed when doing 'x'
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1017 ;; next time.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1018 ;; FIXME: There should be a more elegant way to do this.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1019 (when (and (vc-dir-fileinfo->directory info)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1020 (eq (vc-dir-fileinfo->state info)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1021 'up-to-date))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1022 (setf (vc-dir-fileinfo->state info) nil))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1023
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1024 (not (vc-dir-fileinfo->needs-update info))))))))))))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1025
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1026 (defun vc-dir-revert-buffer-function (&optional ignore-auto noconfirm)
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1027 (vc-dir-refresh))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1028
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1029 (defun vc-dir-refresh ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1030 "Refresh the contents of the *VC-dir* buffer.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1031 Throw an error if another update process is in progress."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1032 (interactive)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1033 (if (vc-dir-busy)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1034 (error "Another update process is in progress, cannot run two at a time")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1035 (let ((def-dir default-directory)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1036 (backend vc-dir-backend))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1037 (vc-set-mode-line-busy-indicator)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1038 ;; Call the `dir-status' backend function.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1039 ;; `dir-status' is supposed to be asynchronous.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1040 ;; It should compute the results, and then call the function
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1041 ;; passed as an argument in order to update the vc-dir buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1042 ;; with the results.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1043
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1044 ;; Create a buffer that can be used by `dir-status' and call
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1045 ;; `dir-status' with this buffer as the current buffer. Use
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1046 ;; `vc-dir-process-buffer' to remember this buffer, so that
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1047 ;; it can be used later to kill the update process in case it
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1048 ;; takes too long.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1049 (unless (buffer-live-p vc-dir-process-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1050 (setq vc-dir-process-buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1051 (generate-new-buffer (format " *VC-%s* tmp status" backend))))
96541
d39625535543 (vc-dir-refresh): Only update files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96520
diff changeset
1052 ;; set the needs-update flag on all non-directory entries
d39625535543 (vc-dir-refresh): Only update files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96520
diff changeset
1053 (ewoc-map (lambda (info)
d39625535543 (vc-dir-refresh): Only update files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96520
diff changeset
1054 (unless (vc-dir-fileinfo->directory info)
d39625535543 (vc-dir-refresh): Only update files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96520
diff changeset
1055 (setf (vc-dir-fileinfo->needs-update info) t) nil))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1056 vc-ewoc)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1057 (lexical-let ((buffer (current-buffer)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1058 (with-current-buffer vc-dir-process-buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1059 (cd def-dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1060 (erase-buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1061 (vc-call-backend
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1062 backend 'dir-status def-dir
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1063 (lambda (entries &optional more-to-come)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1064 ;; ENTRIES is a list of (FILE VC_STATE EXTRA) items.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1065 ;; If MORE-TO-COME is true, then more updates will come from
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1066 ;; the asynchronous process.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1067 (with-current-buffer buffer
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1068 (vc-dir-update entries buffer)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1069 (unless more-to-come
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1070 (let ((remaining
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1071 (ewoc-collect
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1072 vc-ewoc 'vc-dir-fileinfo->needs-update)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1073 (if remaining
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1074 (vc-dir-refresh-files
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1075 (mapcar 'vc-dir-fileinfo->name remaining)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1076 'up-to-date)
98471
497018549116 (vc-dir-mode): Don't create the ewoc header here.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 97696
diff changeset
1077 (setq mode-line-process nil)))))))))
497018549116 (vc-dir-mode): Don't create the ewoc header here.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 97696
diff changeset
1078 (ewoc-set-hf vc-ewoc (vc-dir-headers backend def-dir) ""))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1079
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1080 (defun vc-dir-show-fileentry (file)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1081 "Insert an entry for a specific file into the current *VC-dir* listing.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1082 This is typically used if the file is up-to-date (or has been added
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1083 outside of VC) and one wants to do some operation on it."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1084 (interactive "fShow file: ")
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1085 (vc-dir-update (list (list (file-relative-name file) (vc-state file))) (current-buffer)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1086
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1087 (defun vc-dir-hide-up-to-date ()
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1088 "Hide up-to-date items from display."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1089 (interactive)
96390
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1090 (let ((crt (ewoc-nth vc-ewoc -1))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1091 (first (ewoc-nth vc-ewoc 0)))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1092 ;; Go over from the last item to the first and remove the
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1093 ;; up-to-date files and directories with no child files.
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1094 (while (not (eq crt first))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1095 (let* ((data (ewoc-data crt))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1096 (dir (vc-dir-fileinfo->directory data))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1097 (next (ewoc-next vc-ewoc crt))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1098 (prev (ewoc-prev vc-ewoc crt))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1099 ;; ewoc-delete does not work without this...
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1100 (inhibit-read-only t))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1101 (when (or
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1102 ;; Remove directories with no child files.
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1103 (and dir
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1104 (or
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1105 ;; Nothing follows this directory.
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1106 (not next)
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1107 ;; Next item is a directory.
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1108 (vc-dir-fileinfo->directory (ewoc-data next))))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1109 ;; Remove files in the up-to-date state.
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1110 (eq (vc-dir-fileinfo->state data) 'up-to-date))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1111 (ewoc-delete vc-ewoc crt))
02d657f45045 * vc-dir.el (vc-dir-hide-up-to-date): Also hide empty directories.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96388
diff changeset
1112 (setq crt prev)))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1113
111350
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1114 (defun vc-dir-kill-line ()
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1115 "Remove the current line from display."
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1116 (interactive)
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1117 (let ((crt (ewoc-locate vc-ewoc))
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1118 (inhibit-read-only t))
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1119 (ewoc-delete vc-ewoc crt)))
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1120
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
1121 (defun vc-dir-printer (fileentry)
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
1122 (vc-call-backend vc-dir-backend 'dir-printer fileentry))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1123
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1124 (defun vc-dir-deduce-fileset (&optional state-model-only-files)
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1125 (let ((marked (vc-dir-marked-files))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1126 files
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1127 only-files-list
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1128 state
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1129 model)
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1130 (if marked
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1131 (progn
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1132 (setq files marked)
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1133 (when state-model-only-files
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1134 (setq only-files-list (vc-dir-marked-only-files-and-states))))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1135 (let ((crt (vc-dir-current-file)))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1136 (setq files (list crt))
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
1137 (when state-model-only-files
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1138 (setq only-files-list (vc-dir-child-files-and-states)))))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1139
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1140 (when state-model-only-files
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1141 (setq state (cdar only-files-list))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1142 ;; Check that all files are in a consistent state, since we use that
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1143 ;; state to decide which operation to perform.
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1144 (dolist (crt (cdr only-files-list))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1145 (unless (vc-compatible-state (cdr crt) state)
102660
ab984696947f (vc-dir-deduce-fileset): Make the error message more explicit.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 102260
diff changeset
1146 (error "When applying VC operations to multiple files, the files are required\nto be in similar VC states.\n%s in state %s clashes with %s in state %s"
96256
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1147 (car crt) (cdr crt) (caar only-files-list) state)))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1148 (setq only-files-list (mapcar 'car only-files-list))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1149 (when (and state (not (eq state 'unregistered)))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1150 (setq model (vc-checkout-model vc-dir-backend only-files-list))))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1151 (list vc-dir-backend files only-files-list state model)))
a56e02fe83fc * vc-dir.el (vc-dir-marked-only-files-and-states): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96216
diff changeset
1152
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1153 ;;;###autoload
96411
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1154 (defun vc-dir (dir &optional backend)
102929
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1155 "Show the VC status for \"interesting\" files in and below DIR.
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1156 This allows you to mark files and perform VC operations on them.
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1157 The list omits files which are up to date, with no changes in your copy
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1158 or the repository, if there is nothing in particular to say about them.
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1159
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1160 Preparing the list of file status takes time; when the buffer
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1161 first appears, it has only the first few lines of summary information.
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1162 The file lines appear later.
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1163
96411
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1164 Optional second argument BACKEND specifies the VC backend to use.
102929
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1165 Interactively, a prefix argument means to ask for the backend.
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1166
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1167 These are the commands available for use in the file status buffer:
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1168
106412
3fea95b17dfa (vc-dir): Use the correct markup for showing keymaps
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105424
diff changeset
1169 \\{vc-dir-mode-map}"
102929
6be674ea734e * vc-dir.el (vc-dir): Dox fix.
Richard M. Stallman <rms@gnu.org>
parents: 102660
diff changeset
1170
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1171 (interactive
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1172 (list
97118
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1173 ;; When you hit C-x v d in a visited VC file,
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1174 ;; the *vc-dir* buffer visits the directory under its truename;
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1175 ;; therefore it makes sense to always do that.
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1176 ;; Otherwise if you do C-x v d -> C-x C-f -> C-c v d
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1177 ;; you may get a new *vc-dir* buffer, different from the original
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1178 (file-truename (read-file-name "VC status for directory: "
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1179 default-directory default-directory t
48b4d1b43ea2 (vc-dir): Call file-truename on the dir argument.
Sam Steingold <sds@gnu.org>
parents: 97117
diff changeset
1180 nil #'file-directory-p))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1181 (if current-prefix-arg
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1182 (intern
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1183 (completing-read
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1184 "Use VC backend: "
96411
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1185 (mapcar (lambda (b) (list (symbol-name b)))
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1186 vc-handled-backends)
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1187 nil t nil nil)))))
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1188 (unless backend
31e595cb6c02 (vc-dir): Make backend argument optional and use
Andreas Schwab <schwab@suse.de>
parents: 96390
diff changeset
1189 (setq backend (vc-responsible-backend dir)))
111350
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1190 (let (pop-up-windows) ; based on cvs-examine; bug#6204
8027e412df98 Backport VC improvements from trunk.
Chong Yidong <cyd@stupidchicken.com>
parents: 109289
diff changeset
1191 (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend)))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1192 (if (derived-mode-p 'vc-dir-mode)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1193 (vc-dir-refresh)
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1194 ;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1195 (let ((use-vc-backend backend))
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1196 (vc-dir-mode))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1197
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
1198 (defun vc-default-dir-extra-headers (backend dir)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1199 ;; Be loud by default to remind people to add code to display
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1200 ;; backend specific headers.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1201 ;; XXX: change this to return nil before the release.
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1202 (concat
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1203 (propertize "Extra : " 'face 'font-lock-type-face)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1204 (propertize "Please add backend specific headers here. It's easy!"
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1205 'face 'font-lock-warning-face)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1206
101940
dea4466580a6 * vc-dir.el (vc-dir-filename-mouse-map): Rename from vc-dir-mouse-map.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101924
diff changeset
1207 (defvar vc-dir-filename-mouse-map
101924
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
1208 (let ((map (make-sparse-keymap)))
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
1209 (define-key map [mouse-2] 'vc-dir-find-file-other-window)
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
1210 map)
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
1211 "Local keymap for visiting a file.")
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
1212
99159
b0dce7f34dda * vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents: 99133
diff changeset
1213 (defun vc-default-dir-printer (backend fileentry)
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1214 "Pretty print FILEENTRY."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1215 ;; If you change the layout here, change vc-dir-move-to-goal-column.
101940
dea4466580a6 * vc-dir.el (vc-dir-filename-mouse-map): Rename from vc-dir-mouse-map.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101924
diff changeset
1216 ;; VC backends can implement backend specific versions of this
dea4466580a6 * vc-dir.el (vc-dir-filename-mouse-map): Rename from vc-dir-mouse-map.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101924
diff changeset
1217 ;; function. Changes here might need to be reflected in the
dea4466580a6 * vc-dir.el (vc-dir-filename-mouse-map): Rename from vc-dir-mouse-map.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101924
diff changeset
1218 ;; vc-BACKEND-dir-printer functions.
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1219 (let* ((isdir (vc-dir-fileinfo->directory fileentry))
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1220 (state (if isdir "" (vc-dir-fileinfo->state fileentry)))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1221 (filename (vc-dir-fileinfo->name fileentry)))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1222 (insert
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1223 (propertize
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1224 (format "%c" (if (vc-dir-fileinfo->marked fileentry) ?* ? ))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1225 'face 'font-lock-type-face)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1226 " "
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1227 (propertize
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1228 (format "%-20s" state)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1229 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1230 ((memq state '(missing conflict)) 'font-lock-warning-face)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1231 (t 'font-lock-variable-name-face))
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1232 'mouse-face 'highlight)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1233 " "
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1234 (propertize
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1235 (format "%s" filename)
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1236 'face
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1237 (if isdir 'font-lock-comment-delimiter-face 'font-lock-function-name-face)
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1238 'help-echo
96388
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
1239 (if isdir
7ed97437d100 * vc-dir.el (vc-dir): Complete only directory names.
Juanma Barranquero <lekktu@gmail.com>
parents: 96310
diff changeset
1240 "Directory\nVC operations can be applied to it\nmouse-3: Pop-up menu"
96216
0c3be806e711 (vc-client-object): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96204
diff changeset
1241 "File\nmouse-3: Pop-up menu")
101924
c1950714465b (vc-dir-find-file-other-window): Allow mouse events.
Nick Roberts <nickrob@snap.net.nz>
parents: 101718
diff changeset
1242 'mouse-face 'highlight
101940
dea4466580a6 * vc-dir.el (vc-dir-filename-mouse-map): Rename from vc-dir-mouse-map.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101924
diff changeset
1243 'keymap vc-dir-filename-mouse-map))))
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1244
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1245 (defun vc-default-extra-status-menu (backend)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1246 nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1247
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1248 (defun vc-default-status-fileinfo-extra (backend file)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1249 "Default absence of extra information returned for a file."
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1250 nil)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1251
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1252 (provide 'vc-dir)
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1253
96204
d4a46d5d6f08 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 96203
diff changeset
1254 ;; arch-tag: 0274a2e3-e8e9-4b1a-a73c-e8b9129d5d15
96203
30bbe1648bcf * vc.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1255 ;;; vc-dir.el ends here