Mercurial > emacs
comparison lisp/vc.el @ 92093:a0193ceeaa83
* vc.el (vc-exec-after): Move setting mode-line-process in the
busy case ...
(vc-set-mode-line-busy-indicator): ... in this new function.
(vc-status-refresh): Call vc-set-mode-line-busy-indicator.
(vc-update-vc-status-buffer): Reset mode-line-process.
(vc-status-mark-all-files, vc-status-unmark-all-files): Change to
mark/unmark all the files with the same state as the current one.
With a prefix argument mark/unmark all files.
(vc-status-mode-menu): Adjust strings.
(vc-update-vc-status-buffer): Only do something when the argument
is not nil.
(vc-status-kill-dir-status-process): New function.
(vc-status-mode-map): Bind it.
(vc-status-process-buffer): New variable.
(vc-status-mode): Make it local.
(vc-status-refresh): Set it.
* vc-hg.el (vc-hg-dir-status):
* vc-git.el (vc-git-dir-status):
* vc-svn.el (vc-svn-dir-status): Return the buffer in which the
command is run.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Fri, 22 Feb 2008 07:44:08 +0000 |
parents | f6aa0a65fa82 |
children | 74bf6df13b6c |
comparison
equal
deleted
inserted
replaced
92092:cb361bd1b322 | 92093:a0193ceeaa83 |
---|---|
172 ;; Produce RESULT: a list of conses of the form (file . vc-state) | 172 ;; Produce RESULT: a list of conses of the form (file . vc-state) |
173 ;; for the files in DIR. If a command needs to be run to compute | 173 ;; for the files in DIR. If a command needs to be run to compute |
174 ;; this list, it should be run asynchronously. When RESULT is | 174 ;; this list, it should be run asynchronously. When RESULT is |
175 ;; computed, it should be passed back by doing: | 175 ;; computed, it should be passed back by doing: |
176 ;; (funcall UPDATE-FUNCTION RESULT STATUS-BUFFER) | 176 ;; (funcall UPDATE-FUNCTION RESULT STATUS-BUFFER) |
177 ;; Return the buffer used for the asynchronous call. This buffer | |
178 ;; is used to kill the status update process on demand. | |
177 ;; This function is used by vc-status, a replacement for vc-dired. | 179 ;; This function is used by vc-status, a replacement for vc-dired. |
178 ;; vc-status is still under development, and is NOT feature | 180 ;; vc-status is still under development, and is NOT feature |
179 ;; complete. As such, the requirements for this function might | 181 ;; complete. As such, the requirements for this function might |
180 ;; change. | 182 ;; change. |
181 ;; This is a replacement for dir-state. | 183 ;; This is a replacement for dir-state. |
2713 ;; The remainder. | 2715 ;; The remainder. |
2714 (define-key map "f" 'vc-status-find-file) | 2716 (define-key map "f" 'vc-status-find-file) |
2715 (define-key map "o" 'vc-status-find-file-other-window) | 2717 (define-key map "o" 'vc-status-find-file-other-window) |
2716 (define-key map "q" 'bury-buffer) | 2718 (define-key map "q" 'bury-buffer) |
2717 (define-key map "g" 'vc-status-refresh) | 2719 (define-key map "g" 'vc-status-refresh) |
2720 (define-key map "\C-c\C-c" 'vc-status-kill-dir-status-process) | |
2718 ;; Not working yet. Functions like vc-status-find-file need to | 2721 ;; Not working yet. Functions like vc-status-find-file need to |
2719 ;; find the file from the mouse position, not `point'. | 2722 ;; find the file from the mouse position, not `point'. |
2720 ;; (define-key map [(down-mouse-3)] 'vc-status-menu) | 2723 ;; (define-key map [(down-mouse-3)] 'vc-status-menu) |
2721 map) | 2724 map) |
2722 "Keymap for VC status") | 2725 "Keymap for VC status") |
2783 (defun vc-status-menu (e) | 2786 (defun vc-status-menu (e) |
2784 "Popup the VC status menu." | 2787 "Popup the VC status menu." |
2785 (interactive "e") | 2788 (interactive "e") |
2786 (popup-menu vc-status-mode-menu e)) | 2789 (popup-menu vc-status-mode-menu e)) |
2787 | 2790 |
2791 (defvar vc-status-process-buffer nil | |
2792 "The buffer used for the asynchronous call that computes the VC status.") | |
2793 | |
2788 (defun vc-status-mode () | 2794 (defun vc-status-mode () |
2789 "Major mode for VC status. | 2795 "Major mode for VC status. |
2790 \\{vc-status-mode-map}" | 2796 \\{vc-status-mode-map}" |
2791 (setq mode-name "*VC Status*") | 2797 (setq mode-name "*VC Status*") |
2792 (setq major-mode 'vc-status-mode) | 2798 (setq major-mode 'vc-status-mode) |
2794 (use-local-map vc-status-mode-map) | 2800 (use-local-map vc-status-mode-map) |
2795 (let ((buffer-read-only nil) | 2801 (let ((buffer-read-only nil) |
2796 (backend (vc-responsible-backend default-directory)) | 2802 (backend (vc-responsible-backend default-directory)) |
2797 entries) | 2803 entries) |
2798 (erase-buffer) | 2804 (erase-buffer) |
2805 (set (make-local-variable 'vc-status-process-buffer) nil) | |
2799 (set (make-local-variable 'vc-status) | 2806 (set (make-local-variable 'vc-status) |
2800 (ewoc-create #'vc-status-printer | 2807 (ewoc-create #'vc-status-printer |
2801 (vc-status-headers backend default-directory))) | 2808 (vc-status-headers backend default-directory))) |
2802 (vc-status-refresh))) | 2809 (vc-status-refresh))) |
2803 | 2810 |
2804 (put 'vc-status-mode 'mode-class 'special) | 2811 (put 'vc-status-mode 'mode-class 'special) |
2805 | 2812 |
2806 (defun vc-update-vc-status-buffer (entries buffer) | 2813 (defun vc-update-vc-status-buffer (entries buffer) |
2807 (with-current-buffer buffer | 2814 (with-current-buffer buffer |
2808 (dolist (entry entries) | 2815 (when entries |
2809 (ewoc-enter-last vc-status | 2816 (dolist (entry entries) |
2810 (vc-status-create-fileinfo (cdr entry) (car entry)))) | 2817 (ewoc-enter-last vc-status |
2811 (ewoc-goto-node vc-status (ewoc-nth vc-status 0)) | 2818 (vc-status-create-fileinfo (cdr entry) (car entry)))) |
2819 (ewoc-goto-node vc-status (ewoc-nth vc-status 0))) | |
2812 (setq mode-line-process nil))) | 2820 (setq mode-line-process nil))) |
2813 | 2821 |
2814 (defun vc-status-refresh () | 2822 (defun vc-status-refresh () |
2815 "Refresh the contents of the VC status buffer." | 2823 "Refresh the contents of the VC status buffer." |
2816 (interactive) | 2824 (interactive) |
2820 (vc-set-mode-line-busy-indicator) | 2828 (vc-set-mode-line-busy-indicator) |
2821 ;; Call the dir-status backend function. dir-status is supposed to | 2829 ;; Call the dir-status backend function. dir-status is supposed to |
2822 ;; be asynchronous. It should compute the results and call the | 2830 ;; be asynchronous. It should compute the results and call the |
2823 ;; function passed as a an arg to update the vc-status buffer with | 2831 ;; function passed as a an arg to update the vc-status buffer with |
2824 ;; the results. | 2832 ;; the results. |
2825 (vc-call-backend | 2833 (setq vc-status-process-buffer |
2826 backend 'dir-status default-directory | 2834 (vc-call-backend |
2827 #'vc-update-vc-status-buffer (current-buffer)))) | 2835 backend 'dir-status default-directory |
2836 #'vc-update-vc-status-buffer (current-buffer))))) | |
2837 | |
2838 (defun vc-status-kill-dir-status-process () | |
2839 "Kill the temporary buffer and associated process." | |
2840 (interactive) | |
2841 (when (and (bufferp vc-status-process-buffer) | |
2842 (buffer-live-p vc-status-process-buffer)) | |
2843 (let ((proc (get-buffer-process vc-status-process-buffer))) | |
2844 (when proc (delete-process proc)) | |
2845 (setq mode-line-process nil)))) | |
2828 | 2846 |
2829 (defun vc-status-next-line (arg) | 2847 (defun vc-status-next-line (arg) |
2830 "Go to the next line. | 2848 "Go to the next line. |
2831 If a prefix argument is given, move by that many lines." | 2849 If a prefix argument is given, move by that many lines." |
2832 (interactive "p") | 2850 (interactive "p") |