;;; p4-change-mode.el --- submit a changelist buffer to Perforce ;; Author: Paul Du Bois <dubois@geoworks.com> ;; Maintainer: dubois@infinite-machine.com ;; $Id: //depot/tools/lisp/p4-menu.el#3 $ ;;; Commentary: ;; Still somewhat experimental, but it seems to work OK ;;; Code: (defvar p4-menu-keymap nil) (defun p4-create-menu () (setq p4-menu-keymap (make-sparse-keymap "Perforce commands")) ;; The actual key in the binding seems to be ignored for menu purposes ;; The binding is a list instead of a symbol ;; Option 1: Name unselectable; "--" special cased ;; Option 2: Name . command selectable command ;; Option 3: Name Help . command command with help info ;; Disable menu items by giving them a menu-enable property ;; These strings are modeled after the "Tools -> Version Control" menu (define-key p4-menu-keymap [toggle-read-only] '("Next Logical Action" . p4-toggle-read-only)) (define-key p4-menu-keymap [diff] '("Compare with Base Version" . p4-diff)) (define-key p4-menu-keymap [browse-file-revisions] '("Browse File History" . p4-browse-file-revisions)) (define-key p4-menu-keymap [changes] '("Show Entire History" . p4-changes)) (define-key p4-menu-keymap [action-sep] '("--")) (define-key p4-menu-keymap [add] '("Open for Add" . p4-add)) (define-key p4-menu-keymap [edit] '("Open for Edit" . p4-edit)) (define-key p4-menu-keymap [update-current-buffer] '("Sync File" . p4-update-current-buffer)) (define-key p4-menu-keymap [submit] '("Submit File" . p4-submit)) (define-key p4-menu-keymap [revert] '("Revert to Last Version" . p4-revert)) (define-key p4-menu-keymap [action-sep-2] '("--")) (define-key p4-menu-keymap [view-opened] '("Show Opened Files..." . p4-opened)) (define-key p4-menu-keymap [view-jobs] '("Show Your Jobs..." . p4-jobs)) (define-key p4-menu-keymap [update-view] '("Sync Entire Client..." . p4-update)) (define-key p4-menu-keymap [submit-change] '("Submit Multiple Files..." . p4-submit-change)) (define-key p4-menu-keymap [util-sep] '("--")) (define-key p4-menu-keymap [sync-buffers] '("Sync Buffers with Disk" . p4-sync-buffers)) (define-key p4-menu-keymap [reset] '("Flush Internal Caches" "Flush any cached client information" . p4-reset)) (let ((body (nreverse (cdr p4-menu-keymap)))) (setq body (nconc (cdr body) (list (car body)))) (setcdr p4-menu-keymap body)) (add-to-list 'menu-bar-final-items 'perforce-menu)) ;; Create once only (if (null p4-menu-keymap) (p4-create-menu)) (defcustom p4-menu-mode nil "Toggle the Perforce menu. Setting this variable directly does not take effect; Use either \\[customize] or the function `p4-menu-mode'." :set (lambda (symbol value) (p4-menu-mode (or value 0))) :initialize 'custom-initialize-default :type 'boolean :require 'p4-menu :group 'p4) (defun p4-menu-mode (&optional arg) "Toggle the Perforce menu in the menu bar. With prefix ARG, enable menu if and only if ARG is positive. Returns the new status of the Perforce menu (non-nil means enabled)." (interactive "P") (when window-system (let ((on-p (if arg (> (prefix-numeric-value arg) 0) (not p4-menu-mode)))) (if on-p (global-set-key [menu-bar perforce-menu] (cons "Perforce" p4-menu-keymap)) (global-unset-key [menu-bar perforce-menu])) (setq p4-menu-mode on-p)))) (provide 'p4-menu) (if p4-menu-mode (p4-menu-mode t))
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 464 | paul_dubois |
code drop. changes: - add jobs shme to menu - fix bug with p4-changes - p4-toggle-read-only now offers to edit file if user declines syncing to head revision - clean up docs for p4-jobs |
||
#1 | 301 | paul_dubois | Initial checkpoint of p4.el |