aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2008-05-09 20:17:50 +0000
committerEric S. Raymond2008-05-09 20:17:50 +0000
commitcb5d44b66d1d8d5ab3de862896a25bae88e76da2 (patch)
tree1ce565f16d99d0e90dfe9d661b155532faf57246
parent79ac8f50ea15722da21f05f37f36eea632701ff2 (diff)
downloademacs-cb5d44b66d1d8d5ab3de862896a25bae88e76da2.tar.gz
emacs-cb5d44b66d1d8d5ab3de862896a25bae88e76da2.zip
Dupport an use an observer flag in (vc-dispatcher-selection-set).
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/vc-dispatcher.el19
-rw-r--r--lisp/vc.el18
3 files changed, 24 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 20e02ce4c78..cbb2eb4dc47 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,9 +2,14 @@
2 2
3 * vc.el (vc-dir), vc-hooks.el: Tweak the VC directory bindings. 3 * vc.el (vc-dir), vc-hooks.el: Tweak the VC directory bindings.
4 These are now documented in the manual. 4 These are now documented in the manual.
5 * vc-dispatcher.el (vc-dir-update, vc-dir-parent-marked-p, 5 * vc-dispatcher.el (vc-dir-update, vc-dir-parent-marked-p,
6 vc-dir-children-marked-p): Remove the vc-dir-insert-directories global. 6 vc-dir-children-marked-p): Remove the vc-dir-insert-directories global.
7 7
8 * vc-dispatcher.el (vc-dispatcher-selection-set): Allow callers to
9 pass in an observer flag that says no buffer sync is required.
10 * vc.el (vc-deduce-fileset, vc-print-log, vc-version-diff): Use
11 the observer flag.
12
82008-05-09 Michael Albinus <michael.albinus@gmx.de> 132008-05-09 Michael Albinus <michael.albinus@gmx.de>
9 14
10 * simple.el (start-file-process): Clarify docstring. 15 * simple.el (start-file-process): Clarify docstring.
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el
index de034116da8..16c8a0fc5ab 100644
--- a/lisp/vc-dispatcher.el
+++ b/lisp/vc-dispatcher.el
@@ -1270,16 +1270,6 @@ U - if the cursor is on a file: unmark all the files with the same VC state
1270 1270
1271(put 'vc-dir-mode 'mode-class 'special) 1271(put 'vc-dir-mode 'mode-class 'special)
1272 1272
1273(defun vc-buffer-sync (&optional not-urgent)
1274 "Make sure the current buffer and its working file are in sync.
1275NOT-URGENT means it is ok to continue if the user says not to save."
1276 (when (buffer-modified-p)
1277 (if (or vc-suppress-confirm
1278 (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name))))
1279 (save-buffer)
1280 (unless not-urgent
1281 (error "Aborted")))))
1282
1283(defun vc-dispatcher-browsing () 1273(defun vc-dispatcher-browsing ()
1284 "Are we in a directory browser buffer?" 1274 "Are we in a directory browser buffer?"
1285 (derived-mode-p 'vc-dir-mode)) 1275 (derived-mode-p 'vc-dir-mode))
@@ -1295,7 +1285,7 @@ NOT-URGENT means it is ok to continue if the user says not to save."
1295 (setq member t)))) 1285 (setq member t))))
1296 member)) 1286 member))
1297 1287
1298(defun vc-dispatcher-selection-set () 1288(defun vc-dispatcher-selection-set (&optional observer)
1299 "Deduce a set of files to which to apply an operation. Return the fileset. 1289 "Deduce a set of files to which to apply an operation. Return the fileset.
1300If we're in a directory display, the fileset is the list of marked files (if 1290If we're in a directory display, the fileset is the list of marked files (if
1301there is one) else the file on the curreent line. If not in a directory 1291there is one) else the file on the curreent line. If not in a directory
@@ -1320,10 +1310,9 @@ containing that file. Otherwise, throw an error."
1320 ;; We assume, in order to avoid unpleasant surprises to the user, 1310 ;; We assume, in order to avoid unpleasant surprises to the user,
1321 ;; that a fileset is not in good shape to be handed to the user if the 1311 ;; that a fileset is not in good shape to be handed to the user if the
1322 ;; buffers visiting the fileset don't match the on-disk contents. 1312 ;; buffers visiting the fileset don't match the on-disk contents.
1323 ;; This is actually untrue for operations like `print-log' (or `diff' 1313 (if (not observer)
1324 ;; between two revisions), so maybe this should be moved elsewhere. 1314 (save-some-buffers
1325 (save-some-buffers 1315 nil (lambda () (vc-dispatcher-in-fileset-p files))))
1326 nil (lambda () (vc-dispatcher-in-fileset-p files)))
1327 files)) 1316 files))
1328 1317
1329;; arch-tag: 7d08b17f-5470-4799-914b-bfb9fcf6a246 1318;; arch-tag: 7d08b17f-5470-4799-914b-bfb9fcf6a246
diff --git a/lisp/vc.el b/lisp/vc.el
index 2a46d138731..55fc1cc9faa 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1002,10 +1002,10 @@ Only files already under version control are noticed."
1002 node (lambda (f) (when (vc-backend f) (push f flattened))))) 1002 node (lambda (f) (when (vc-backend f) (push f flattened)))))
1003 (nreverse flattened))) 1003 (nreverse flattened)))
1004 1004
1005(defun vc-deduce-fileset () 1005(defun vc-deduce-fileset (&optional observer)
1006 "Deduce a set of files and a backend to which to apply an operation and 1006 "Deduce a set of files and a backend to which to apply an operation and
1007the common state of the fileset. Return (BACKEND . FILESET)." 1007the common state of the fileset. Return (BACKEND . FILESET)."
1008 (let* ((fileset (vc-dispatcher-selection-set)) 1008 (let* ((fileset (vc-dispatcher-selection-set observer))
1009 ;; FIXME: Store the backend in a buffer-local variable. 1009 ;; FIXME: Store the backend in a buffer-local variable.
1010 (backend (if (derived-mode-p 'vc-dir-mode) 1010 (backend (if (derived-mode-p 'vc-dir-mode)
1011 (vc-responsible-backend default-directory) 1011 (vc-responsible-backend default-directory)
@@ -1031,6 +1031,16 @@ the common state of the fileset. Return (BACKEND . FILESET)."
1031 (unless (vc-backend buffer-file-name) 1031 (unless (vc-backend buffer-file-name)
1032 (error "File %s is not under version control" buffer-file-name)))))) 1032 (error "File %s is not under version control" buffer-file-name))))))
1033 1033
1034(defun vc-buffer-sync (&optional not-urgent)
1035 "Make sure the current buffer and its working file are in sync.
1036NOT-URGENT means it is ok to continue if the user says not to save."
1037 (when (buffer-modified-p)
1038 (if (or vc-suppress-confirm
1039 (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name))))
1040 (save-buffer)
1041 (unless not-urgent
1042 (error "Aborted")))))
1043
1034;;; Support for the C-x v v command. 1044;;; Support for the C-x v v command.
1035;; This is where all the single-file-oriented code from before the fileset 1045;; This is where all the single-file-oriented code from before the fileset
1036;; rewrite lives. 1046;; rewrite lives.
@@ -1561,7 +1571,7 @@ returns t if the buffer had changes, nil otherwise."
1561(defun vc-version-diff (files rev1 rev2) 1571(defun vc-version-diff (files rev1 rev2)
1562 "Report diffs between revisions of the fileset in the repository history." 1572 "Report diffs between revisions of the fileset in the repository history."
1563 (interactive 1573 (interactive
1564 (let* ((vc-fileset (vc-deduce-fileset)) 1574 (let* ((vc-fileset (vc-deduce-fileset t))
1565 (files (cdr vc-fileset)) 1575 (files (cdr vc-fileset))
1566 (backend (car vc-fileset)) 1576 (backend (car vc-fileset))
1567 (first (car files)) 1577 (first (car files))
@@ -2123,7 +2133,7 @@ allowed and simply skipped)."
2123 "List the change log of the current fileset in a window. 2133 "List the change log of the current fileset in a window.
2124If WORKING-REVISION is non-nil, leave the point at that revision." 2134If WORKING-REVISION is non-nil, leave the point at that revision."
2125 (interactive) 2135 (interactive)
2126 (let* ((vc-fileset (vc-deduce-fileset)) 2136 (let* ((vc-fileset (vc-deduce-fileset t))
2127 (backend (car vc-fileset)) 2137 (backend (car vc-fileset))
2128 (files (cdr vc-fileset)) 2138 (files (cdr vc-fileset))
2129 (working-revision (or working-revision (vc-working-revision (car files))))) 2139 (working-revision (or working-revision (vc-working-revision (car files)))))