diff lisp/menu-bar.el @ 82232:58ac5a791dfa

* vc.el: Document new VC operation `extra-menu'. * vc-hooks.el (vc-default-extra-menu): New function. * menu-bar.el (menu-bar-vc-filter): New function. (menu-bar-tools-menu): Use it as a filter.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 01 Aug 2007 17:13:45 +0000
parents b98604865ea0
children b8c796068320 b210fca2fe6e 35e3789db058
line wrap: on
line diff
--- a/lisp/menu-bar.el	Wed Aug 01 09:16:24 2007 +0000
+++ b/lisp/menu-bar.el	Wed Aug 01 17:13:45 2007 +0000
@@ -1165,7 +1165,19 @@
 (define-key menu-bar-tools-menu [pcl-cvs]
   '(menu-item "PCL-CVS" cvs-global-menu))
 (define-key menu-bar-tools-menu [vc]
-  (list 'menu-item "Version Control" vc-menu-map))
+  (list 'menu-item "Version Control" vc-menu-map
+  :filter 'menu-bar-vc-filter))
+
+(defun menu-bar-vc-filter (orig-binding)
+  (let ((ext-binding
+   (if vc-mode (vc-call 'extra-menu buffer-file-name))))
+    ;; 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))))
 
 (define-key menu-bar-tools-menu [separator-compare]
   '("--"))