Mercurial > emacs
changeset 82499:3ecf9562ce0b
(vc-menu-entry): New var.
(vc-mode-line-map): Use it so that this menu also uses the extra-menu.
(menu-bar-tools-menu): Add the VC menu here rather than in menu-bar.el.
(vc-menu-map): Declare and initialize in one step.
(vc-menu-map-filter): Move&rename from menu-bar.el:menu-bar-vc-filter
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 21 Aug 2007 15:07:36 +0000 |
parents | e80c1b8b7d58 |
children | 029c5ed25e99 |
files | lisp/ChangeLog lisp/vc-hooks.el |
diffstat | 2 files changed, 63 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Aug 21 12:15:37 2007 +0000 +++ b/lisp/ChangeLog Tue Aug 21 15:07:36 2007 +0000 @@ -1,3 +1,11 @@ +2007-08-21 Stefan Monnier <monnier@iro.umontreal.ca> + + * vc-hooks.el (vc-menu-entry): New var. + (vc-mode-line-map): Use it so that this menu also uses the extra-menu. + (menu-bar-tools-menu): Add the VC menu here rather than in menu-bar.el. + (vc-menu-map): Declare and initialize in one step. + (vc-menu-map-filter): Move&rename from menu-bar.el:menu-bar-vc-filter + 2007-08-20 Stefan Monnier <monnier@iro.umontreal.ca> * smerge-mode.el (smerge-resolve): New arg `safe'.
--- a/lisp/vc-hooks.el Tue Aug 21 12:15:37 2007 +0000 +++ b/lisp/vc-hooks.el Tue Aug 21 15:07:36 2007 +0000 @@ -719,9 +719,19 @@ ;; any VC Dired buffer to synchronize. (vc-dired-resynch-file file))))) +(defvar vc-menu-entry + '(menu-item "Version Control" vc-menu-map + :filter vc-menu-map-filter)) + +(when (boundp 'menu-bar-tools-menu) + ;; We do not need to worry here about the placement of this entry + ;; because menu-bar.el has already created the proper spot for us + ;; and this will simply use it. + (define-key menu-bar-tools-menu [vc] vc-menu-entry)) + (defconst vc-mode-line-map (let ((map (make-sparse-keymap))) - (define-key map [mode-line down-mouse-1] 'vc-menu-map) + (define-key map [mode-line down-mouse-1] vc-menu-entry) map)) (defun vc-mode-line (file) @@ -918,36 +928,50 @@ (fset 'vc-prefix-map vc-prefix-map) (define-key global-map "\C-xv" 'vc-prefix-map) -(if (not (boundp 'vc-menu-map)) - ;; Don't do the menu bindings if menu-bar.el wasn't loaded to defvar - ;; vc-menu-map. - () - ;;(define-key vc-menu-map [show-files] - ;; '("Show Files under VC" . (vc-directory t))) - (define-key vc-menu-map [vc-retrieve-snapshot] - '("Retrieve Snapshot" . vc-retrieve-snapshot)) - (define-key vc-menu-map [vc-create-snapshot] - '("Create Snapshot" . vc-create-snapshot)) - (define-key vc-menu-map [vc-directory] '("VC Directory Listing" . vc-directory)) - (define-key vc-menu-map [separator1] '("----")) - (define-key vc-menu-map [vc-annotate] '("Annotate" . vc-annotate)) - (define-key vc-menu-map [vc-rename-file] '("Rename File" . vc-rename-file)) - (define-key vc-menu-map [vc-version-other-window] - '("Show Other Version" . vc-version-other-window)) - (define-key vc-menu-map [vc-diff] '("Compare with Base Version" . vc-diff)) - (define-key vc-menu-map [vc-update-change-log] - '("Update ChangeLog" . vc-update-change-log)) - (define-key vc-menu-map [vc-print-log] '("Show History" . vc-print-log)) - (define-key vc-menu-map [separator2] '("----")) - (define-key vc-menu-map [vc-insert-header] - '("Insert Header" . vc-insert-headers)) - (define-key vc-menu-map [undo] '("Undo Last Check-In" . vc-rollback)) - (define-key vc-menu-map [vc-revert] - '("Revert to Base Version" . vc-revert)) - (define-key vc-menu-map [vc-update] - '("Update to Latest Version" . vc-update)) - (define-key vc-menu-map [vc-next-action] '("Check In/Out" . vc-next-action)) - (define-key vc-menu-map [vc-register] '("Register" . vc-register))) +(defvar vc-menu-map + (let ((map (make-sparse-keymap "Version Control"))) + ;;(define-key map [show-files] + ;; '("Show Files under VC" . (vc-directory t))) + (define-key map [vc-retrieve-snapshot] + '("Retrieve Snapshot" . vc-retrieve-snapshot)) + (define-key map [vc-create-snapshot] + '("Create Snapshot" . vc-create-snapshot)) + (define-key map [vc-directory] '("VC Directory Listing" . vc-directory)) + (define-key map [separator1] '("----")) + (define-key map [vc-annotate] '("Annotate" . vc-annotate)) + (define-key map [vc-rename-file] '("Rename File" . vc-rename-file)) + (define-key map [vc-version-other-window] + '("Show Other Version" . vc-version-other-window)) + (define-key map [vc-diff] '("Compare with Base Version" . vc-diff)) + (define-key map [vc-update-change-log] + '("Update ChangeLog" . vc-update-change-log)) + (define-key map [vc-print-log] '("Show History" . vc-print-log)) + (define-key map [separator2] '("----")) + (define-key map [vc-insert-header] + '("Insert Header" . vc-insert-headers)) + (define-key map [undo] '("Undo Last Check-In" . vc-rollback)) + (define-key map [vc-revert] + '("Revert to Base Version" . vc-revert)) + (define-key map [vc-update] + '("Update to Latest Version" . vc-update)) + (define-key map [vc-next-action] '("Check In/Out" . vc-next-action)) + (define-key map [vc-register] '("Register" . vc-register)) + map)) + +(defalias 'vc-menu-map vc-menu-map) + +(defun vc-menu-map-filter (orig-binding) + (if (and (symbolp orig-binding) (fboundp orig-binding)) + (setq orig-binding (indirect-function orig-binding))) + (let ((ext-binding + (if vc-mode (vc-call-backend (vc-backend buffer-file-name) 'extra-menu)))) + ;; Give the VC backend a chance to add menu entries + ;; specific for that backend. + (if (null ext-binding) + orig-binding + (append orig-binding + '((ext-menu-separator "---")) + ext-binding)))) (defun vc-default-extra-menu (backend) nil)