Mercurial > emacs
changeset 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 | 729f4e76fd5d |
children | 337c5a70f4ca |
files | etc/NEWS lisp/ChangeLog lisp/menu-bar.el lisp/vc-hooks.el lisp/vc.el |
diffstat | 5 files changed, 40 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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 <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
--- 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] '("--"))
--- 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.
--- 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: