diff options
| author | Eric S. Raymond | 2008-05-07 00:19:19 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 2008-05-07 00:19:19 +0000 |
| commit | 4fe2e5ed8a87c34d36fdbe4c6ad3bff5b43c353e (patch) | |
| tree | d48d8852d829bad21e78de69a1834ac8a338ba89 | |
| parent | e6244c1bcd3d81b1512fc542fd3d947ca0333ab7 (diff) | |
| download | emacs-4fe2e5ed8a87c34d36fdbe4c6ad3bff5b43c353e.tar.gz emacs-4fe2e5ed8a87c34d36fdbe4c6ad3bff5b43c353e.zip | |
Merege two functions in preparation for removing dired.
| -rw-r--r-- | lisp/vc-dispatcher.el | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el index 11f9c137084..c7d74da404b 100644 --- a/lisp/vc-dispatcher.el +++ b/lisp/vc-dispatcher.el | |||
| @@ -567,10 +567,7 @@ editing!" | |||
| 567 | (when buffer | 567 | (when buffer |
| 568 | (with-current-buffer buffer | 568 | (with-current-buffer buffer |
| 569 | (vc-resynch-window file keep noquery))))) | 569 | (vc-resynch-window file keep noquery))))) |
| 570 | (vc-directory-resynch-file file) | 570 | (vc-directory-resynch-file file)) |
| 571 | (when (memq 'vc-dir-mark-buffer-changed after-save-hook) | ||
| 572 | (let ((buffer (get-file-buffer file))) | ||
| 573 | (vc-dir-mark-buffer-changed file)))) | ||
| 574 | 571 | ||
| 575 | ;; Command closures | 572 | ;; Command closures |
| 576 | 573 | ||
| @@ -850,20 +847,6 @@ This code, like dired, assumes UNIX -l format." | |||
| 850 | (push buffer result))))) | 847 | (push buffer result))))) |
| 851 | (nreverse result))) | 848 | (nreverse result))) |
| 852 | 849 | ||
| 853 | (defun vc-directory-resynch-file (file) | ||
| 854 | "Update the entries for FILE in any VC Dired buffers that list it." | ||
| 855 | ;;FIXME This needs to be implemented so it works for vc-dir | ||
| 856 | (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file)))) | ||
| 857 | (when buffers | ||
| 858 | (mapcar (lambda (buffer) | ||
| 859 | (with-current-buffer buffer | ||
| 860 | (when (dired-goto-file file) | ||
| 861 | ;; bind vc-dired-terse-mode to nil so that | ||
| 862 | ;; files won't vanish when they are checked in | ||
| 863 | (let ((vc-dired-terse-mode nil)) | ||
| 864 | (dired-do-redisplay 1))))) | ||
| 865 | buffers)))) | ||
| 866 | |||
| 867 | ;;;###autoload | 850 | ;;;###autoload |
| 868 | (defun vc-directory (dir read-switches) | 851 | (defun vc-directory (dir read-switches) |
| 869 | "Create a buffer in VC Dired Mode for directory DIR. | 852 | "Create a buffer in VC Dired Mode for directory DIR. |
| @@ -1559,32 +1542,45 @@ that share the same state." | |||
| 1559 | (setq crt (ewoc-next vc-ewoc crt))))) | 1542 | (setq crt (ewoc-next vc-ewoc crt))))) |
| 1560 | result)) | 1543 | result)) |
| 1561 | 1544 | ||
| 1562 | (defun vc-dir-mark-buffer-changed (&optional fname) | 1545 | (defun vc-directory-resynch-file (&optional fname) |
| 1563 | (let* ((file (or fname (expand-file-name buffer-file-name))) | 1546 | "Update the entries for FILE in any directory buffers that list it." |
| 1564 | (found-vc-dir-buf nil)) | 1547 | (let ((file (or fname (expand-file-name buffer-file-name)))) |
| 1565 | (save-excursion | 1548 | ;; The VC-Dired case |
| 1566 | (dolist (status-buf (buffer-list)) | 1549 | (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file)))) |
| 1567 | (set-buffer status-buf) | 1550 | (when buffers |
| 1568 | ;; look for a vc-dir buffer that might show this file. | 1551 | (mapc (lambda (buffer) |
| 1569 | (when (eq major-mode 'vc-dir-mode) | 1552 | (with-current-buffer buffer |
| 1570 | (setq found-vc-dir-buf t) | 1553 | (when (dired-goto-file file) |
| 1571 | (let ((ddir (expand-file-name default-directory))) | 1554 | ;; bind vc-dired-terse-mode to nil so that |
| 1572 | ;; This test is cvs-string-prefix-p | 1555 | ;; files won't vanish when they are checked in |
| 1573 | (when (eq t (compare-strings file nil (length ddir) ddir nil nil)) | 1556 | (let ((vc-dired-terse-mode nil)) |
| 1574 | (let* | 1557 | (dired-do-redisplay 1))))) |
| 1575 | ((file-short (substring file (length ddir))) | 1558 | buffers))) |
| 1576 | (state | 1559 | ;; The vc-dir case |
| 1577 | (funcall (vc-client-object->file-to-state vc-client-mode) | 1560 | (let ((found-vc-dir-buf nil)) |
| 1578 | file)) | 1561 | (save-excursion |
| 1579 | (extra | 1562 | (dolist (status-buf (buffer-list)) |
| 1580 | (funcall (vc-client-object->file-to-extra vc-client-mode) | 1563 | (set-buffer status-buf) |
| 1581 | file)) | 1564 | ;; look for a vc-dir buffer that might show this file. |
| 1582 | (entry | 1565 | (when (eq major-mode 'vc-dir-mode) |
| 1583 | (list file-short state extra))) | 1566 | (setq found-vc-dir-buf t) |
| 1584 | (vc-dir-update (list entry) status-buf)))))) | 1567 | (let ((ddir (expand-file-name default-directory))) |
| 1585 | ;; We didn't find any vc-dir buffers, remove the hook, it is | 1568 | ;; This test is cvs-string-prefix-p |
| 1586 | ;; not needed. | 1569 | (when (eq t (compare-strings file nil (length ddir) ddir nil nil)) |
| 1587 | (unless found-vc-dir-buf (remove-hook 'after-save-hook 'vc-dir-mark-buffer-changed))))) | 1570 | (let* |
| 1571 | ((file-short (substring file (length ddir))) | ||
| 1572 | (state | ||
| 1573 | (funcall (vc-client-object->file-to-state vc-client-mode) | ||
| 1574 | file)) | ||
| 1575 | (extra | ||
| 1576 | (funcall (vc-client-object->file-to-extra vc-client-mode) | ||
| 1577 | file)) | ||
| 1578 | (entry | ||
| 1579 | (list file-short state extra))) | ||
| 1580 | (vc-dir-update (list entry) status-buf)))))) | ||
| 1581 | ;; We didn't find any vc-dir buffers, remove the hook, it is | ||
| 1582 | ;; not needed. | ||
| 1583 | (unless found-vc-dir-buf (remove-hook 'after-save-hook 'vc-directory-resynch-file)))))) | ||
| 1588 | 1584 | ||
| 1589 | (defun vc-dir-mode (client-object) | 1585 | (defun vc-dir-mode (client-object) |
| 1590 | "Major mode for showing the VC status for a directory. | 1586 | "Major mode for showing the VC status for a directory. |
| @@ -1619,7 +1615,7 @@ U - if the cursor is on a file: unmark all the files with the same VC state | |||
| 1619 | (set (make-local-variable 'vc-ewoc) | 1615 | (set (make-local-variable 'vc-ewoc) |
| 1620 | (ewoc-create (vc-client-object->file-to-info client-object) | 1616 | (ewoc-create (vc-client-object->file-to-info client-object) |
| 1621 | (vc-client-object->headers client-object))) | 1617 | (vc-client-object->headers client-object))) |
| 1622 | (add-hook 'after-save-hook 'vc-dir-mark-buffer-changed) | 1618 | (add-hook 'after-save-hook 'vc-directory-resynch-file) |
| 1623 | ;; Make sure that if the VC status buffer is killed, the update | 1619 | ;; Make sure that if the VC status buffer is killed, the update |
| 1624 | ;; process running in the background is also killed. | 1620 | ;; process running in the background is also killed. |
| 1625 | (add-hook 'kill-buffer-query-functions 'vc-dir-kill-query nil t) | 1621 | (add-hook 'kill-buffer-query-functions 'vc-dir-kill-query nil t) |