Mercurial > emacs
changeset 91951:d42fe75822fe
* vc.el (vc-status-menu, vc-status-menu-map-filter): New functions.
(vc-status-mode-menu): Add a :filter.
(vc-status-printer): Add faces.
* vc-hg.el (vc-hg-extra-status-menu): New function.
(vc-hg-dir-status): Clean up the buffer before using it.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Tue, 19 Feb 2008 07:10:33 +0000 |
parents | d758efc0f23f |
children | c63fbebcd19c |
files | lisp/ChangeLog lisp/vc-hg.el lisp/vc.el |
diffstat | 3 files changed, 61 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Feb 19 04:30:50 2008 +0000 +++ b/lisp/ChangeLog Tue Feb 19 07:10:33 2008 +0000 @@ -1,3 +1,12 @@ +2008-02-19 Dan Nicolaescu <dann@ics.uci.edu> + + * vc.el (vc-status-menu, vc-status-menu-map-filter): New functions. + (vc-status-mode-menu): Add a :filter. + (vc-status-printer): Add faces. + + * vc-hg.el (vc-hg-extra-status-menu): New function. + (vc-hg-dir-status): Clean up the buffer before using it. + 2008-02-19 Stefan Monnier <monnier@iro.umontreal.ca> * progmodes/gdb-ui.el (gdb-output-sink): Define with an invalid value.
--- a/lisp/vc-hg.el Tue Feb 19 04:30:50 2008 +0000 +++ b/lisp/vc-hg.el Tue Feb 19 07:10:33 2008 +0000 @@ -475,6 +475,10 @@ (defun vc-hg-extra-menu () vc-hg-extra-menu-map) +(defun vc-hg-extra-status-menu () + '(["Show incoming" vc-hg-incoming] + ["Show outgoing" vc-hg-outgoing]) + (define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing") (define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming") @@ -511,6 +515,7 @@ (with-current-buffer (get-buffer-create (expand-file-name " *VC-hg* tmp status" dir)) + (erase-buffer) (vc-hg-command (current-buffer) 'async dir "status") (vc-exec-after `(vc-hg-after-dir-status (quote ,update-function) ,status-buffer))))
--- a/lisp/vc.el Tue Feb 19 04:30:50 2008 +0000 +++ b/lisp/vc.el Tue Feb 19 07:10:33 2008 +0000 @@ -520,6 +520,16 @@ ;; 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. +;; +;; - extra-status-menu () +;; +;; Return list of menu items. The items will appear at the end of +;; the VC menu. The goal is to allow backends to specify extra menu +;; items that appear in the VC Status 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. +;; XXX: this should be changed to be a keymap, for consistency with +;; extra-menu. ;;; Todo: @@ -2621,12 +2631,21 @@ (defun vc-status-printer (fileentry) "Pretty print FILEENTRY." + ;; If you change the layout here, change vc-status-move-to-goal-column. (insert - ;; If you change this, change vc-status-move-to-goal-column. - (format "%c %-20s %s" - (if (vc-status-fileinfo->marked fileentry) ?* ? ) - (vc-status-fileinfo->state fileentry) - (vc-status-fileinfo->name fileentry)))) + (propertize + (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? )) + 'face 'font-lock-type-face) + " " + (propertize + (format "%-20s" (vc-status-fileinfo->state fileentry)) + 'face 'font-lock-variable-name-face + 'mouse-face 'highlight) + " " + (propertize + (format "%s" (vc-status-fileinfo->name fileentry)) + 'face 'font-lock-function-name-face + 'mouse-face 'highlight))) (defun vc-status-move-to-goal-column () (beginning-of-line) @@ -2669,12 +2688,30 @@ (define-key map "o" 'vc-status-find-file-other-window) (define-key map "q" 'bury-buffer) (define-key map "g" 'vc-status-refresh) + ;; Not working yet. Functions like vc-status-find-file need to + ;; find the file from the mouse position, not `point'. + ;; (define-key map [(down-mouse-3)] 'vc-status-menu) map) "Keymap for VC status") +(defun vc-status-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)))) + (easy-menu-define vc-status-mode-menu vc-status-mode-map "Menu for vc-status." '("VC Status" + ;; This is used to that VC backends could add backend specific + ;; menu items to vc-status-mode-menu. + :filter vc-status-menu-map-filter ["Open file" vc-status-find-file :help "Find the file on the current line"] ["Open in other window" vc-status-find-file-other-window @@ -2714,6 +2751,11 @@ ["Quit" bury-buffer :help "Quit"])) +(defun vc-status-menu (e) + "Popup the VC status menu." + (interactive "e") + (popup-menu vc-status-mode-menu e)) + (defun vc-status-mode () "Major mode for VC status. \\{vc-status-mode-map}"