comparison lisp/vc-dispatcher.el @ 94695:f46fc59d6e9e

More refactoring.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Tue, 06 May 2008 19:12:34 +0000
parents 891cb8f8888f
children 8983ac9b89b4
comparison
equal deleted inserted replaced
94694:cc771c0403a4 94695:f46fc59d6e9e
850 (push buffer result))))) 850 (push buffer result)))))
851 (nreverse result))) 851 (nreverse result)))
852 852
853 (defun vc-directory-resynch-file (file) 853 (defun vc-directory-resynch-file (file)
854 "Update the entries for FILE in any VC Dired buffers that list it." 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)))) 855 (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file))))
857 (when buffers 856 (when buffers
858 (mapcar (lambda (buffer) 857 (mapcar (lambda (buffer)
859 (with-current-buffer buffer 858 (with-current-buffer buffer
860 (when (dired-goto-file file) 859 (when (dired-goto-file file)
1011 '(menu-item "Open in other window" vc-dir-find-file-other-window 1010 '(menu-item "Open in other window" vc-dir-find-file-other-window
1012 :help "Find the file on the current line, in another window")) 1011 :help "Find the file on the current line, in another window"))
1013 (define-key map [open] 1012 (define-key map [open]
1014 '(menu-item "Open file" vc-dir-find-file 1013 '(menu-item "Open file" vc-dir-find-file
1015 :help "Find the file on the current line")) 1014 :help "Find the file on the current line"))
1016 ;; FIXME: Stuff starting here should be appended by vc
1017 ;; VC info details
1018 (define-key map [sepvcdet] '("--"))
1019 (define-key map [remup]
1020 '(menu-item "Hide up-to-date" vc-dir-hide-up-to-date
1021 :help "Hide up-to-date items from display"))
1022 ;; FIXME: This needs a key binding. And maybe a better name
1023 ;; ("Insert" like PCL-CVS uses does not sound that great either)...
1024 (define-key map [ins]
1025 '(menu-item "Show File" vc-dir-show-fileentry
1026 :help "Show a file in the VC status listing even though it might be up to date"))
1027 (define-key map [annotate]
1028 '(menu-item "Annotate" vc-annotate
1029 :help "Display the edit history of the current file using colors"))
1030 (define-key map [diff]
1031 '(menu-item "Compare with Base Version" vc-diff
1032 :help "Compare file set with the base version"))
1033 (define-key map [log]
1034 '(menu-item "Show history" vc-print-log
1035 :help "List the change log of the current file set in a window"))
1036 ;; VC commands.
1037 (define-key map [sepvccmd] '("--"))
1038 (define-key map [update]
1039 '(menu-item "Update to latest version" vc-update
1040 :help "Update the current fileset's files to their tip revisions"))
1041 (define-key map [revert]
1042 '(menu-item "Revert to base version" vc-revert
1043 :help "Revert working copies of the selected fileset to their repository contents."))
1044 (define-key map [next-action]
1045 ;; FIXME: This really really really needs a better name!
1046 ;; And a key binding too.
1047 '(menu-item "Check In/Out" vc-next-action
1048 :help "Do the next logical version control operation on the current fileset"))
1049 (define-key map [register]
1050 '(menu-item "Register" vc-dir-register
1051 :help "Register file set into the version control system"))
1052 map) 1015 map)
1053 "Menu for VC status") 1016 "Menu for VC status")
1054 1017
1055 (defalias 'vc-dir-menu-map vc-dir-menu-map) 1018 (defalias 'vc-dir-menu-map vc-dir-menu-map)
1056 1019
1077 (define-key map "q" 'quit-window) 1040 (define-key map "q" 'quit-window)
1078 (define-key map "g" 'vc-dir-refresh) 1041 (define-key map "g" 'vc-dir-refresh)
1079 (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process) 1042 (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process)
1080 (define-key map [(down-mouse-3)] 'vc-dir-menu) 1043 (define-key map [(down-mouse-3)] 'vc-dir-menu)
1081 (define-key map [(mouse-2)] 'vc-dir-toggle-mark) 1044 (define-key map [(mouse-2)] 'vc-dir-toggle-mark)
1082
1083 ;; FIXME: Calls back into vc.el
1084 ;; Hook up the menu.
1085 (define-key map [menu-bar vc-dir-mode]
1086 '(menu-item
1087 ;; This is used so that client modes can add mode-specific
1088 ;; menu items to vc-dir-menu-map.
1089 "VC Status" vc-dir-menu-map :filter vc-dir-menu-map-filter))
1090 map) 1045 map)
1091 "Keymap for VC status") 1046 "Keymap for VC dispatcher commands")
1092 1047
1093 (defmacro vc-at-event (event &rest body) 1048 (defmacro vc-at-event (event &rest body)
1094 "Evaluate `body' wich point located at event-start of `event'. 1049 "Evaluate `body' wich point located at event-start of `event'.
1095 If `body' uses `event', it should be a variable, 1050 If `body' uses `event', it should be a variable,
1096 otherwise it will be evaluated twice." 1051 otherwise it will be evaluated twice."
1102 ,@body)))) 1057 ,@body))))
1103 1058
1104 (defun vc-dir-menu (e) 1059 (defun vc-dir-menu (e)
1105 "Popup the VC status menu." 1060 "Popup the VC status menu."
1106 (interactive "e") 1061 (interactive "e")
1107 (vc-at-event e (popup-menu vc-dir-menu-map e))) 1062 (vc-at-event e (popup-menu right-menu-map e)))
1108 1063
1109 (defvar vc-dir-tool-bar-map 1064 (defvar vc-dir-tool-bar-map
1110 (let ((map (make-sparse-keymap))) 1065 (let ((map (make-sparse-keymap)))
1111 (tool-bar-local-item-from-menu 'vc-dir-find-file "open" 1066 (tool-bar-local-item-from-menu 'vc-dir-find-file "open"
1112 map vc-dir-mode-map) 1067 map vc-dir-mode-map)
1610 (setq mode-name (vc-client-object->name client-object)) 1565 (setq mode-name (vc-client-object->name client-object))
1611 (setq major-mode 'vc-dir-mode) 1566 (setq major-mode 'vc-dir-mode)
1612 (setq buffer-read-only t) 1567 (setq buffer-read-only t)
1613 (use-local-map vc-dir-mode-map) 1568 (use-local-map vc-dir-mode-map)
1614 (set (make-local-variable 'tool-bar-map) vc-dir-tool-bar-map) 1569 (set (make-local-variable 'tool-bar-map) vc-dir-tool-bar-map)
1570 (set (make-local-variable 'right-menu-map) vc-dir-menu-map)
1615 (set (make-local-variable 'vc-client-mode) client-object) 1571 (set (make-local-variable 'vc-client-mode) client-object)
1616 (let ((buffer-read-only nil)) 1572 (let ((buffer-read-only nil))
1617 (erase-buffer) 1573 (erase-buffer)
1618 (set (make-local-variable 'vc-dir-process-buffer) nil) 1574 (set (make-local-variable 'vc-dir-process-buffer) nil)
1619 (set (make-local-variable 'vc-ewoc) 1575 (set (make-local-variable 'vc-ewoc)