From 64db3a90334d2677af6ee8a9af24ee4fb8ace143 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 6 Mar 2008 10:58:48 +0000 Subject: [PATCH] (vc-status-tool-bar-map, vc-status-toggle-mark-file) (vc-status-toggle-mark): New functions. (vc-status-mode): Set tool bar map. --- lisp/vc.el | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/lisp/vc.el b/lisp/vc.el index ab9277a35f1..57bc379035d 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -616,6 +616,8 @@ (require 'vc-hooks) (require 'ring) +(require 'tool-bar) + (eval-when-compile (require 'cl) (require 'compile) @@ -2734,7 +2736,7 @@ With prefix arg READ-SWITCHES, specify a value to override :help "Move to the previous line and unmark the file")) (define-key map [mark-all] - '(menu-item "Marl All" vc-status-mark-all-files + '(menu-item "Mark All" vc-status-mark-all-files :help "Mark all files that are in the same state as the current file\ \nWith prefix argument mark all files")) (define-key map [unmark] @@ -2743,7 +2745,7 @@ With prefix arg READ-SWITCHES, specify a value to override (define-key map [mark] '(menu-item "Mark" vc-status-mark - :help "Mark the current file or all files in the region")) + :help "Mark the current file or all files in the region")) (define-key map [separator-open] '("--")) (define-key map [open-other] @@ -2815,6 +2817,29 @@ With prefix arg READ-SWITCHES, specify a value to override (interactive "e") (popup-menu vc-status-menu-map e)) +(defun vc-status-tool-bar-map () + (if (display-graphic-p) + (let ((map (make-sparse-keymap))) + (tool-bar-local-item-from-menu 'vc-status-find-file "open" + map vc-status-mode-map) + (tool-bar-local-item "bookmark_add" + 'vc-status-toggle-mark 'vc-status-toggle-mark map + :help "Toggle mark on current item") + (tool-bar-local-item-from-menu 'vc-status-previous-line "left-arrow" + map vc-status-mode-map + :rtl "right-arrow") + (tool-bar-local-item-from-menu 'vc-status-next-line "right-arrow" + map vc-status-mode-map + :rtl "left-arrow") + (tool-bar-local-item-from-menu 'vc-status-refresh "refresh" + map vc-status-mode-map) + (tool-bar-local-item-from-menu 'nonincremental-search-forward + "search" map) + (tool-bar-local-item-from-menu 'bury-buffer "exit" + map vc-status-mode-map) + map))) + + (defvar vc-status-process-buffer nil "The buffer used for the asynchronous call that computes the VC status.") @@ -2829,6 +2854,7 @@ With prefix arg READ-SWITCHES, specify a value to override (setq buffer-read-only t) (set (make-local-variable 'vc-status-crt-marked) nil) (use-local-map vc-status-mode-map) + (set (make-local-variable 'tool-bar-map) (vc-status-tool-bar-map)) (let ((buffer-read-only nil) (backend (vc-responsible-backend default-directory)) entries) @@ -3016,6 +3042,17 @@ that share the same state." t)) vc-status)))) +(defun vc-status-toggle-mark-file () + (let* ((crt (ewoc-locate vc-status)) + (file (ewoc-data crt))) + (if (vc-status-fileinfo->marked file) + (vc-status-unmark-file) + (vc-status-mark-file)))) + +(defun vc-status-toggle-mark () + (interactive) + (vc-status-mark-unmark 'toggle-mark-file)) + (defun vc-status-register () "Register the marked files, or the current file if no marks." (interactive) -- 2.39.2