]> git.eshelyaron.com Git - emacs.git/commitdiff
* vc.el: Document new VC operation `extra-menu'.
authorDan Nicolaescu <dann@ics.uci.edu>
Wed, 1 Aug 2007 17:13:45 +0000 (17:13 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Wed, 1 Aug 2007 17:13:45 +0000 (17:13 +0000)
* 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.

etc/NEWS
lisp/ChangeLog
lisp/menu-bar.el
lisp/vc-hooks.el
lisp/vc.el

index 09877e9518c7f53ce333a467dad78d29ce12203b..f56a7a0bf0cfd78ef868dbf46b0fe100a06bdb46 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -96,6 +96,9 @@ considered for update.
 
 *** 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.
index dd1f8eeb22a1dc69f826a2860afb50c42ee39e5a..123c2cdc47907467601b74e079b10479477610e4 100644 (file)
@@ -1,3 +1,13 @@
+2007-08-01  Dan Nicolaescu  <dann@ics.uci.edu>
+           Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * 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  <rgm@gnu.org>
 
        * progmodes/fortran.el: Remove leading `*' from all defcustom doc
index d9f6405cf57993f2de51e6e8d81d29928c95db8a..6b57976368926c9d434d4bfb54f66c9c5d6cfbbf 100644 (file)
@@ -1165,7 +1165,19 @@ mail status in mode line"))
 (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]
   '("--"))
index a8b6297caa2d458e106bbb689096a9edc3e90b96..18083f22e05d7bb0c1d380e6aa1ecd6d4e85b8d6 100644 (file)
@@ -950,6 +950,9 @@ Used in `find-file-not-found-functions'."
   (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.
index 5030fb6447122345d698d7c69918f0cb39895856..78e098d874ffb12b51903add0c4c516babec4d23 100644 (file)
 ;;
 ;;   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.
 ;;
 ;;
 ;;   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: