diff options
| author | Stefan Monnier | 2007-08-21 15:07:36 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-08-21 15:07:36 +0000 |
| commit | e2247dc840eaa671f4b13df9772c1497038d1f9f (patch) | |
| tree | 9f46dd9d92fc18c94bbdf68acf12cc7c786a3fe8 | |
| parent | 19c35c57186c38455004452626d597239f667a55 (diff) | |
| download | emacs-e2247dc840eaa671f4b13df9772c1497038d1f9f.tar.gz emacs-e2247dc840eaa671f4b13df9772c1497038d1f9f.zip | |
(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
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/vc-hooks.el | 86 |
2 files changed, 63 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 028fe5d2db5..11703054d4f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2007-08-21 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc-hooks.el (vc-menu-entry): New var. | ||
| 4 | (vc-mode-line-map): Use it so that this menu also uses the extra-menu. | ||
| 5 | (menu-bar-tools-menu): Add the VC menu here rather than in menu-bar.el. | ||
| 6 | (vc-menu-map): Declare and initialize in one step. | ||
| 7 | (vc-menu-map-filter): Move&rename from menu-bar.el:menu-bar-vc-filter | ||
| 8 | |||
| 1 | 2007-08-20 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2007-08-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * smerge-mode.el (smerge-resolve): New arg `safe'. | 11 | * smerge-mode.el (smerge-resolve): New arg `safe'. |
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index aa121457a40..62719124fd9 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -719,9 +719,19 @@ Before doing that, check if there are any old backups and get rid of them." | |||
| 719 | ;; any VC Dired buffer to synchronize. | 719 | ;; any VC Dired buffer to synchronize. |
| 720 | (vc-dired-resynch-file file))))) | 720 | (vc-dired-resynch-file file))))) |
| 721 | 721 | ||
| 722 | (defvar vc-menu-entry | ||
| 723 | '(menu-item "Version Control" vc-menu-map | ||
| 724 | :filter vc-menu-map-filter)) | ||
| 725 | |||
| 726 | (when (boundp 'menu-bar-tools-menu) | ||
| 727 | ;; We do not need to worry here about the placement of this entry | ||
| 728 | ;; because menu-bar.el has already created the proper spot for us | ||
| 729 | ;; and this will simply use it. | ||
| 730 | (define-key menu-bar-tools-menu [vc] vc-menu-entry)) | ||
| 731 | |||
| 722 | (defconst vc-mode-line-map | 732 | (defconst vc-mode-line-map |
| 723 | (let ((map (make-sparse-keymap))) | 733 | (let ((map (make-sparse-keymap))) |
| 724 | (define-key map [mode-line down-mouse-1] 'vc-menu-map) | 734 | (define-key map [mode-line down-mouse-1] vc-menu-entry) |
| 725 | map)) | 735 | map)) |
| 726 | 736 | ||
| 727 | (defun vc-mode-line (file) | 737 | (defun vc-mode-line (file) |
| @@ -918,36 +928,50 @@ Used in `find-file-not-found-functions'." | |||
| 918 | (fset 'vc-prefix-map vc-prefix-map) | 928 | (fset 'vc-prefix-map vc-prefix-map) |
| 919 | (define-key global-map "\C-xv" 'vc-prefix-map) | 929 | (define-key global-map "\C-xv" 'vc-prefix-map) |
| 920 | 930 | ||
| 921 | (if (not (boundp 'vc-menu-map)) | 931 | (defvar vc-menu-map |
| 922 | ;; Don't do the menu bindings if menu-bar.el wasn't loaded to defvar | 932 | (let ((map (make-sparse-keymap "Version Control"))) |
| 923 | ;; vc-menu-map. | 933 | ;;(define-key map [show-files] |
| 924 | () | 934 | ;; '("Show Files under VC" . (vc-directory t))) |
| 925 | ;;(define-key vc-menu-map [show-files] | 935 | (define-key map [vc-retrieve-snapshot] |
| 926 | ;; '("Show Files under VC" . (vc-directory t))) | 936 | '("Retrieve Snapshot" . vc-retrieve-snapshot)) |
| 927 | (define-key vc-menu-map [vc-retrieve-snapshot] | 937 | (define-key map [vc-create-snapshot] |
| 928 | '("Retrieve Snapshot" . vc-retrieve-snapshot)) | 938 | '("Create Snapshot" . vc-create-snapshot)) |
| 929 | (define-key vc-menu-map [vc-create-snapshot] | 939 | (define-key map [vc-directory] '("VC Directory Listing" . vc-directory)) |
| 930 | '("Create Snapshot" . vc-create-snapshot)) | 940 | (define-key map [separator1] '("----")) |
| 931 | (define-key vc-menu-map [vc-directory] '("VC Directory Listing" . vc-directory)) | 941 | (define-key map [vc-annotate] '("Annotate" . vc-annotate)) |
| 932 | (define-key vc-menu-map [separator1] '("----")) | 942 | (define-key map [vc-rename-file] '("Rename File" . vc-rename-file)) |
| 933 | (define-key vc-menu-map [vc-annotate] '("Annotate" . vc-annotate)) | 943 | (define-key map [vc-version-other-window] |
| 934 | (define-key vc-menu-map [vc-rename-file] '("Rename File" . vc-rename-file)) | 944 | '("Show Other Version" . vc-version-other-window)) |
| 935 | (define-key vc-menu-map [vc-version-other-window] | 945 | (define-key map [vc-diff] '("Compare with Base Version" . vc-diff)) |
| 936 | '("Show Other Version" . vc-version-other-window)) | 946 | (define-key map [vc-update-change-log] |
| 937 | (define-key vc-menu-map [vc-diff] '("Compare with Base Version" . vc-diff)) | 947 | '("Update ChangeLog" . vc-update-change-log)) |
| 938 | (define-key vc-menu-map [vc-update-change-log] | 948 | (define-key map [vc-print-log] '("Show History" . vc-print-log)) |
| 939 | '("Update ChangeLog" . vc-update-change-log)) | 949 | (define-key map [separator2] '("----")) |
| 940 | (define-key vc-menu-map [vc-print-log] '("Show History" . vc-print-log)) | 950 | (define-key map [vc-insert-header] |
| 941 | (define-key vc-menu-map [separator2] '("----")) | 951 | '("Insert Header" . vc-insert-headers)) |
| 942 | (define-key vc-menu-map [vc-insert-header] | 952 | (define-key map [undo] '("Undo Last Check-In" . vc-rollback)) |
| 943 | '("Insert Header" . vc-insert-headers)) | 953 | (define-key map [vc-revert] |
| 944 | (define-key vc-menu-map [undo] '("Undo Last Check-In" . vc-rollback)) | 954 | '("Revert to Base Version" . vc-revert)) |
| 945 | (define-key vc-menu-map [vc-revert] | 955 | (define-key map [vc-update] |
| 946 | '("Revert to Base Version" . vc-revert)) | 956 | '("Update to Latest Version" . vc-update)) |
| 947 | (define-key vc-menu-map [vc-update] | 957 | (define-key map [vc-next-action] '("Check In/Out" . vc-next-action)) |
| 948 | '("Update to Latest Version" . vc-update)) | 958 | (define-key map [vc-register] '("Register" . vc-register)) |
| 949 | (define-key vc-menu-map [vc-next-action] '("Check In/Out" . vc-next-action)) | 959 | map)) |
| 950 | (define-key vc-menu-map [vc-register] '("Register" . vc-register))) | 960 | |
| 961 | (defalias 'vc-menu-map vc-menu-map) | ||
| 962 | |||
| 963 | (defun vc-menu-map-filter (orig-binding) | ||
| 964 | (if (and (symbolp orig-binding) (fboundp orig-binding)) | ||
| 965 | (setq orig-binding (indirect-function orig-binding))) | ||
| 966 | (let ((ext-binding | ||
| 967 | (if vc-mode (vc-call-backend (vc-backend buffer-file-name) 'extra-menu)))) | ||
| 968 | ;; Give the VC backend a chance to add menu entries | ||
| 969 | ;; specific for that backend. | ||
| 970 | (if (null ext-binding) | ||
| 971 | orig-binding | ||
| 972 | (append orig-binding | ||
| 973 | '((ext-menu-separator "---")) | ||
| 974 | ext-binding)))) | ||
| 951 | 975 | ||
| 952 | (defun vc-default-extra-menu (backend) | 976 | (defun vc-default-extra-menu (backend) |
| 953 | nil) | 977 | nil) |