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