changeset 95016:ebce6f4852ad

Move vc-dir menu hook back to vc-dispatcher.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Thu, 15 May 2008 13:50:55 +0000
parents 183ac8cfca91
children 7be06414cb71
files lisp/ChangeLog lisp/vc-dispatcher.el lisp/vc.el
diffstat 3 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu May 15 12:36:31 2008 +0000
+++ b/lisp/ChangeLog	Thu May 15 13:50:55 2008 +0000
@@ -3,6 +3,8 @@
 	* vc-dispatcher.el: Fix an incorrect buffer name and remove an
 	unneeded defalias.
 
+	* vc.el, vc-dispatcher.el (vc-dir-menu-map-filter): Moved.
+
 2008-05-15  Glenn Morris  <rgm@gnu.org>
 
 	* vc-hooks.el (vc-directory-resynch-file): Fix declaration.
--- a/lisp/vc-dispatcher.el	Thu May 15 12:36:31 2008 +0000
+++ b/lisp/vc-dispatcher.el	Thu May 15 13:50:55 2008 +0000
@@ -656,14 +656,16 @@
 				      file-to-info
 				      file-to-state 
 				      file-to-extra
-				      updater))
+				      updater
+				      extra-menu))
             (:conc-name vc-client-object->))
   name 
   headers
   file-to-info
   file-to-state 
   file-to-extra
-  updater)
+  updater
+  extra-menu)
 
 (defvar vc-ewoc nil)
 (defvar vc-dir-process-buffer nil
@@ -750,6 +752,19 @@
     map)
   "Menu for dispatcher status")
 
+;; This is used to that vlient modes can add mode-specific menu
+;; items to vc-dir-menu-map.
+(defun vc-dir-menu-map-filter (orig-binding)
+  (when (and (symbolp orig-binding) (fboundp orig-binding))
+    (setq orig-binding (indirect-function orig-binding)))
+  (let ((ext-binding
+	 (funcall (vc-client-object->extra-menu vc-client-mode))))
+    (if (null ext-binding)
+	orig-binding
+      (append orig-binding
+	      '("----")
+	      ext-binding))))
+
 (defvar vc-dir-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
@@ -781,7 +796,6 @@
     (define-key map [(down-mouse-3)] 'vc-dir-menu)
     (define-key map [(mouse-2)] 'vc-dir-toggle-mark)
 
-    ;; FIXME: Calls back into vc.el
     ;; Hook up the menu.
     (define-key map [menu-bar vc-dir-mode]
       '(menu-item
--- a/lisp/vc.el	Thu May 15 12:36:31 2008 +0000
+++ b/lisp/vc.el	Thu May 15 13:50:55 2008 +0000
@@ -1836,20 +1836,6 @@
 (defun vc-default-extra-status-menu (backend)
   nil)
 
-;; This is used to that VC backends could add backend specific menu
-;; items to vc-dir-menu-map.
-(defun vc-dir-menu-map-filter (orig-binding)
-  (when (and (symbolp orig-binding) (fboundp orig-binding))
-    (setq orig-binding (indirect-function orig-binding)))
-  (let ((ext-binding
-	 (vc-call-backend (vc-responsible-backend default-directory)
-			  'extra-status-menu)))
-    (if (null ext-binding)
-	orig-binding
-      (append orig-binding
-	      '("----")
-	      ext-binding))))
-
 (defun vc-dir-refresh-files (files default-state)
   "Refresh some files in the VC status buffer."
   (let ((backend (vc-responsible-backend default-directory))
@@ -1978,6 +1964,9 @@
   (let ((backend (vc-responsible-backend dir)))
     (vc-dir-headers backend dir)))
 
+(defun vc-dir-extra-menu ()
+  (vc-call-backend (vc-responsible-backend default-directory) 'extra-status-menu))
+
 (defun vc-make-backend-object (file-or-dir)
   "Create the backend capability object needed by vc-dispatcher."
   (vc-create-client-object 
@@ -1987,7 +1976,8 @@
    #'vc-generic-status-printer
    #'vc-generic-state
    #'vc-generic-status-fileinfo-extra
-   #'vc-dir-refresh))
+   #'vc-dir-refresh
+   #'vc-dir-extra-menu))
 
 ;;;###autoload
 (defun vc-dir (dir)