# HG changeset patch # User Dan Nicolaescu # Date 1185988425 0 # Node ID 58ac5a791dfa1094bcfa15be1ea99fbdaffd7fbe # Parent 729f4e76fd5d2db6090252fc3b84126d734103d2 * 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. diff -r 729f4e76fd5d -r 58ac5a791dfa etc/NEWS --- a/etc/NEWS Wed Aug 01 09:16:24 2007 +0000 +++ b/etc/NEWS Wed Aug 01 17:13:45 2007 +0000 @@ -96,6 +96,9 @@ *** The VC mode-line entry now has a tooltip. +*** VC backends can provide extra menu entries to be added to the "Version Control" menu. +This can be used to add menu entries for backend specific functions. + *** VC has some support for Bazaar (bzr). ** sgml-electric-tag-pair-mode lets you simultaneously edit matched tag pairs. diff -r 729f4e76fd5d -r 58ac5a791dfa lisp/ChangeLog --- a/lisp/ChangeLog Wed Aug 01 09:16:24 2007 +0000 +++ b/lisp/ChangeLog Wed Aug 01 17:13:45 2007 +0000 @@ -1,3 +1,13 @@ +2007-08-01 Dan Nicolaescu + Stefan Monnier + + * 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. + 2007-08-01 Glenn Morris * progmodes/fortran.el: Remove leading `*' from all defcustom doc diff -r 729f4e76fd5d -r 58ac5a791dfa lisp/menu-bar.el --- 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] '("--")) diff -r 729f4e76fd5d -r 58ac5a791dfa lisp/vc-hooks.el --- a/lisp/vc-hooks.el Wed Aug 01 09:16:24 2007 +0000 +++ b/lisp/vc-hooks.el Wed Aug 01 17:13:45 2007 +0000 @@ -950,6 +950,9 @@ (define-key vc-menu-map [vc-next-action] '("Check In/Out" . vc-next-action)) (define-key vc-menu-map [vc-register] '("Register" . vc-register))) +(defun vc-default-extra-menu (backend) + nil) + ;; These are not correct and it's not currently clear how doing it ;; better (with more complicated expressions) might slow things down ;; on older systems. diff -r 729f4e76fd5d -r 58ac5a791dfa lisp/vc.el --- a/lisp/vc.el Wed Aug 01 09:16:24 2007 +0000 +++ b/lisp/vc.el Wed Aug 01 17:13:45 2007 +0000 @@ -387,7 +387,7 @@ ;; ;; Only required if `annotate-command' is defined for the backend, ;; AND you'd like the current time considered to be anything besides -;; (vs-annotate-convert-time (current-time)) -- i.e. the current +;; (vc-annotate-convert-time (current-time)) -- i.e. the current ;; time with hours, minutes, and seconds included. Probably safe to ;; ignore. Return the current-time, in units of fractional days. ;; @@ -480,11 +480,20 @@ ;; ;; Operation called in current buffer when opening a file. This can ;; be used by the backend to setup some local variables it might need. -; +;; ;; - find-file-not-found-hook () ;; ;; Operation called in current buffer when opening a non-existing file. ;; By default, this asks the user if she wants to check out the file. +;; +;; - extra-menu () +;; +;; Return a menu keymap, the items in the keymap will appear at the +;; end of the Version Control menu. The goal is to allow backends +;; to specify extra menu items that appear in the VC menu. This way +;; you can provide menu entries for functionality that is specific +;; to your backend and which does not map to any of the VC generic +;; concepts. ;;; Code: