annotate lisp/vc-dir.el @ 96384:59d141ae8c74

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